Typo again (grrr)
This commit is contained in:
@@ -958,9 +958,6 @@ the rows which only contain integers and which sum to n. (★★★)</p>
|
|||||||
<li><p class="first">Compute bootstrapped 95% confidence intervals for the mean of a 1D array X
|
<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
|
(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>
|
the mean of each sample, and then compute percentiles over the means). (★★★)</p>
|
||||||
</li>
|
|
||||||
</ol>
|
|
||||||
<blockquote>
|
|
||||||
<pre class="code python literal-block">
|
<pre class="code python literal-block">
|
||||||
<span class="comment single"># Author: Jessica B. Hamrick</span>
|
<span class="comment single"># Author: Jessica B. Hamrick</span>
|
||||||
|
|
||||||
@@ -971,7 +968,8 @@ the mean of each sample, and then compute percentiles over the means). (★★
|
|||||||
<span class="name">confint</span> <span class="operator">=</span> <span class="name">np</span><span class="operator">.</span><span class="name">percentile</span><span class="punctuation">(</span><span class="name">means</span><span class="punctuation">,</span> <span class="punctuation">[</span><span class="literal number float">2.5</span><span class="punctuation">,</span> <span class="literal number float">97.5</span><span class="punctuation">])</span>
|
<span class="name">confint</span> <span class="operator">=</span> <span class="name">np</span><span class="operator">.</span><span class="name">percentile</span><span class="punctuation">(</span><span class="name">means</span><span class="punctuation">,</span> <span class="punctuation">[</span><span class="literal number float">2.5</span><span class="punctuation">,</span> <span class="literal number float">97.5</span><span class="punctuation">])</span>
|
||||||
<span class="keyword">print</span><span class="punctuation">(</span><span class="name">confint</span><span class="punctuation">)</span>
|
<span class="keyword">print</span><span class="punctuation">(</span><span class="name">confint</span><span class="punctuation">)</span>
|
||||||
</pre>
|
</pre>
|
||||||
</blockquote>
|
</li>
|
||||||
|
</ol>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
16
README.rst
16
README.rst
@@ -1118,13 +1118,13 @@ Thanks to Michiaki Ariga, there is now a
|
|||||||
(i.e., resample the elements of an array with replacement N times, compute
|
(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). (★★★)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user