Skip to main content
返回指南
4 min read

How to Calculate Variance: Step-by-Step Guide

Learn to calculate statistical variance manually with our step-by-step guide. Includes formulas for population and sample variance, a worked example, and common pitfalls.

跳过数学——使用计算器

How to Calculate Variance: A Step-by-Step Guide

Understanding variance is fundamental in statistics, offering a measure of how far a set of numbers are spread out from their average value. A high variance indicates that data points are widely spread from the mean, while a low variance suggests that data points are clustered closely around the mean. This guide will walk you through the manual calculation of variance, ensuring a thorough understanding of its underlying principles.

Understanding the Formulas

There are two primary formulas for variance, depending on whether you are calculating the variance for an entire population or for a sample of that population.

Population Variance (σ²)

When you have data for every member of a group (the entire population), you use the population variance formula:

σ² = Σ(xᵢ - μ)² / N

Where:

  • σ² (sigma squared) is the population variance.
  • xᵢ represents each individual data point.
  • μ (mu) is the population mean.
  • Σ (sigma) denotes the sum of.
  • N is the total number of data points in the population.

Sample Variance (s²)

When you are working with a subset of a population (a sample), you use the sample variance formula. The key difference is the denominator, N-1, which provides an unbiased estimate of the population variance.

s² = Σ(xᵢ - x̄)² / (n - 1)

Where:

  • is the sample variance.
  • xᵢ represents each individual data point.
  • (x-bar) is the sample mean.
  • Σ denotes the sum of.
  • n is the total number of data points in the sample.

Prerequisites

Before you begin calculating variance, you should be familiar with:

  • Calculating the Mean (Average): Summing all data points and dividing by the count.
  • Basic Algebra: Performing subtraction, squaring numbers, and division.

Step-by-Step Manual Calculation

Let's walk through the process of calculating variance by hand. We will use a sample dataset for our example to illustrate the n-1 denominator.

Worked Example: Sample Dataset

Consider the following sample dataset representing the daily sales of a small business over 8 days: [2, 4, 4, 4, 5, 5, 7, 9]

Step 1: Calculate the Mean (Average)

The first step is to find the arithmetic mean of your dataset. Sum all the data points and divide by the number of data points.

x̄ = (2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) / 8 x̄ = 40 / 8 x̄ = 5

The mean of our sample dataset is 5.

Step 2: Determine Each Data Point's Deviation from the Mean

Next, subtract the mean from each individual data point (xᵢ - x̄). This shows how much each value deviates from the average.

  • 2 - 5 = -3
  • 4 - 5 = -1
  • 4 - 5 = -1
  • 4 - 5 = -1
  • 5 - 5 = 0
  • 5 - 5 = 0
  • 7 - 5 = 2
  • 9 - 5 = 4

Step 3: Square Each Deviation

Square each of the deviations calculated in Step 2. This step is crucial because it makes all values positive and emphasizes larger deviations, as squaring amplifies bigger differences.

  • (-3)² = 9
  • (-1)² = 1
  • (-1)² = 1
  • (-1)² = 1
  • (0)² = 0
  • (0)² = 0
  • (2)² = 4
  • (4)² = 16

Step 4: Sum the Squared Deviations

Add up all the squared deviations from Step 3. This sum is often referred to as the "Sum of Squares."

Sum of Squares = 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32

Step 5: Divide by the Appropriate Number

Finally

准备好计算了吗?

跳过手动工作并立即获得结果。

打开计算器

设置

隐私条款关于© 2026 PrimeCalcPro