抽样误差与蒙特卡洛估计Sampling Error & Monte Carlo Estimation
用少量随机样本估计一个平均量时,结果为什么会波动?Why does an estimate fluctuate when it uses a finite random sample?
前置知识:Prerequisites: B16:期望与方差;B17:积分与连续分布。B16: expectation and variance; B17: integrals and continuous distributions.
复习前置:Review prerequisites: B16 · 期望、方差与样本统计Expectation, Variance & Sample Statistics · B17 · 积分直觉与连续分布Integral Intuition & Continuous Distributions
学完后你能:After this lesson you can: 用随机投点估计面积,比较多轮波动和标准误差。Estimate area with random points and compare variation across rounds with standard error.
动手观察Explore
在单位正方形内随机投点估计 y≤x² 的面积;重复多轮并改变每轮样本数,比较估计值分布。Estimate the area y≤x² by random points in the unit square; repeat rounds and change samples per round to compare the distribution of estimates.
从观察到解释From observation to explanation
把面积变成平均Turn area into an average
在单位正方形均匀独立投点;若点满足 y≤x²,记 Z=1,否则 Z=0。命中比例就是 Z 的样本均值,用来估计曲线下方面积 1/3。Draw independent uniform points in the unit square; set Z=1 if y≤x² and 0 otherwise. The hit fraction is the sample mean of Z and estimates the area under the curve, 1/3.
重复一轮又一轮Repeat independent rounds
同样的样本数,每轮随机点不同,估计也会变化。记录多轮结果可以观察估计量的分布,而不是把单次结果误当成必然结论。With the same sample count, each round uses different random points and yields a different estimate. Recording many rounds reveals the estimator’s distribution rather than treating one result as guaranteed.
方差与标准误差Variance and standard error
当观测独立同分布且方差有限时,均值估计的方差为 σ²/N,标准误差为 σ/√N。样本数变为四倍,标准误差变为原来一半;单次误差不保证逐步下降。For independent identically distributed observations with finite variance, the variance of the sample mean is σ²/N and standard error is σ/√N. Quadrupling N halves standard error; a single run’s error need not decrease monotonically.
公式与符号Formula and symbols
Zᵢ 是独立同分布的随机观测,N 是样本数,μ̂ 是平均估计,σ² 是有限的总体方差;SE 是估计量的标准差,即标准误差。Zᵢ are independent identically distributed observations, N is sample count, μ̂ the sample-mean estimate, and σ² the finite population variance. SE is the standard deviation of the estimator, called standard error.
留意这个区别Watch for this
样本相关时不能直接套用独立样本的方差公式;标准误差按平方根缩小,估计方差才按样本数倒数缩小。For correlated samples, the independent-sample variance formula does not directly apply. Standard error scales with the inverse square root; variance scales with the inverse sample count.
继续探索Explore further
课后练习
检验你的理解