Variance is a statistics topic used to relate the individual numbers from a set of data to each other. Usually, variance is used to measure the variability of the data. The variance can be calculated by taking the square of the standard deviation.
Variance is very essential in hypothesis testing and checking the goodness of fit. In this post, we will learn about the definition and formulas of variance with a lot of examples.
What is a variance?
Variance is a statistical measurement frequently used to calculate the spread among the numbers in a data set with respect to the mean. In simple words, variance is used to measure how far each number is in a given set of data from the mean.
There are two kinds of variances in statistics, one is sample variance and the other is population variance. Population data is the whole set of data while sample data is something from the whole to provide the average of the given data.
Population variance is the squared distance from the population mean, while the sample variance is the average of the squared distance from the mean. The expected value of the square of differences from the mean either population mean or sample is known as a variance.
Formulas of the variance
To calculate the population variance and sample variance following formulas are used.
1. Population Variance
In the above equation, x is the data values of the population data, µ is the mean of the population, N is the total number of data values, and σ2 is the variance of population data.
2. Sample Variance
In the above formula of sample variance, x is the given values of the sample data, x¯ is the mean of sample data, n is the total number of observations, and s2 is the variance of sample data.
How to calculate the variance?
By using the formulas of sample variance and population variance, you can easily solve the problems of variance. Let us take a few examples to understand how to calculate the variance.
Example 1: For population variance
Calculate the variance of the given population data values, 8, 20, 42, 4, 2, 26, 30, and 12?
Solution
Step 1: Write the given set of data.
8, 20, 42, 4, 2, 26, 30, 12
Step 2: Now determine the population mean “µ” of the given set of data.
Sum of population data = 8 + 20 + 42 + 4 + 2 + 26 + 30 + 12
Sum of population data = 144
Total number of data values = N = 8
Population mean = µ = Sum of population data / Total number of data values
Population mean = µ = 144/8 = 18
Step 3: Now find the sum of squares of the population data.
Population data (x) | x – µ | (x – µ)2 |
8 | 8 – 18 = -10 | (-10)2 = 100 |
20 | 20 – 18 = 2 | (2)2 = 4 |
42 | 42 – 18 = 24 | (24)2 = 576 |
4 | 4 – 18 = -14 | (-14)2 = 196 |
2 | 2 – 18 = -16 | (-16)2 = 256 |
26 | 26 – 18 = 8 | (8)2 = 64 |
30 | 30 – 18 = 12 | (12)2 = 144 |
12 | 12 – 18 = -6 | (-6)2 = 36 |
Σ x = 144 | Σ (x– µ)2 = 1376 |
Step 4: Now take the general formula of the population variance.
Step 5: Put the calculated sum of square and number of data values in the above formula.
Population variance = σ2 = 1376/8
Population variance = σ2 = 172
To avoid such a larger calculation, you can use a variance calculator. Below is the screenshot where you can see that it is one click task for the mentioned calculator.
Example 2: For sample variance
Calculate the variance of the given sample data, 13, 3, 16, 22, 6, 1, 24, and 19?
Solution
Step 1: Write the given set of data.
13, 3, 16, 22, 6, 1, 24, 19
Step 2: Now determine the sample mean of the given set of data.
Sum of sample data = 13 + 3 + 16 + 22 + 6 + 1 + 24 + 19
Sum of sample data = 104
Total number of data values = n = 8
Sample mean = Sum / Total number
Sample mean = 104/8 = 13
Step 3: Now calculate the differences of sample observations from the mean.
Sample data (x) | x – x¯ | (x – x¯)2 |
13 | 13 – 13 = 0 | (0)2 = 0 |
3 | 3 – 13 = -10 | (-10)2 = 100 |
16 | 16 – 13 = 3 | (3)2 = 9 |
22 | 22 – 13 = 9 | (9)2 = 81 |
6 | 6 – 13 = -7 | (-7)2 = 49 |
1 | 1 – 13 = -12 | (-12)2 = 144 |
24 | 24 – 13 = 11 | (11)2 = 121 |
19 | 19 – 13 = 6 | (6)2 = 36 |
Σ x = 104 | Σ (x – x¯)2 = 540 |
Step 4: Now take the general formula of sample variance.
Step 5: Put the calculated sum of square and number of data values in the above formula.
s2 = 540/8 – 1
s2 = 540/7
Sample variance = s2 = 77.1429
Example 3
Calculate the variance of the given sample data, 12, 31, 106, 23, 36, and 32?
Solution
Step 1: Write the given set of data.
12, 31, 106, 23, 36, 32
Step 2: Now determine the sample mean of the given set of data.
Sum of sample data = 12 + 31 + 106 + 23 + 36 + 32
Sum of sample data = 240
Total number of data values = n = 6
Sample mean = Sum of sample data / Total number of data values
Sample mean = 240/6 = 40
Step 3: Now calculate the differences of sample observations form the mean.
Sample data (x) | x – x¯ | (x – x¯)2 |
12 | 12 – 40 = -28 | (-28)2 = 784 |
31 | 31 – 40 = -9 | (-9)2 = 81 |
106 | 106 – 40 = 66 | (66)2 = 4356 |
23 | 23 – 40 = -17 | (-17)2 = 289 |
36 | 36 – 40 = -4 | (-4)2 = 16 |
32 | 32 – 40 = -8 | (-8)2 = 64 |
Σ x = 240 | Σ (x – x¯)2 = 5590 |
Step 4: Now take the general formula of sample variance.
Step 5: Put the calculated sum of square and number of data values in the above formula.
s2 = 5590/6 – 1
s2 = 5590/5
sample variance = s2 = 1118
Conclusion
In this post, we have learned about the definition and formulas of variance. Now, you can grab all the basics of variance by learning this topic. You can solve any problem related to variance by following the examples and formulas of this post.