Tutorials › VEE Mathematical Statistics › Sample Variance and the n and n Minus One Convention

VEE Mathematical Statistics · Random Samples and Statistics · Tutorial 354 of 880

Sample Variance and the n and n Minus One Convention

Learn to calculate both versions of sample variance, understand when each convention is useful, and recognize why the two denominators are not interchangeable.

Intermediate 11 min read

What You'll Learn

  • Define the sample mean and squared deviations used in both variance conventions
  • Calculate sample variance with divisor n and with divisor n minus one
  • Explain the descriptive and inferential purposes of the two conventions
  • Understand how estimating the sample mean constrains the deviations
  • Identify the correct divisor from a problem’s wording and statistical goal
  • Check units, sample size, and rounding in variance calculations

Why Are There Two Sample Variances?

A sample variance summarizes how spread out a set of observations is around its sample mean. There are two common ways to divide the total squared deviation: by the sample size \(n\), or by \(n-1\). The arithmetic before division is the same; the divisor and the purpose of the result differ.

The distinction matters in statistical work. Dividing by \(n\) describes the spread of the observed sample itself and is also the maximum likelihood estimate of a normal population variance when the mean is unknown. Dividing by \(n-1\) is the standard corrected estimator of population variance in an independent, identically distributed sample with finite variance. A question asking for the variance of the observed data is not necessarily asking for the corrected estimate of a population variance.

Definition: For observed values \(x_1,x_2,\ldots,x_n\), where \(n\geq 1\), the sample mean is $$ \bar{x}=\frac{1}{n}\sum_{i=1}^{n}x_i. $$ The sample variance with divisor \(n\) is $$ s_n^2=\frac{1}{n}\sum_{i=1}^{n}(x_i-\bar{x})^2. $$ For \(n\geq 2\), the sample variance with divisor \(n-1\), also called the corrected sample variance, is $$ s^2=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\bar{x})^2. $$

Here \(x_i\) denotes the \(i\)th observed value, and \(\bar{x}\) is calculated from the same observations. Both variances are nonnegative and are measured in squared units: if the data are measured in dollars, variance is measured in dollars squared. The corresponding standard deviations, if needed, are the nonnegative square roots of the variances and are in the original units.

The notation \(s_n^2\) makes the divisor explicit; some sources instead write \(s^2\) for the version with divisor \(n\). Always check the stated definition or the problem’s purpose rather than relying on a symbol alone. In this tutorial, \(s^2\) consistently means the version with divisor \(n-1\).

What the Divisors Are For

When the goal is to describe the particular observed data set, \(s_n^2\) is the direct average of its squared deviations from its mean. Equivalently, it is the variance of the empirical distribution that assigns probability \(1/n\) to each observation, counting repeated observations with their multiplicities. It describes the data actually in hand; it does not, by itself, claim to correct for the fact that those observations came from a larger population.

When observations are treated as a random sample from a population and the goal is to estimate the population variance, \(s^2\) is the conventional corrected estimate. More precisely, suppose \(X_1,\ldots,X_n\) are independent and identically distributed with finite population mean \(\mu\) and finite population variance \(\sigma^2\). Then the corrected sample variance is unbiased for \(\sigma^2\). The divisor \(n-1\) accounts for using the sample to estimate its own center, rather than centering deviations at a known population mean.

A further use of the divisor \(n\) arises under a specific model: if the observations are independent from a normal distribution \(N(\mu,\sigma^2)\), with both \(\mu\) and \(\sigma^2\) unknown, the maximum likelihood estimate of \(\sigma^2\) is \(s_n^2\). This is a model-based estimation result, not a reason to use \(n\) for every estimate of population variance. In many standard inferential procedures, \(s^2\) is used instead. The question’s stated model and objective determine which convention is appropriate.

Why Does the Sample Mean Leave \(n-1\) Free Deviations?

The deviations from the sample mean cannot vary independently: their sum must be zero. This restriction explains the degrees-of-freedom interpretation of \(n-1\), though the restriction alone is not a proof of the unbiasedness of \(s^2\).

1
Write each centered deviation.
For observation \(i\), the deviation is \(x_i-\bar{x}\).
2
Add the deviations.
Using the definition of \(\bar{x}\), their sum is \(\sum_{i=1}^{n}(x_i-\bar{x})=\sum_{i=1}^{n}x_i-n\bar{x}=0\).
3
Identify the constraint.
Once any \(n-1\) deviations are known, the final one must be the negative of their sum. Thus only \(n-1\) deviations can be chosen freely.

