Definitionintro
Sample variance
Also called Bessel's correction, unbiased sample variance.
The sum of squared deviations from the sample mean divided by n - 1. Dividing by n - 1 instead of n makes it unbiased for the population variance.
The sample variance of numbers is the sum of their squared deviations from the sample mean, divided by . As an estimator of the population variance it is unbiased whenever is finite, while the same sum divided by is biased downward by . The factor that turns the second into the first is Bessel's correction. This page is the definition and its exact properties; Welford's algorithm and the Chan-Golub-LeVeque algorithm are ways to compute it.
Definition
Let be the sample, , with sample mean . The sample variance is
and the sample standard deviation is . The version with divisor is written here as
It is the maximum likelihood estimator of for normal data. Both are defined on the observed values by the same formulas. For , is not defined, and .
Equal forms. Write . For all real :
- . Expand and use .
- for every real . This is form 1 applied to , whose mean is and whose is the same. So does not change when every value is shifted by .
- , so . Proof. by form 1, and the double sum counts each pair twice. Form 3 shows that is the U-statistic with kernel .
The forms are equal in exact arithmetic only. In floating point, form 1 subtracts two large, nearly equal numbers when is large compared with the spread, and it can lose every digit (catastrophic cancellation). Form 2 with near is the cure used by the shifted and two-pass methods.
Unbiasedness. Let be uncorrelated with common mean and common variance . Then and .
Proof. Form 2 with gives . Take expectations: for each , and for uncorrelated data (see standard error). So . Divide by and by .
The deviations sum to zero, so only of them are free; the divisor is the number of these degrees of freedom. Measuring the spread around , which is fitted to the same data, gives a smaller sum than measuring it around the true , and the loss is exactly one on average.
Further properties.
- Normal data. For iid data, has the chi-square law with degrees of freedom and is independent of (see sampling distribution). So , the variance of that chi-square law times .
- The divisor and the mean squared error. Unbiased does not mean best in squared error. For normal data the divisor gives the smallest mean squared error among the divisors; that page has the computation.
- is biased for . unless is constant; see bias of an estimator for the exact factor under normality.
- Consistency. For iid data with , in probability; the proof is on consistent estimator. The same argument with the strong law of large numbers gives almost sure convergence.
Examples and non-examples
A sample of five. For , .
| 3 | 7 | 7 | 9 | 14 | sum | |
|---|---|---|---|---|---|---|
| 1 | 6 | 0 | ||||
| 25 | 1 | 1 | 1 | 36 | 64 |
So , and . Form 1 gives . The 10 pairwise squared differences sum to , as form 3 states.
A proportion. For 0 and 1 data with sample proportion , , so and .
A finite population. For a whole finite population there is nothing to estimate: its variance has divisor . Survey sampling texts still define , because with this divisor the sample variance of a simple random sample drawn without replacement is unbiased for (Cochran, Chapter 2). Say which divisor a formula uses.
Frequency weights. If value occurs times (integer ), the sample variance of the expanded data is with and . Weights that express precision instead of counts need a different correction.
Non-example: dividing by around the true mean. If is known, is unbiased. Dividing it by would bias it upward. The correction belongs to deviations from only.
Non-example: the mean absolute deviation. measures spread too, but it is not a variance, and it is not unbiased for or for .
Related definitions
- Variance: the population quantity that estimates.
- Standard error: estimates the standard error of .
- Welford's algorithm: computes and in one pass and in constant memory, without the cancellation of form 1.
- Chan-Golub-LeVeque algorithm: combines the of two parts into those of their union, for parallel and pairwise computation.
- Covariance matrix: the sample covariance uses the same divisor and the same forms.
- U-statistic: form 3 makes the simplest nontrivial example.
References
- George Casella and Roger L. Berger, Statistical Inference, second edition, Duxbury, 2002, Section 5.2 (the sample mean and the sample variance, and E S^2 = sigma^2) and Section 5.3.1 (the chi-square law of (n - 1) S^2 / sigma^2 for normal data)
- William G. Cochran, Sampling Techniques, third edition, Wiley, 1977, Chapter 2 (simple random sampling, the finite population variance with divisor N - 1)
- Nicholas J. Higham, Accuracy and Stability of Numerical Algorithms, second edition, SIAM, 2002, Section 1.9 (computing the sample variance, the one-pass and two-pass formulas)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag DWN5JT Edit this page History Report an error Markdown