擅长:python、mysql、java
<p>我假设在这种情况下,我们讨论的是从总体中不替换地绘制,因此它是超几何分布,其概率质量函数(pmf)由下式给出:</p>
<p><a href="https://i.stack.imgur.com/qGkDg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qGkDg.png" alt="enter image description here"/></a></p>
<p>在哪里</p>
<blockquote>
<p>M is the population size, 200 in this example </p>
<p>n is the number of girls in the population, 0.47*200 = 94</p>
<p>N is the number of draws, 24</p>
<p>k is the number of observed successes, no of girls</p>
</blockquote>
<p>我们使用<a href="https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.hypergeom.html" rel="nofollow noreferrer">hypergeom from scipy</a>:</p>
<pre><code>from scipy.stats import hypergeom
rv = hypergeom(200,94,24)
sum(rv.pmf([6,7,8,9]))
0.21462937817887562
</code></pre>
<p>所以概率是0.21462937817887562</p>