How to Calculate Variance | Calculator, Analysis & Examples

The variance is a measure of variability. It is calculated by taking the average of squared deviations from the mean.

Variance tells you the degree of spread in your data set. The more spread the data, the larger the variance is in relation to the mean.

Variance vs. standard deviation

The standard deviation is derived from variance and tells you, on average, how far each value lies from the mean. It’s the square root of variance.

Both measures reflect variability in a distribution, but their units differ:

  • Standard deviation is expressed in the same units as the original values (e.g., meters).
  • Variance is expressed in much larger units (e.g., meters squared)

Since the units of variance are much larger than those of a typical value of a data set, it’s harder to interpret the variance number intuitively. That’s why standard deviation is often preferred as a main measure of variability.

However, the variance is more informative about variability than the standard deviation, and it’s used in making statistical inferences.

Prevent plagiarism. Run a free check.

Try for free

Population vs. sample variance

Different formulas are used for calculating variance depending on whether you have data from a whole population or a sample.

Population variance

When you have collected data from every member of the population that you’re interested in, you can get an exact value for population variance.

The population variance formula looks like this:

Formula Explanation
\sigma^2 = \dfrac{\sum (X - \mu)^2}{N}
  • \sigma^2 = population variance
  • \sum = sum of…
  • Χ = each value
  • \mu = population mean
  • Ν = number of values in the population

Sample variance

When you collect data from a sample, the sample variance is used to make estimates or inferences about the population variance.

The sample variance formula looks like this:

Formula Explanation
s^2= \dfrac{\sum (X - \bar{x})^2}{n - 1}
  • s^2 = sample variance
  • \sum = sum of…
  • Χ = each value
  • \bar{x} = sample mean
  • n = number of values in the sample

With samples, we use n – 1 in the formula because using n would give us a biased estimate that consistently underestimates variability. The sample variance would tend to be lower than the real variance of the population.

Reducing the sample n to n – 1 makes the variance artificially large, giving you an unbiased estimate of variability: it is better to overestimate rather than underestimate variability in samples.

It’s important to note that doing the same thing with the standard deviation formulas doesn’t lead to completely unbiased estimates. Since a square root isn’t a linear operation, like addition or subtraction, the unbiasedness of the sample variance formula doesn’t carry over the sample standard deviation formula.

Variance calculator

You can calculate the variance by hand or with the help of our variance calculator below.

Steps for calculating the variance by hand

The variance is usually calculated automatically by whichever software you use for your statistical analysis. But you can also calculate it by hand to better understand how the formula works.

There are five main steps for finding the variance by hand. We’ll use a small data set of 6 scores to walk through the steps.

Data set
46 69 32 60 52 41

Step 1: Find the mean

To find the mean, add up all the scores, then divide them by the number of scores.

Mean (\bar{x})
\bar{x} = (46 + 69 + 32 + 60 + 52 + 41) \div 6 = 50

Step 2: Find each score’s deviation from the mean

Subtract the mean from each score to get the deviations from the mean.

Since = 50, take away 50 from each score.

Score Deviation from the mean
46 46 – 50 = -4
69 69 – 50 = 19
32 32 – 50 = -18
60 60 – 50 = 10
52 52 – 50 = 2
41 41 – 50 = -9

Step 3: Square each deviation from the mean

Multiply each deviation from the mean by itself. This will result in positive numbers.

Squared deviations from the mean
(-4)2 = 4 × 4 = 16
192 = 19 × 19 = 361
(-18)2 = -18 × -18 = 324
102 = 10 × 10 = 100
22 = 2 × 2 = 4
(-9)2 = -9 × -9 = 81

Step 4: Find the sum of squares

Add up all of the squared deviations. This is called the sum of squares.

Sum of squares
16 + 361 + 324 + 100 + 4 + 81 = 886

Step 5: Divide the sum of squares by n – 1 or N

Divide the sum of the squares by n – 1 (for a sample) or N (for a population).

Since we’re working with a sample, we’ll use  n – 1, where n = 6.

Variance
 886 \div (6 – 1) = 886 \div 5 = 177.2

The only proofreading tool specialized in correcting academic writing - try for free!

The academic proofreading tool has been trained on 1000s of academic texts and by native English editors. Making it the most accurate and reliable proofreading tool for students.

Try for free

Why does variance matter?

Variance matters for two main reasons:

  • Parametric statistical tests are sensitive to variance.
  • Comparing the variance of samples helps you assess group differences.

Homogeneity of variance in statistical tests

Variance is important to consider before performing parametric tests. These tests require equal or similar variances, also called homogeneity of variance or homoscedasticity, when comparing different samples.

Uneven variances between samples result in biased and skewed test results. If you have uneven variances across samples, non-parametric tests are more appropriate.

Using variance to assess group differences

Statistical tests like variance tests or the analysis of variance (ANOVA) use sample variance to assess group differences. They use the variances of the samples to assess whether the populations they come from differ from each other.

Research example
As an education researcher, you want to test the hypothesis that different frequencies of quizzes lead to different final scores of college students. You collect the final scores from three groups with 20 students each that had quizzes frequently, infrequently, or rarely over a semester.

  • Sample A: Once a week
  • Sample B: Once every 3 weeks
  • Sample C: Once every 6 weeks

To assess group differences, you perform an ANOVA.

The main idea behind an ANOVA is to compare the variances between groups and variances within groups to see whether the results are best explained by the group differences or by individual differences.

If there’s higher between-group variance relative to within-group variance, then the groups are likely to be different as a result of your treatment. If not, then the results may come from individual differences of sample members instead.

Research example
Your ANOVA assesses whether the differences in mean final scores between groups come from the differences in the frequency of quizzes or the individual differences of the students in each group.

To do so, you get a ratio of the between-group variance of final scores and the within-group variance of final scores – this is the F-statistic. With a large F-statistic, you find the corresponding p-value, and conclude that the groups are significantly different from each other.

Other interesting articles

If you want to know more about statistics, methodology, or research bias, make sure to check out some of our other articles with explanations and examples.

Frequently asked questions

What are the 4 main measures of variability?

Variability is most commonly measured with the following descriptive statistics:

What’s the difference between standard deviation and variance?

Variance is the average squared deviations from the mean, while standard deviation is the square root of this number. Both measures reflect variability in a distribution, but their units differ:

  • Standard deviation is expressed in the same units as the original values (e.g., minutes or meters).
  • Variance is expressed in much larger units (e.g., meters squared).

Although the units of variance are harder to intuitively understand, variance is important in statistical tests.

What is variance used for in statistics?

Statistical tests such as variance tests or the analysis of variance (ANOVA) use sample variance to assess group differences of populations. They use the variances of the samples to assess whether the populations they come from significantly differ from each other.

Cite this Scribbr article

If you want to cite this source, you can copy and paste the citation or click the “Cite this Scribbr article” button to automatically add the citation to our free Citation Generator.

Bhandari, P. (2023, June 21). How to Calculate Variance | Calculator, Analysis & Examples. Scribbr. Retrieved January 8, 2024, from https://www.scribbr.com/statistics/variance/

Is this article helpful?
Pritha Bhandari

Pritha has an academic background in English, psychology and cognitive neuroscience. As an interdisciplinary researcher, she enjoys writing articles explaining tricky research concepts for students and academics.