计算正态样本的期望范围Calculating the expected range of normal samples
文章扩展了之前关于陪审团IQ范围的讨论,重点介绍了如何计算从标准正态分布N(0,1)中抽取n个样本的期望范围。结果以σ为单位,若实际σ不为1,需乘以相应值。这是统计学中一个重要的理论问题。
John
The previous post looked at the expected IQ range in a jury of 12. This post will look more generally at computing the expected range of n samples from a N(0, 1) random variable. This will give the expected range in units of σ, i.e. multiply the results by σ if your σ isn’t 1.
As mentioned in the previous post, the expected range is given by
where φ and Φ are the PDF and CDF of a standard normal. The integral can be calculated in closed form for n ≤ 5, but in general it requires numerical integration [1].
The following Python code can compute dn.
from scipy.stats import norm
from scipy.integrate import quad
import numpy as np
def d(n):
integrand = lambda x: x*norm.pdf(x)*norm.cdf(x)**(n-1)
res, info = quad(integrand, -np.inf, np.inf)
return 2*n*resFor large n we have the asymptotic approximation
which we could implement in Python by
def approx(n):
return 2*norm.ppf((n - 0.375)/(n + 0.25))For very large n the asymptotic expression may be more accurate than the integral due to numerical integration error.
Here are a few example values.
|-----+-------|
| n | d_n |
|-----+-------|
| 2 | 1.128 |
| 3 | 1.693 |
| 5 | 2.326 |
| 10 | 3.078 |
| 12 | 3.258 |
| 23 | 3.858 |
| 50 | 4.498 |
| 100 | 5.015 |
|-----+-------|[1] Order Statistics by H. A. David. John Wiley & Sons. 1970.
需要完整排版与评论请前往来源站点阅读。