方差有两种biased和unbiased,前者除以n;后者除以n-1,叫做Bessel's correction,可以修正样本的variance,更精确描述样本空间。matlab采用的是后者。
抄一段对两者区别的解释
In statistics, Bessel's correction, named after Friedrich Bessel, is the use of n − 1 instead of n in the formula for the sample variance and sample standard deviation, where n is the number of observations in a sample: it corrects the bias in the estimation of the population variance, and some (but not all) of the bias in the estimation of the population standard deviation.
That is, when estimating the population variance and standard deviation from a sample when the population mean is unknown, the sample variance is a biased estimator of the population variance, and systematically underestimates it. Multiplying the standard sample variance by n/(n − 1) (equivalently, using 1/(n − 1) instead of 1/n) corrects for this, and gives an unbiased estimator of the population variance. The cost of this correction is that the unbiased estimator has uniformly higher mean squared error than the biased estimator.
A subtle point is that, while the sample variance (using Bessel's correction) is an unbiased estimate of the population variance, its square root, the sample standard deviation, is a biased estimate of the population standard deviation; because the square root is a concave function, the bias is downward, by Jensen's inequality. There is no general formula for an unbiased estimator of the population standard deviation, though there are correction factors for particular distributions, such as the normal; see unbiased estimation of standard deviation for details.
One can understand Bessel's correction intuitively as the degrees of freedom in the residuals vector:
(x_1-\overline{x},\,\dots,\,x_n-\overline{x}),
where \overline{x} is the mean. While there are n independent samples, there are only n − 1 independent residuals, as they sum to 0.