This is why the corrected variance is associated with \(n-1\) degrees of freedom. It is not a license to replace every occurrence of \(n\) by \(n-1\): \(n\) remains the number of observations and is still used to calculate \(\bar{x}\). The correction changes only the divisor of the sum of squared deviations.

Worked Example: Calculate Both Variances for Four Measurements

A hypothetical technician records four measurement errors, in millimeters: \(4,6,8,10\). Treat these as the observed sample only; no parametric distribution, population parameters, interest rate, or mortality assumption is specified or needed. Calculate both sample variances.

Method. Find the sample mean, calculate each squared deviation from that mean, and divide the same total by each of the two specified divisors.

First calculate the mean: $$ \bar{x}=\frac{4+6+8+10}{4}=\frac{28}{4}=7\text{ mm}. $$

The deviations are \(4-7=-3\), \(6-7=-1\), \(8-7=1\), and \(10-7=3\) millimeters. Their squared deviations are \(9,1,1,9\) square millimeters, so their sum is $$ \sum_{i=1}^{4}(x_i-\bar{x})^2=9+1+1+9=20\text{ mm}^2. $$

For the divisor-\(n\) version, divide by \(4\): $$ s_n^2=\frac{20}{4}=5\text{ mm}^2. $$ For the corrected version, divide by \(4-1=3\): $$ s^2=\frac{20}{3}=6.6667\text{ mm}^2 $$ to four decimal places.

Check. The two answers use the same sum of squared deviations; \(6.6667\) is larger than \(5\), as it must be because the same positive numerator is divided by \(3\) instead of \(4\). The common mistake avoided here is dividing by \(n-1\) when describing the variance of the observed data without checking whether the question calls for the corrected estimate.

Worked Examples

Worked Example: Claim Amounts Recorded in Thousands

For a hypothetical portfolio exercise, five claim amounts are recorded in thousands of dollars as \(1,2,2,5,10\). These are observed values; assume no particular distribution or population parameters, and no interest rate or mortality assumption applies. Calculate both sample variances in squared thousands of dollars.

Method. Use the observed mean as the center, then compare division by \(n\) with division by \(n-1\).

The sample size is \(n=5\), and the sample mean is $$ \bar{x}=\frac{1+2+2+5+10}{5}=\frac{20}{5}=4. $$

The deviations from \(4\) are \(-3,-2,-2,1,6\). Squaring and adding gives $$ \sum_{i=1}^{5}(x_i-\bar{x})^2=(-3)^2+(-2)^2+(-2)^2+1^2+6^2=9+4+4+1+36=54. $$

The variance with divisor \(n\) is $$ s_n^2=\frac{54}{5}=10.8\text{ (thousand dollars)}^2. $$ The corrected sample variance is $$ s^2=\frac{54}{5-1}=\frac{54}{4}=13.5\text{ (thousand dollars)}^2. $$

Check. The value \(10\) is relatively far from the mean and contributes \(36\) of the \(54\) squared units, so a substantial total spread is reasonable. The common mistake avoided is reporting \(13.5\) as if it were the average squared deviation of these five observed amounts; that descriptive average is \(10.8\). The larger number is the corrected estimate.

Worked Example: Use Repeated Values Without Losing Their Count

A hypothetical monitoring sample, measured in minutes, is recorded as \(3,3,5,7,7,7\). Treat these as the complete observed sample for this calculation; no distributional parameters, interest rate, or mortality assumption are specified. Find both variance conventions.

Method. Keep the repeated observations in the sample count and in the squared-deviation total; a repeated value contributes once for each time it was observed.

There are \(n=6\) observations, with sum \(3+3+5+7+7+7=32\). Therefore, $$ \bar{x}=\frac{32}{6}=\frac{16}{3}\text{ minutes}. $$

Each value of \(3\) has deviation \(3-\frac{16}{3}=-\frac{7}{3}\), and there are two such observations. The value \(5\) has deviation \(5-\frac{16}{3}=-\frac{1}{3}\). Each value of \(7\) has deviation \(7-\frac{16}{3}=\frac{5}{3}\), and there are three such observations. Thus, $$ \sum_{i=1}^{6}(x_i-\bar{x})^2 =2\left(\frac{49}{9}\right)+\frac{1}{9}+3\left(\frac{25}{9}\right) =\frac{98+1+75}{9} =\frac{174}{9} =\frac{58}{3}\text{ minutes}^2. $$

