Typo
This commit is contained in:
parent
50b73978a4
commit
9465ae21ad
@ -955,7 +955,9 @@ the rows which only contain integers and which sum to n. (★★★)</p>
|
|||||||
<span class="keyword">print</span><span class="punctuation">(</span><span class="name">X</span><span class="punctuation">[</span><span class="name">M</span><span class="punctuation">])</span>
|
<span class="keyword">print</span><span class="punctuation">(</span><span class="name">X</span><span class="punctuation">[</span><span class="name">M</span><span class="punctuation">])</span>
|
||||||
</pre>
|
</pre>
|
||||||
</li>
|
</li>
|
||||||
<li><p class="first">Compute bootstrapped 95% confidence intervals for the mean of a 1D array X (i.e., resample the elements of an array with replacement N times, compute the mean of each sample, and then compute percentiles over the means). (★★★)</p>
|
<li><p class="first">Compute bootstrapped 95% confidence intervals for the mean of a 1D array X
|
||||||
|
(i.e., resample the elements of an array with replacement N times, compute
|
||||||
|
the mean of each sample, and then compute percentiles over the means). (★★★)</p>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
|
18
README.rst
18
README.rst
@ -1114,15 +1114,17 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
M &= (X.sum(axis=-1) == n)
|
M &= (X.sum(axis=-1) == n)
|
||||||
print(X[M])
|
print(X[M])
|
||||||
|
|
||||||
#. Compute bootstrapped 95% confidence intervals for the mean of a 1D array X (i.e., resample the elements of an array with replacement N times, compute the mean of each sample, and then compute percentiles over the means). (★★★)
|
#. Compute bootstrapped 95% confidence intervals for the mean of a 1D array X
|
||||||
|
(i.e., resample the elements of an array with replacement N times, compute
|
||||||
|
the mean of each sample, and then compute percentiles over the means). (★★★)
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
# Author: Jessica B. Hamrick
|
# Author: Jessica B. Hamrick
|
||||||
|
|
||||||
X = np.random.randn(100) # random 1D array
|
X = np.random.randn(100) # random 1D array
|
||||||
N = 1000 # number of bootstrap samples
|
N = 1000 # number of bootstrap samples
|
||||||
idx = np.random.randint(0, X.size, (N, X.size))
|
idx = np.random.randint(0, X.size, (N, X.size))
|
||||||
means = X[idx].mean(axis=1)
|
means = X[idx].mean(axis=1)
|
||||||
confint = np.percentile(means, [2.5, 97.5])
|
confint = np.percentile(means, [2.5, 97.5])
|
||||||
print(confint)
|
print(confint)
|
||||||
|
Loading…
Reference in New Issue
Block a user