In statistics and in particular statistical theory, unbiased estimation of a standard deviation is the calculation from a statistical sample of an estimated value of the standard deviation (a measure of statistical dispersion) of a population of values, in such a way that the expected value of the calculation equals the true value. Except in some important situations, outlined later, the task has little relevance to applications of statistics since its need is avoided by standard procedures, such as the use of significance tests and confidence intervals, or by using Bayesian analysis.
However, for statistical theory, it provides an exemplar problem in the context of estimation theory which is both simple to state and for which results cannot be obtained in closed form. It also provides an example where imposing the requirement for unbiased estimation might be seen as just adding inconvenience, with no real benefit.
In statistics, the standard deviation of a population of numbers is often estimated from a random sample drawn from the population. This is the sample standard deviation, which is defined by
s=\sqrt{
| ||||||||||
) |
2}{n-1}},
where
\{x1,x2,\ldots,xn\}
\overline{x}
One way of seeing that this is a biased estimator of the standard deviation of the population is to start from the result that s2 is an unbiased estimator for the variance σ2 of the underlying population if that variance exists and the sample values are drawn independently with replacement. The square root is a nonlinear function, and only linear functions commute with taking the expectation. Since the square root is a strictly concave function, it follows from Jensen's inequality that the square root of the sample variance is an underestimate.
The use of n - 1 instead of n in the formula for the sample variance is known as Bessel's correction, which 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.
It is not possible to find an estimate of the standard deviation which is unbiased for all population distributions, as the bias depends on the particular distribution. Much of the following relates to estimation assuming a normal distribution.
When the random variable is normally distributed, a minor correction exists to eliminate the bias. To derive the correction, note that for normally distributed X, Cochran's theorem implies that
(n-1)s2/\sigma2
n-1
\sqrt{n-1}s/\sigma
n-1
\operatorname{E}[s]=c4(n)\sigma
where the correction factor
c4(n)
n-1
\mu1/\sqrt{n-1}
c4(n)=\sqrt{
2 | |
n-1 |
where Γ(·) is the gamma function. An unbiased estimator of σ can be obtained by dividing
s
c4(n)
n
c4(n)
c4(n)
n
Sample size | Expression of c4 | Numerical value | |||||||
---|---|---|---|---|---|---|---|---|---|
2 |
| 0.7978845608 | |||||||
3 |
| 0.8862269255 | |||||||
4 | 2\sqrt{
| 0.9213177319 | |||||||
5 |
| 0.9399856030 | |||||||
6 |
| 0.9515328619 | |||||||
7 |
| 0.9593687891 | |||||||
8 |
| 0.9650304561 | |||||||
9 |
| 0.9693106998 | |||||||
10 |
| 0.9726592741 | |||||||
100 | 0.9974779761 | ||||||||
1000 | 0.9997497811 | ||||||||
10000 | 0.9999749978 | ||||||||
2k |
| ||||||||
2k+1 |
|
It is important to keep in mind this correction only produces an unbiased estimator for normally and independently distributed X. When this condition is satisfied, another result about s involving
c4(n)
2 | |
\sigma\sqrt{1-c | |
4 |
-2 | |
\sigma\sqrt{c | |
4 |
-1}.
If calculation of the function c4(n) appears too difficult, there is a simple rule of thumb[4] to take the estimator
\hat\sigma=\sqrt{
1 | |
n-1.5 |
n(x | |
\sum | |
i |
-\overline{x})2}
The formula differs from the familiar expression for s2 only by having instead of in the denominator. This expression is only approximate; in fact,
\operatorname{E}\left[\hat\sigma\right]=\sigma ⋅ \left(1+
1 | |
16n2 |
+
3 | |
16n3 |
+O(n-4)\right).
The bias is relatively small: say, for
n=3
n=9
In cases where statistically independent data are modelled by a parametric family of distributions other than the normal distribution, the population standard deviation will, if it exists, be a function of the parameters of the model. One general approach to estimation would be maximum likelihood. Alternatively, it may be possible to use the Rao–Blackwell theorem as a route to finding a good estimate of the standard deviation. In neither case would the estimates obtained usually be unbiased. Notionally, theoretical adjustments might be obtainable to lead to unbiased estimates but, unlike those for the normal distribution, these would typically depend on the estimated parameters.
If the requirement is simply to reduce the bias of an estimated standard deviation, rather than to eliminate it entirely, then two practical approaches are available, both within the context of resampling. These are jackknifing and bootstrapping. Both can be applied either to parametrically based estimates of the standard deviation or to the sample standard deviation.
For non-normal distributions an approximate (up to O(n−1) terms) formula for the unbiased estimator of the standard deviation is
\hat\sigma=\sqrt{
1 | |
n-1.5-\tfrac{1 |
{4}\gamma2}
n | |
\sum | |
i=1 |
\left(xi-\overline{x}\right)2},
where γ2 denotes the population excess kurtosis. The excess kurtosis may be either known beforehand for certain distributions, or estimated from the data.
The material above, to stress the point again, applies only to independent data. However, real-world data often does not meet this requirement; it is autocorrelated (also known as serial correlation). As one example, the successive readings of a measurement instrument that incorporates some form of “smoothing” (more correctly, low-pass filtering) process will be autocorrelated, since any particular value is calculated from some combination of the earlier and later readings.
Estimates of the variance, and standard deviation, of autocorrelated data will be biased. The expected value of the sample variance is[5]
{\rmE}\left[s2\right]=\sigma2\left[1-
2 | |
n-1 |
n-1 | |
\sum | |
k=1 |
\left(1-
k | |
n |
\right)\rhok\right]
where n is the sample size (number of measurements) and
\rhok
s2
To illustrate the magnitude of the bias in the standard deviation, consider a dataset that consists of sequential readings from an instrument that uses a specific digital filter whose ACF is known to be given by
\rhok=(1-\alpha)k
where α is the parameter of the filter, and it takes values from zero to unity. Thus the ACF is positive and geometrically decreasing. The figure shows the ratio of the estimated standard deviation to its known value (which can be calculated analytically for this digital filter), for several settings of α as a function of sample size n. Changing α alters the variance reduction ratio of the filter, which is known to be
{\rmVRR}=
\alpha | |
2-\alpha |
so that smaller values of α result in more variance reduction, or “smoothing.” The bias is indicated by values on the vertical axis different from unity; that is, if there were no bias, the ratio of the estimated to known standard deviation would be unity. Clearly, for modest sample sizes there can be significant bias (a factor of two, or more).
It is often of interest to estimate the variance or standard deviation of an estimated mean rather than the variance of a population. When the data are autocorrelated, this has a direct effect on the theoretical variance of the sample mean, which is[7]
{\rmVar}\left[\overlinex\right]=
\sigma2 | |
n |
\left[1+2
n-1 | |
\sum | |
k=1 |
{\left(1-
k | |
n |
\right)\rhok}\right].
The variance of the sample mean can then be estimated by substituting an estimate of σ2. One such estimate can be obtained from the equation for E[s<sup>2</sup>] given above. First define the following constants, assuming, again, a known ACF:
\gamma1\equiv1-
2 | |
n-1 |
n-1 | |
\sum | |
k=1 |
{\left(1-
k | |
n |
\right)}\rhok
\gamma2\equiv1+2
n-1 | |
\sum | |
k=1 |
{\left(1-
k | |
n |
\right)}\rhok
so that
{\rmE}\left[s2\right]=\sigma2\gamma1 ⇒ {\rmE}\left[
s2 | |
\gamma1 |
\right]=\sigma2
This says that the expected value of the quantity obtained by dividing the observed sample variance by the correction factor
\gamma1
{\rmVar}\left[{\overlinex}\right]=
\sigma2 | |
n |
\gamma2
and substituting the estimate for
\sigma2
{\rmVar}\left[\overline{x}\right]={\rmE}\left[
s2 | |
\gamma1 |
\left(
\gamma2 | |
n |
\right)\right]={\rmE}\left[
s2 | |
n |
\left\{
n-1 | ||||
|
\right\}\right]
which is an unbiased estimator of the variance of the mean in terms of the observed sample variance and known quantities. If the autocorrelations
\rhok
Having the expressions above involving the variance of the population, and of an estimate of the mean of that population, it would seem logical to simply take the square root of these expressions to obtain unbiased estimates of the respective standard deviations. However it is the case that, since expectations are integrals,
{\rmE}[s]\ne\sqrt{{\rmE}\left[s2\right]}\ne\sigma\sqrt{\gamma1}
Instead, assume a function θ exists such that an unbiased estimator of the standard deviation can be written
{\rmE}[s]=\sigma\theta\sqrt{\gamma1} ⇒ \hat\sigma=
s | |
\theta\sqrt{\gamma1 |
and θ depends on the sample size n and the ACF. In the case of NID (normally and independently distributed) data, the radicand is unity and θ is just the c4 function given in the first section above. As with c4, θ approaches unity as the sample size increases (as does γ1).
It can be demonstrated via simulation modeling that ignoring θ (that is, taking it to be unity) and using
{\rmE}[s] ≈ \sigma\sqrt{\gamma1} ⇒ \hat\sigma ≈
s | |
\sqrt{\gamma1 |
removes all but a few percent of the bias caused by autocorrelation, making this a reduced-bias estimator, rather than an unbiased estimator. In practical measurement situations, this reduction in bias can be significant, and useful, even if some relatively small bias remains. The figure above, showing an example of the bias in the standard deviation vs. sample size, is based on this approximation; the actual bias would be somewhat larger than indicated in those graphs since the transformation bias θ is not included there.
The unbiased variance of the mean in terms of the population variance and the ACF is given by
{\rmVar}\left[{\overlinex}\right]=
\sigma2 | |
n |
\gamma2
and since there are no expected values here, in this case the square root can be taken, so that
\sigma\overline=
\sigma | |
\sqrt{n |
Using the unbiased estimate expression above for σ, an estimate of the standard deviation of the mean will then be
\hat\sigma\overline=
s | |
\theta\sqrt{n |
If the data are NID, so that the ACF vanishes, this reduces to
\hat\sigma\overline=
s | |
c4\sqrt{n |
In the presence of a nonzero ACF, ignoring the function θ as before leads to the reduced-bias estimator
\hat\sigma\overline ≈
s | |
\sqrt{n |
which again can be demonstrated to remove a useful majority of the bias.