Divide by \(6\) for the observed-data variance: $$ s_n^2=\frac{58/3}{6}=\frac{29}{9}=3.2222\text{ minutes}^2 $$ to four decimal places. Divide by \(6-1=5\) for the corrected sample variance: $$ s^2=\frac{58/3}{5}=\frac{58}{15}=3.8667\text{ minutes}^2 $$ to four decimal places.

Check. The squared-deviation sum is positive, and the corrected version is larger because its divisor is smaller. Counting the values \(3\) and \(7\) only once would change both \(n\) and the mean, so the common mistake avoided is treating a list with repeats as a list of distinct values rather than as six observations.

Choosing and Reporting the Convention

Before calculating, identify what the variance is meant to represent. The following guide separates the two roles without changing the underlying squared-deviation calculation.

GoalVariance conventionKey point
Describe the spread of the observed values as an empirical data set\(s_n^2=\frac{1}{n}\sum (x_i-\bar{x})^2\)Divide by the number of observed values.
Estimate a population variance from an iid sample with finite variance\(s^2=\frac{1}{n-1}\sum (x_i-\bar{x})^2\)Use the corrected divisor \(n-1\).
Estimate the variance in a normal model by maximum likelihood when the mean is unknown\(s_n^2\)This is a model-specific maximum likelihood result; it does not make the two conventions interchangeable.

For \(n\geq2\), the relationship between the two versions follows directly because their numerators are identical: $$ s^2=\frac{n}{n-1}s_n^2, \qquad s_n^2=\frac{n-1}{n}s^2. $$ Therefore \(s^2>s_n^2\) whenever the observations are not all identical. If they are all identical, both variances are zero. For \(n=1\), \(s_n^2=0\), but \(s^2\) is undefined because its divisor is zero; one observation cannot provide the usual corrected estimate of population variance.

Common Mistakes and Exam Traps

A frequent error is to use the right numerator with the wrong denominator. For example, if the squared-deviation sum is \(20\) for \(n=4\), writing \(20/(n-1)=20/4=5\) is incorrect: \(n-1=3\), so the corrected variance is \(20/3\). The value \(20/4=5\) is the divisor-\(n\) variance.

  • Do not change how the mean is calculated. Both versions use \(\bar{x}=\sum x_i/n\), not a mean calculated with divisor \(n-1\).
  • Do not confuse the sum with the variance. The sum of squared deviations is \(\sum (x_i-\bar{x})^2\); a variance results only after dividing it by the specified divisor.
  • Read the target carefully. “Variance of these observed data” usually calls for divisor \(n\); “unbiased estimate of population variance” calls for divisor \(n-1\) under iid sampling with finite variance.
  • Keep the units squared. Variance of dollar measurements is in dollars squared, not dollars. A standard deviation, by contrast, returns to dollars.
  • Do not use \(n-1\) when \(n=1\). The corrected variance is undefined for a single observation.

A reliable solution names the convention, states the sample size, shows the mean and squared-deviation total, and then shows the division. That makes it possible to distinguish a calculation error from a choice-of-convention error.

Check Your Understanding

For each problem, decide which divisor is requested and show the mean and squared-deviation total before dividing.

  1. A sample of four readings is \(2,4,6,8\). Find both variance conventions. (Answer: \(\bar{x}=5\), squared-deviation sum \(20\), \(s_n^2=5\), and \(s^2=20/3\approx6.6667\).)
  2. Three observed values are \(5,5,9\). Find the divisor-\(n\) variance and the corrected sample variance. (Answer: \(\bar{x}=19/3\), squared-deviation sum \(32/3\), \(s_n^2=32/9\), and \(s^2=16/3\).)
  3. For \(n=8\), the sum of squared deviations from the sample mean is \(70\). Calculate both versions. (Answer: \(s_n^2=70/8=8.75\), and \(s^2=70/7=10\).)
  4. A normal-model analysis with unknown mean reports a maximum likelihood estimate of variance of \(12\), based on \(n=10\) observations. What is the corrected sample variance for the same data? (Answer: \(s_n^2=12\), so \(s^2=\frac{10}{9}(12)=13.3333\) to four decimal places.)
  5. One observation is recorded, \(x_1=11\). What are \(s_n^2\) and \(s^2\), and why can only one of them be calculated? (Answer: \(s_n^2=0\); \(s^2\) is undefined because \(n-1=0\).)
Clinical Biostats