Variance Formula (For Grouped and Ungrouped Data) - Examples (2024)

In probability theory and statistics, the variance formula measures how far a set of numbers are spread out. It is a numerical value and is used to indicate how widely individuals in a group vary. If individual observations vary considerably from the group mean, the variance is big and vice versa.

A variance of zero indicates that all the values are identical. It should be noted that variance is always non-negative- a small variance indicates that the data points tend to be very close to the mean and hence to each other while a high variance indicates that the data points are very spread out around the mean and from each other.

Variance Formulas

Variance can be of either grouped or ungrouped data. To recall, a variance can of two types which are:

  • Variance of a population
  • Variance of a sample

The variance of a population is denoted by σ2 and the variance of a sample by s2.

Variance Formulas for Ungrouped Data

Population varianceSample variance

\(\begin{array}{l}\sigma^2=\frac{1}{N}\sum_{i=1}^{N}(x_i-\mu)^2\end{array} \)

Here,

σ2 = Variance

xi = ith observation of given data

μ = Population mean

N = Total number of observations (Population size)

\(\begin{array}{l}s^2=\frac{1}{n-1}\sum_{i=1}^{n}(x_i-\overline{x})^2\end{array} \)

Here,

s2 = Sample variance

xi = ith observation of given data

x̄ = Sample mean

n = Sample size (or Number of data values in sample)

Variance Formulas for Grouped Data

Formula for Population Variance

The variance of a population for grouped data is:

  • σ2 = ∑ f (m − x̅)2 / n

Formula for Sample Variance

The variance of a sample for grouped data is:

  • s2 = ∑ f (m − x̅)2 / n − 1

Where,

f = frequency of the class

m = midpoint of the class

These two formulas can also be written as:

Population varianceSample variance

\(\begin{array}{l}\sigma^2=\frac{1}{N}[\sum_{i=1}^{N}f_ix_i^2 – (\frac{\sum_{i=1}^{N}f_ix_i}{N})^2]\end{array} \)

Here,

σ2 = Variance

xi = Midvalue of ith class

fi = Frequency of ith class

N = Total number of observations (Population size)

\(\begin{array}{l}s^2=\frac{1}{n-1}[\sum_{i=1}^{n}f_ix_i^2 – (\frac{\sum_{i=1}^{n}f_ix_i}{n})^2]\end{array} \)

Here,

s2 = Sample variance

xi = Midvalue of ith class

fi = Frequency of ith class

n = Sample size (or Number of data values in sample)

Try: Variance Calculator

Summary:

Variance TypeFor Ungrouped DataFor Grouped Data
Population Variance Formulaσ2 = ∑ (x − x̅)2 / nσ2 = ∑ f (m − x̅)2 / n
Sample Variance Formulas2 = ∑ (x − x̅)2 / n − 1s2 = ∑ f (m − x̅)2 / n − 1

Also Check: Standard Deviation Formula

Variance Formula Example Question

Question: Find the variance for the following set of data representing trees heights in feet: 3, 21, 98, 203, 17, 9

Solution:

Step 1: Add up the numbers in your given data set.

3 + 21 + 98 + 203 + 17 + 9 = 351

Step 2: Square your answer:

351 × 351 = 123201

…and divide by the number of items. We have 6 items in our example so:

123201/6 = 20533.5

Step 3: Take your set of original numbers from Step 1, and square them individually this time:

3 × 3 + 21 × 21 + 98 × 98 + 203 × 203 + 17 × 17 + 9 × 9

Add the squares together:

9 + 441 + 9604 + 41209 + 289 + 81 = 51,633

Step 4: Subtract the amount in Step 2 from the amount in Step 3.

51633 – 20533.5 = 31,099.5

Set this number aside for a moment.

Step 5: Subtract 1 from the number of items in your data set. For our example:

6 – 1 = 5

Step 6: Divide the number in Step 4 by the number in Step 5. This gives you the variance:

31099.5/5 = 6219.9

Step 7: Take the square root of your answer from Step 6. This gives you the standard deviation:

√6219.9 = 78.86634

The answer is 78.86.

Question 2:

Calculate the variance for the following data:

Class intervalsFrequency
200 – 20113
201 – 20227
202 – 20318
203 – 20410
204 – 2051
205 – 2061

Solution:

CIfixifixifixi2
200 – 20113200.52606.5522603.25
201 – 20227201.55440.51096260.75
202 – 20318202.53645738112.5
203 – 20410203.52035414122.5
204 – 2051204.5204.541820.25
205 – 2061205.5205.542230.25
∑fi = 70∑fixi = 14137fixi2= 2855149.5

\(\begin{array}{l}s^2=\frac{1}{n-1}[\sum_{i=1}^{n}f_ix_i^2 – (\frac{\sum_{i=1}^{n}f_ix_i}{n})^2]\end{array} \)

= [1/(70 – 1)] [2855149.5 – (1/70)(14137)2]

= 1.179

More topics in Variance
Covariance FormulaCoefficient of Variation Formula
Variance Formula (For Grouped and Ungrouped Data) - Examples (2024)
Top Articles
Latest Posts
Article information

Author: Terrell Hackett

Last Updated:

Views: 6401

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Terrell Hackett

Birthday: 1992-03-17

Address: Suite 453 459 Gibson Squares, East Adriane, AK 71925-5692

Phone: +21811810803470

Job: Chief Representative

Hobby: Board games, Rock climbing, Ghost hunting, Origami, Kabaddi, Mushroom hunting, Gaming

Introduction: My name is Terrell Hackett, I am a gleaming, brainy, courageous, helpful, healthy, cooperative, graceful person who loves writing and wants to share my knowledge and understanding with you.