matlab中求方差为啥除以n-1?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了matlab中求方差为啥除以n-1?相关的知识,希望对你有一定的参考价值。
方差有两种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-\overlinex,\,\dots,\,x_n-\overlinex),
where \overlinex is the mean. While there are n independent samples, there are only n − 1 independent residuals, as they sum to 0. 参考技术A 从数学上说,样本方差的公式是除以(n-1) 的。
总体方差的公式是除以n的。
从MATLAB的语法上说,
s = std(X,flag) for flag = 0, is the same as std(X). For flag = 1, std(X,1) returns the standard deviation using (2) above, producing the second moment of the set of values about their mean.
flag=0是除以(n-1)的。也是默认的。
flag=1是除以n的。
参考资料:http://www.mathworks.com/help/techdoc/ref/std.html
参考技术B 求方差为什么除以n-1,这个是数理统计和概率论的内容。用数学名词语言来说的话,就是要保证随机量估计的“无偏性”。
你可以用“方差 无偏性”作为关键词,在百度里搜索。
以上是关于matlab中求方差为啥除以n-1?的主要内容,如果未能解决你的问题,请参考以下文章