Standard deviation is a measure of the dispersion of data in a given sample. To calculate it, whether for a data series or for a sample from that series, you have to do some preliminary calculations. So, you will need the sample mean and variance first. You can then calculate the standard deviation. Variance, on the other hand, is a measure of the dispersion of the data relative to the sample mean. On the calculation side, the standard deviation is obtained by taking the square root of the variance of your sample. In this article, we will see how we calculate the mean, the variance and finally, the standard deviation.
Part 1 of 3: find the mean
Step 1. Observe your sample closely
This is an essential step in statistics, even if you only have to calculate simple values like an average or a median.
- Count the number of items in your series.
- Are your values very dispersed or are they, on the contrary, very narrow, with only a few units, or even a few decimal places, between them?
- Know the nature of the data you are going to manipulate. What do the values in your sample represent? Are they school grades, heights, heart rates, weights?
- Take as an example the following series of school grades: 10, 8, 10, 8, 8 and 4.
Step 2. Gather all of your data
The value of each element in the sample is needed to calculate the average.
- The average expresses how large each item in your sample would be if they were all the same.
- It is calculated by adding all the values in the sample, then dividing this result by the size () of the same sample.
- We have 6 notes in our sample (10, 8, 10, 8, 8, 4), therefore, n = 6.
Step 3. Add up all the values in your sample
This is the first step before calculating the arithmetic mean.
- Let's take our sample again. We started from the following series of notes: 10, 8, 10, 8, 8 and 4.
- 10 + 8 + 10 + 8 + 8 + 4 = 48. This number is the sum of all the scores in the sample.
- Check that you have added the correct numbers and done the correct calculations.
Step 4. Divide this sum by the sample size (n)
This will give you the average score for your sample.
- In our sample of scores (10, 8, 10, 8, 8 and 4), there are 6 elements, so n = 6.
- The sum of all the scores is 48, it was calculated previously. So you have to divide 48 by to find the mean.
- 48 / 6 = 8
- The average score in the sample is 8.
Part 2 of 3: find the variance of your sample
Step 1. Find the variance
The variance is the measure of the dispersion of the data relative to the sample mean.
- This measure gives an idea of the dispersion of the notes.
- A sample with a small variance contains data very close to the sample mean.
- A sample with a large variance contains data that is quite far from the sample mean.
- This variance is often used to compare two sets of data or two samples with each other.
Step 2. Subtract the mean from each data studied
This will give you an idea of the dispersion of your data compared to the average.
- The average of our sample of scores (10, 8, 10, 8, 8 and 4) is 8.
We therefore make the following calculations:
10 - 8 = 2; 8 - 8 = 0; 10 - 8 = 2; 8 - 8 = 0; 8 - 8 = 0 and 4 - 8 = -4.
- Check these calculations to see if there are any errors. Indeed, these results will depend on the following calculations.
Step 3. Squared all of these results
You will need each of these values to calculate the variance of your sample.
- Previously, we subtracted from each data in the sample (10, 8, 10, 8, 8 and 4) the mean (8), which gave us: 2, 0, 2, 0, 0 and -4.
- Now, to calculate the variance, you need to squared these values: 22, 02, 22, 02, 02 and (-4)2 = 4, 0, 4, 0, 0 and 16.
- Before going any further, check your calculations to see if there are any errors.
Step 4. Add it up
This is called “the sum of squares”.
- For our scores, the squares are: 4, 0, 4, 0, 0 and 16.
- Remember: we subtracted the average from each note, then we squared the result. The sum of the squares looks like this: (10 - 8)2+ (8 - 8)2+ (10 - 2)2+ (8 - 8)2+ (8 - 8)2+ (4 - 8)2
- 4 + 0 + 4 + 0 + 0 + 16 = 24
- The sum of the squares is 24.
Step 5. Divide the sum of squares by (n - 1)
Remember: n is the size of the sample (number of elements that compose it). By doing this calculation, you get the variance.
In our sample of notes (10, 8, 10, 8, 8 and 4), there are 6 elements.
Thus, n = 6.
- n - 1 = 6 - 1 = 5
- The sum of the squares was 24.
- 24 / 5 = 4, 8
- The variance of our sample is therefore 4.8.
Part 3 of 3: calculate the standard deviation
Step 1. You must have the variance value
It is needed to calculate the standard deviation of the sample you are studying.
- Remember: variance measures how dispersed the data is from the mean.
- The standard deviation is quite similar, since it is a measure of the dispersion of data in a given sample.
- For our sample of scores, the variance was 4.8.
Step 2. Take the square root of the variance
This calculation gives you the standard deviation.
- Normally, at least 68% of the sample values are within one standard deviation of the mean.
- Remember: in our sample of scores, the variance was 4.8.
- √4, 8 = 2, 19. The standard deviation of our sample of scores is therefore 2, 19.
- 5 of the 6 scores (or 83%) in our sample (10, 8, 10, 8, 8 and 4) are within one standard deviation (2, 19) of the mean (8).
Step 3. Repeat your calculations for the mean, the variance, and then the standard deviation (which depends on the first two)
This will ensure that you have the correct standard deviation.
- Write all the calculations in black and white, whether you do them by hand or with a calculator.
- If you find different values while checking the mean, variance, and standard deviation, start all your calculations from the beginning.
- If you cannot find the source of the error, you must start from the beginning a third time.