DATA SCIENCE · CYCLE 2 · L21 · TEXTBOOK CHAPTER
The Bell
Heights, test scores and coin counts pile up the same way: most near the middle, fewer and fewer out at the edges. Know that pile’s mean and SD, and you can say where almost every value falls.
After this chapter, you can
- Find the mean and SD that theory gives for coin flips.
- Use 68, 95 and 99.7 to say where values fall.
- Turn a value into a z-score, and a z-score into a percent.
- Say what a percentile means.
- Count the percent within 1, 2 and 3 SD in Sheets.
For your project: a histogram of your number, and one sentence on its shape. The checkpoint is at the end.
Why It Matters
Balls bouncing left or right at each peg pile up as a bell.
In 2024, 1,973,891 students in the class of 2024 had an SAT score. The mean total score was 1024, and the SD was 229.
Say you scored 1250. Is that good? A college that sees it will look at your percentile: the percent of test takers who scored at or below you. A 1250 is about the 84th percentile. It beat about 84 of every 100 test takers.
That 84 is no grade out of 100. It is a place on a bell, and by the end of this chapter you can find it yourself.
The Idea
The normal curve
A normal curve is a bell: highest at the mean, the same on both sides. Its mean and SD tell you where the values fall.
| Within | Share of a normal curve |
| 1 SD of the mean | about 68% |
| 2 SD of the mean | about 95% |
| 3 SD of the mean | about 99.7% |
The 68, 95 and 99.7 rule: each band reaches 1, 2 or 3 SDs either side of the mean.
A z-score counts SDs from the mean:
z = value − meanSD
A positive z is above the mean, a negative z below it.
The rule also turns a z-score into a percentile. Half the values sit below the mean. Half of 68%, 34%, sit between the mean and 1 SD above it. So 1 SD above the mean, z = 1, is about the 84th percentile: 50 + 34. And 5% sit more than 2 SDs out, half of them on each side, so only 2.5% sit above z = 2.
| z-score | −2 | −1 | 0 | 1 | 2 |
| About this percent at or below | 2.5% | 16% | 50% | 84% | 97.5% |
Worked Examples
Example 1 · Find the percentile. SAT 2024: mean 1024, SD 229. You scored 1250. About what percentile is that?
Create a strategyTurn the score into a z-score, then read the percent from the rule.
Apply the idea
z = 1250 − 1024229 = 226229 = 0.99
That is about 1 SD above the mean. Half the scores sit below the mean, 50%, and half of 68%, 34%, sit between the mean and 1 SD above. 50 + 34 = 84. A 1250 is about the 84th percentile.
Below the mean: 50%. From the mean up to 1250: about 34%.
Reflect and checkThe 84th percentile means 84% scored at or below 1250. It says nothing about how many questions you got right. A percent is out of 100 points; a percentile is out of 100 people.
Example 2 · The theory for 10 coins. Flip 10 fair coins and count the heads. Before you flip: what mean and SD does the math say, and what share of counts fall from 4 to 6?
Create a strategyLike a theoretical chance, the theory’s mean and SD are worked out before you flip, from two short formulas. Then add the shares of the counts you want.
Apply the idea
Mean = flips × chance of heads = 10 × 0.5 = 5.
SD = the square root of flips × chance of heads × chance of tails:
SD = √10 × 0.5 × 0.5 = √2.5 = 1.58
Theory: the share of sets of 10 flips that give each count. From 4 to 6, darker: 65.6%.
From 4 to 6 heads: 65.6% of sets. From 2 to 8 heads: 97.9%.
Reflect and check1 SD either side of 5 runs from 3.42 to 6.58, so the counts within 1 SD are 4, 5 and 6: 65.6%, near the rule’s 68%. Within 2 SDs, from 1.84 to 8.16, are the counts 2 to 8: 97.9%, near 95%. Counts are whole numbers, so they can only come close to the rule.
Example 3 · How unusual? You flip 10 coins and get 8 heads. How unusual is that?
Create a strategyUse Example 2’s theory, mean 5 and SD 1.58, and find the z-score.
Apply the ideaz = 8 − 51.58 = 31.58 = 1.90
Almost 2 SDs above the mean: unusual, but it happens.
Reflect and checkAbout 95% of counts sit within 2 SDs, so a count near 2 SDs out turns up only a few times in 100 sets. It is no sign the coins are unfair.
Try It: Build the Bell
Each press flips 10 coins and counts the heads, 20 times or 200 times. The bars are your sets; the dark marks are the theory from Example 2. Press 20 a few times, then 200 a few times, and watch the bars find the marks. In class, your Sheet did this 1,000 times.
Real Data: Students’ Heights
The CDC’s Youth Risk Behavior Survey asked US high school students their height. 12,579 answered. Their mean was 1.69 m and their SD 0.105 m. A computer counted how many heights sit within 1, 2 and 3 SDs of the mean.
| Within | The heights | The rule |
| 1 SD of the mean | 64.1% | 68% |
| 2 SD of the mean | 97.5% | 95% |
| 3 SD of the mean | 99.6% | 99.7% |
Real data is rarely a perfect bell, but this one comes close. That is why the rule is worth knowing: from a mean and an SD alone, you can say where almost everyone falls.
Count It Yourself, in Python
The computer that counted those heights can be yours. These three cells are the ones Mr. Case ran on the board, and they run on this page, on the real file. Run them in order. One word is new: .dropna() drops the blanks.
1import pandas as pd
2df = pd.read_csv("L17-YRBSS.csv")
3h = df["height"].dropna()
4print(len(df), "rows")
5print(len(h), "heights")
In Sheets this is: File > Import the CSV, then =COUNTA for the rows and =COUNT(F:F) for the heights.
In English:
- Get the pandas toolbox and call it pd.
- Open the file as a table called df.
- Take the height column, drop its blanks, and call the result h.
- Print how many rows.
- Print how many heights.
Predict: some students left height blank. Will line 5 print more or fewer than line 4?
Can’t run it here? Show what it prints
13583 rows
12579 heights
1m = h.mean()
2s = h.std()
3print(round(m, 2), round(s, 3))
In Sheets this is: =AVERAGE(F:F) and =STDEV(F:F), on the height column.
In English:
- Call the mean of h m.
- Call the standard deviation of h s, dividing by n − 1.
- Print m to 2 places and s to 3 places.
Predict: a typical height in meters, and about how far a typical student sits from it.
Can’t run it here? Show what it prints
1.69 0.105
In Sheets this is: =COUNTIFS on the height column, from m − k × s up to m + k × s, divided by =COUNT.
In English:
- Call the number of SDs k.
- Keep the heights from m − k × s up to m + k × s, and call them inside.
- Print what percent of the heights are inside, to 1 place.
Predict: with k = 1, the rule says about 68%. Run it. Then change k = 1 to k = 2, say your guess, and run it. Then k = 3.
Can’t run it here? Show what it prints
64.1
With k = 2 it prints 97.5, and with k = 3, 99.6: the table above.
Want to type your own? The Python practice page has tasks and a notebook.
In Sheets: a z-score for Every Row
This is the COINS tab from class: column K holds the heads in each of 1,000 sets of 10 coins. Keep the mean and the SD in two cells. Then one formula reads them for every row.
- Click cell Q1. Type:
=10*0.5
- Click cell Q2. Type:
=SQRT(10*0.5*0.5)
- Click cell L1. Type:
=ARRAYFORMULA((K1:K1000-Q1)/Q2)
Q1 is the theory’s mean, 5, and Q2 its SD, 1.58. Column L now holds each set’s z-score: its heads minus the mean in Q1, divided by the SD in Q2. ARRAYFORMULA does the same sum for every row at once, so every row reads the same two cells.
Keep the mean and the SD in cells. A rounded number typed into the formula can put a value on the wrong side of a line.
In Sheets: the Percent Within 1 SD
This is the DATA tab from class: the survey’s heights are in column F. F:F means all of column F.
- Click cell O5. Type: 1
- Click cell P5. Type:
=AVERAGE(F:F)-O5*STDEV(F:F)
- Click cell Q5. Type:
=AVERAGE(F:F)+O5*STDEV(F:F)
- Click cell R5. Type:
=100*COUNTIFS(F:F,">="&P5,F:F,"<="&Q5)/COUNT(F:F)
P5 and Q5 are the heights 1 SD below and 1 SD above the mean: 1.59 m and 1.80 m. R5 counts the heights from P5 to Q5, as a percent of all the heights. It shows 64.05, the 64.1 the Python cell prints. In Sheets the & glues the sign to the number in the cell; in the Python cell it means “and”.
O5 is k, the number of SDs. On the task sheet, rows 6 and 7 do the same with k = 2 and k = 3, and show 97.49 and 99.61.
In your project
In class you put a histogram of a number column on your ANALYSIS tab, and wrote in B4 whether it is a bell. If it is close to a bell, the mean and SD tell you where most of your values fall: about 68% within 1 SD. If it has a long tail or two humps, the rule does not hold, and your sentence says so. A row with a z-score past 2 or −2 is worth a second look. It may be a real but unusual value, or an error to fix on your CLEAN tab and write down in your LOG.
Check Yourself
Answer each one before you look. The first two are from L20 and L19b.
Flip a fair coin three times. What is the chance of three tails in a row, as a percent? L20
12 × 12 × 12 = 18, which is 1 in 8, or 12.5%. The same as three heads.
What does line 2 print? L19b
1w = pd.Series([4, 4, 4, 4])
2print(w.std())
In Sheets this is: =STDEV on four numbers. In English: 1. Make a column of the four numbers, and call it w. 2. Print the standard deviation of w, dividing by n − 1.
Every value is the mean, 4, so every distance from the mean is 0, and the SD is 0. pandas prints it as a decimal: 0.0.
Values are close to normal, with mean 50 and SD 8. About 95% fall between which two numbers?
95% is within 2 SDs: 50 − 2 × 8 = 34 and 50 + 2 × 8 = 66. 42 to 58 is 1 SD (68%); 26 to 74 is 3 SDs (99.7%).
A test has mean 70 and SD 4. Find the z-score of a 78.
z = 78 − 704 = 84 = 2
Subtract the mean first, then divide by the SD.
Same test. About what percent of scores are higher than the 78?
z = 2. 95% sit within 2 SDs, so 5% sit outside, half on each side: 2.5% above. (5% is the trap: that counts both sides.)
Bags of chips are filled with mean 28.0 g and SD 0.5 g. One bag weighs 27.0 g. Find its z-score.
z = 27.0 − 28.00.5 = −1.00.5 = −2
Negative: the bag is 2 SDs below the mean. Only about 2.5% of bags are that light or lighter.
Flip 20 fair coins and count the heads. What SD does the theory give, to two places?
SD = √20 × 0.5 × 0.5 = √5 = 2.24
The mean is 20 × 0.5 = 10 heads.
Jo’s score is at the 90th percentile. What does that mean?
A percentile is the percent of values at or below this one: a place on the bell, out of 100 people. It says nothing about how many questions Jo got right.
Theory for 10 coins: mean 5, SD 1.58. You get 9 heads. How unusual is that?
z = 9 − 51.58 = 2.53
More than 2 SDs above the mean: rare, a few sets in 100 at most. But it can happen: 9 heads is possible, just unusual.
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.