Why do two readings give two conventional variances?
var divides the sum of squared deviations by N minus ddof. Adjusting ddof changes the estimator's denominator.
numpy.var in practice
For two and six the squared deviations sum to eight. Population variance is four and the ddof-one estimate is eight. A meaningful estimate needs a positive denominator.
import numpy as np
[np.var([2,6],ddof=k) for k in [0,1]]Result [4.0, 8.0]
中文
两个观测为何能算出两种常见方差?
var 以离均差平方和除以 N 减 ddof。改变 ddof 会改变估计量的分母。
numpy.var 算例
对于 2、6,离均平方和为 8,总体口径得到 4,设 ddof=1 得到 8。分母必须大于零才能给出有意义的估计。
import numpy as np
[np.var([2,6],ddof=k) for k in [0,1]]结果 [4.0, 8.0]