DATA SCIENCE · CYCLE 2 · L19 · TEXTBOOK CHAPTER
How Far From Average
An average alone can hide what matters. Two cities, two players or two hands can share a mean and behave nothing alike. The standard deviation says how far a typical value sits from that mean.
After this chapter, you can
- Say why a center alone can hide what matters.
- Find a standard deviation by hand, dividing by n − 1.
- Check it with
=STDEV in Sheets.
- Say which group is more consistent, in one sentence with both SDs.
For your project: the SD of your number goes on ANALYSIS. The checkpoint is at the end.
Why It Matters
Nearly the same average temperature, and very different weather.
San Francisco and Washington, DC, have nearly the same average temperature: 57.9°F and 59.3°F, over 30 years of daily weather. Pack for the average and you would pack the same bag for both.
You would be wrong. Washington’s July highs average 89°F; San Francisco’s average 67°F. In January Washington freezes and San Francisco does not. The two centers are within 2 degrees. The spreads are not close.
| San Francisco | Washington |
| Average temperature | 57.9°F | 59.3°F |
| Average July high | 67°F | 89°F |
| SD of the daily highs | 7.5°F | 17.8°F |
Washington’s SD is more than twice San Francisco’s. That one number tells you to pack a coat and shorts for Washington, and a sweater for San Francisco.
The Idea
The standard deviation
The standard deviation (SD) is about how far a typical value sits from the mean. A small SD means the values are consistent: close together. A big SD means they are spread out.
| Step | Do this |
| 1 | Find the mean. |
| 2 | Take the mean away from each value. Each answer is a deviation. |
| 3 | Square each deviation, so none is negative. |
| 4 | Add the squares. |
| 5 | Divide by n − 1, one less than how many values. |
| 6 | Take the square root. |
Why square in step 3? The deviations above the mean and below it always add to 0, so adding them tells you nothing. Squaring makes every one count. It also makes a value far from the mean count most, which you will see in Example 1.
Worked Examples
Example 1 · The SD by hand. A bus ran late five mornings: 1, 3, 3, 4 and 9 minutes. Find the SD.
Create a strategySix steps, in a table with three columns: the value, the value minus the mean, and that answer squared.
Apply the idea
Mean: 1 + 3 + 3 + 4 + 9 = 20, and 20 ÷ 5 = 4.
| Value | Minus the mean, 4 | Squared |
| 1 | −3 | 9 |
| 3 | −1 | 1 |
| 3 | −1 | 1 |
| 4 | 0 | 0 |
| 9 | 5 | 25 |
| Add | 36 |
Divide by n − 1 = 4: 36 ÷ 4 = 9.
Square root: √9 = 3. SD = 3 minutes. A typical morning sits about 3 minutes from the mean of 4.
Reflect and checkThe 9 gave 25 of the 36. One late morning, far from the mean, counts more than the other four together. Check it in Sheets: type the five values in A1 to A5, then =STDEV(A1:A5). It shows 3.
Try It: Change the Values
The lab starts on Example 1. Change a value and watch every step of the table follow. Then meet the three goals.
Example 2 · Which is more consistent? Two players’ points over six games. Player A: 12, 14, 13, 15, 12, 12. Player B: 4, 22, 9, 20, 6, 17. Use Sheets, then say which player is more consistent.
Create a strategyA mean for each player, and an SD for each. The smaller SD is the more consistent player. Then one sentence with both SDs and their unit.
Apply the idea
Player A’s points in B2 to B7, Player B’s in C2 to C7, with a header in row 1.
| Cell | Type | It shows |
| E2 | =AVERAGE(B2:B7) | 13 |
| F2 | =STDEV(B2:B7) | 1.26 |
| E3 | =AVERAGE(C2:C7) | 13 |
| F3 | =STDEV(C2:C7) | 7.64 |
The sentence: “Player A is more consistent: A’s SD is 1.26 points, against 7.64 points for Player B.”
Reflect and checkBoth means are 13, so the mean alone says the two players are alike. The SDs say they are not. A coach who needs about 13 points every game picks Player A.
The Same in Python
Python comes in L19b, the next chapter. Once you have read it, come back and run Example 1’s five mornings here.
In Sheets this is: =AVERAGE(A1:A5) and =STDEV(A1:A5).
In English:
- Get the pandas toolbox and call it pd.
- Make a column of the five numbers, and call it late.
- Print the mean of late.
- Print the standard deviation of late, dividing by n − 1.
Predict: Example 1 found both by hand. What will lines 3 and 4 print? Then change one value in the list, say which way the SD will move, and run it again.
Can’t run it here? Show what it prints
4.0
3.0
pandas writes a whole mean or SD as a decimal: 4.0 and 3.0 are the 4 and the 3 from Example 1.
Want to type your own? The Python practice page has tasks and a notebook.
In your project
Your Cycle 2 project’s ANALYSIS tab reports a mean, a median and an SD, and compares two groups. Write the comparison the way Example 2 does: which group is more consistent, with both SDs and their unit. That sentence is the start of your one-page memo’s claim.
Check Yourself
Answer each one before you look. The first two are from L17 and L18.
Minutes five students spent on homework last night: 28, 31, 34, 37 and 130. Which center describes a typical student? L17
The 130 is an outlier. It pulls the mean up to 52, more than any of the other four students spent. The median, 34, sits among the typical times.
Q1 is 22 and Q3 is 35. What is the IQR? L18
IQR = Q3 − Q1 = 35 − 22 = 13. The middle half of the values lie between 22 and 35.
List P: 48, 49, 50, 51, 52. List Q: 30, 40, 50, 60, 70. Both means are 50. Without working it out, which list has the bigger SD?
List Q’s values sit 10 or 20 from 50; List P’s sit 1 or 2 from it. Farther from the mean, bigger SD. (List P’s SD is 1.58; List Q’s is 15.81.)
Find the SD of 1, 3, 5, 7, 14 by hand.
- Mean: 1 + 3 + 5 + 7 + 14 = 30, and 30 ÷ 5 = 6.
- Minus the mean: −5, −3, −1, 1, 8.
- Squared: 25, 9, 1, 1, 64.
- Add: 100.
- Divide by n − 1 = 4: 100 ÷ 4 = 25.
- Square root: √25 = 5. The SD is 5.
A column holds 8 values. In step 5, what does =STDEV divide the added squares by?
n − 1 = 8 − 1 = 7. Sheets divides by one less than how many values, the same as you do by hand.
Which change makes the SD of 1, 3, 3, 4, 9 bigger?
Moving the 9 to 15 puts it farther from the mean, and squaring makes that distance count most. The SD goes from 3 to 5.59. Moving it to 5 brings it closer: 1.48. Changing the 3s to 4s brings them closer too: 2.88.
Strong hand: SD 2.1 cm. Other hand: SD 4.8 cm. Which sentence belongs on the ANALYSIS tab?
The smaller SD is the more consistent group: the strong hand, 2.1 cm. The sentence names the group, says “more consistent”, and gives both SDs with their unit.
Project Checkpoint
Stuck on any of this? Ask Mr. Case in class or send him a message in Canvas. Name the example or the question number, and say which step lost you.