AI Glossary / Statistics and probability / Intermediate

Sample variance

Definition

Sample variance is a measure of how widely observations are dispersed around their sample mean. The usual unbiased estimator is s² = sum((xi−x-bar)²)/(n−1), for n greater than one. It uses squared deviations, so its units are the square of the original measurement units. The term sometimes also refers to a denominator-n descriptive variance, making the stated convention important.

What it means

A mean describes the sample's central level; variance describes how far the observations tend to spread around that level in squared-distance terms. Two datasets can have the same mean and very different variances.
Squaring prevents positive and negative deviations from canceling and gives large deviations substantial influence. The square root of variance is the standard deviation, which returns the summary to the original units. Variance is particularly convenient for mathematical analysis, but it can be less intuitive to communicate directly.

How it works

Calculate the mean of the included observations. Subtract it from every value, square each deviation, and add those squares. Divide by n−1 for the conventional unbiased sample-variance estimator.
The denominator reflects estimation of the mean from the same data. The centered deviations must sum to zero, leaving n−1 freely varying deviations. Under independent identically distributed sampling with a finite variance, the expected sum of squared deviations is (n−1) times the population variance.
Normality is not required for that unbiasedness result. It is required for some familiar exact distributional results and confidence intervals for variance. State the assumptions used for inference rather than attaching every normal-theory conclusion to the arithmetic formula.
A denominator of n calculates the mean squared deviation in the observed dataset. It also arises in the Gaussian maximum-likelihood estimate when the population mean is estimated. Neither convention should be silently substituted for the other; software defaults can differ.
Adding the same constant to every observation leaves variance unchanged because deviations from the mean remain the same. Multiplying all observations by c multiplies variance by c². This makes unit conversion especially important when comparing reported variances.
Distinguish variability of observations from uncertainty in a mean. Under simple independent sampling, the estimated variance of the sample mean is s²/n. This is smaller than the sample variance and addresses a different question.
Inspect extreme values and data quality. A transcription error can inflate variance, but a valid unusual value may be important to the population being described. Resistant spread measures can supplement the analysis when appropriate, without automatically estimating the same target as variance.
Handle weights, dependence, and missing values explicitly. The simple formula is not a universal unbiased estimator for every weighted or correlated dataset. Also use numerically stable software, especially when values are large but differences among them are small; subtracting two nearly equal large totals can lose precision.

Three practical examples

  • Process monitoring: engineers compare variability in dimensions across production periods.
  • AI diagnostics: analysts examine feature variances before selecting a scaling approach.
  • Study planning: researchers use a defensible variance estimate as one input to precision or power calculations, allowing for its uncertainty.

Think of it this way

Think of a scatter of points around a center. Variance adds up the squared distances from that center and applies a stated denominator. Moving the whole scatter sideways does not change its spread, but stretching every distance doubles the standard deviation and quadruples the variance.

Worked example

Four fictional measurements are 3, 5, 7, and 9 units. Their mean is 6. Deviations are −3, −1, 1, and 3, and the squared deviations sum to 9+1+1+9 = 20.
Using denominator n−1, sample variance is 20/3, approximately 6.667 squared units. The sample standard deviation is sqrt(20/3), approximately 2.582 units.
Using denominator n instead gives 20/4 = 5 squared units. The difference is a convention change, not a different set of observations.
Adding 100 to every measurement leaves the variance at 20/3. Doubling every measurement gives variance 4×20/3 = 80/3, approximately 26.667. Under an independent sampling model, the estimated variance of the original sample mean is (20/3)/4 = 5/3, a separate uncertainty quantity.

Illustrative case study

Fictional case: Hazel Instruments compares two sensor-calibration reports and finds different variance values for the same measurements. One tool divides by n and the other by n−1.
The team documents the intended estimator and aligns settings before comparing periods. It also inspects unusual readings and calibration changes, rather than assuming that a rise in variance necessarily reflects deterioration in the monitored equipment.

Common misconceptions and mistakes

Variance is not in the original measurement units; standard deviation is.
A zero variance means all included values are identical, not that they are accurate.
Unbiased variance estimation does not mean every sample gives the true variance, and taking the square root does not preserve unbiasedness in general.
Normality is not needed for the basic unbiasedness of s² under independent identical sampling with finite variance.
A single observation does not provide the usual n−1 sample variance.

Business use

Use sample variance when spread is an important part of performance, risk, or model behavior. Report its denominator and units, and use standard deviation or a plot when those are clearer for readers. When variance feeds a planning or modeling calculation, assess sensitivity because a small sample can estimate spread poorly.

People also ask

Can sample variance be negative?

Not in exact arithmetic with the usual real-valued definition.

Does shifting all values change variance?

No.

Does a low variance prove good quality?

No; measurements can be consistently wrong.

Why can two programs disagree?

They may use different denominators, weights, missing-value rules, or axes.

Check your understanding

If every measurement is multiplied by 10, what happens to variance?

Answer: It is multiplied by 100.

Why is the example's denominator-n variance smaller?

Answer: It divides the same sum of squared deviations by four instead of three.

Is s²/n the spread of individual observations?

Answer: No; under the stated model it estimates the variance of the sample mean.

Related terms

  • Population variance
  • Standard deviation
  • Degrees of freedom
  • Covariance
  • Standard error
  • Bessel correction
  • robust scale

Learn next

Calculate the same dataset's variance using both denominators and confirm software settings. Then compare variance with a resistant spread measure after introducing one clearly labeled illustrative extreme value.

More in Statistics and probability

  • Sample space - A sample space is the set of all possible outcomes represented by a probability model for an experiment or random process. It is commonly denoted S or Omega.
  • Sample statistics - Sample statistics are quantities calculated from observed sample data, such as a mean, median, proportion, variance, or correlation.
  • Sample unique - A sample unique is a record whose combination of specified key-variable values occurs only once within a dataset.
  • Sample weighting - Sample weighting assigns different numerical contributions to observations when calculating estimates, fitting models, or evaluating performance.
  • Sampling design - Sampling design is the set of rules specifying how units are selected from a population or sampling frame.
  • Sampling distribution - A sampling distribution is the probability distribution of a statistic across the samples that could arise from a specified population and sampling process.

Sources

NIST/SEMATECH e-Handbook, Measures of Scale: https://www.itl.nist.gov/div898/handbook/eda/section3/eda356.htm NumPy, numpy.var: https://numpy.org/doc/stable/reference/generated/numpy.var.html The variance and scaling calculations and case are original fictional illustrations.

Previous: Sample unique Next: Sample weighting

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer