Variance is a statistical measure that represents the dispersion or spread of a set of data points. In simpler terms, it quantifies how far each data point in the set is from the mean (average) and is calculated as the average of the squared differences from the mean. A low variance indicates that the data points tend to be close to the mean and to each other, while a high variance indicates that the data points are spread out over a wider range.
The formula to calculate the variance (σ2σ2) for a population of NN data points x1,x2,…,xNx1,x2,…,xN with mean μμ is:
σ2 = ∑Ni=1 (xi − μ)2 / N
For a sample of nn data points, the formula for sample variance (s2s2) is slightly different:
s2 = ∑ni=1 (xi − xˉ)2 / n − 1
Note that in the sample variance formula, we divide by n−1n−1 instead of nn. This is known as Bessel’s correction and it corrects the bias in the estimation of the population variance from a sample.
Example of Variance
Let’s consider an example using exam scores to demonstrate how to calculate variance.
Imagine a class of 5 students who received the following scores on a math exam:
Step 1: Calculate the Mean (Average)
To calculate the mean, sum up all the scores and divide by the number of students:
Mean (xˉ)= 70 + 80 + 85 + 90 + 100 / 5 = 425 / 5 = 85
Step 2: Calculate the Squared Differences from the Mean
Next, find the squared difference of each score from the mean:
- (70 − 85)2 = (−15)2 = 225
- (80 − 85)2 = (−5)2 = 25
- (85 − 85)2 = 02 = 0
- (90 − 85)2 = 52 = 25
- (100 − 85)2 = 152 = 225
Step 3: Calculate the Variance
Finally, sum up these squared differences and divide by n−1n−1, where nn is the number of data points (in this case, n=5n=5):
Sample Variance(s2) = 225 + 25 + 0 + 25 + 225 / 5 − 1 = 500 / 4 = 125
So, the variance of the exam scores for these 5 students is 125.
A variance of 125 means that the scores are dispersed around the mean to that degree. In this example, the higher variance suggests that there is a larger spread among the students’ exam scores. This could be indicative of different levels of preparation or understanding of the material among the students.
This example should give you a good understanding of how to calculate and interpret variance.