L21 The Bell

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

For your project: a histogram of your number, and one sentence on its shape. The checkpoint is at the end.

Why It Matters

Drawing of a board of pegs with balls dropped from a funnel, piled in a bell shape at the bottom
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.

WithinShare of a normal curve
1 SD of the meanabout 68%
2 SD of the meanabout 95%
3 SD of the meanabout 99.7%
−3−2−10+1+2+3SDs from the meanabout 99.7% within 3 SDabout 95% within 2 SD68%within 1 SD
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−1012
About this percent at or below2.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 strategy

Turn 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.

566795102412531482SAT total score, 2024you, 125050%34%
Below the mean: 50%. From the mean up to 1250: about 34%.
Reflect and check

The 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 strategy

Like 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

0102030012345678910Heads in 10 flips (count)Share (%)
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 check

1 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 strategy

Use Example 2’s theory, mean 5 and SD 1.58, and find the z-score.

Apply the idea

z = 8 − 51.58 = 31.58 = 1.90

Almost 2 SDs above the mean: unusual, but it happens.

Reflect and check

About 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.

WithinThe heightsThe rule
1 SD of the mean64.1%68%
2 SD of the mean97.5%95%
3 SD of the mean99.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:

  1. Get the pandas toolbox and call it pd.
  2. Open the file as a table called df.
  3. Take the height column, drop its blanks, and call the result h.
  4. Print how many rows.
  5. 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:

  1. Call the mean of h m.
  2. Call the standard deviation of h s, dividing by n − 1.
  3. 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:

  1. Call the number of SDs k.
  2. Keep the heights from m − k × s up to m + k × s, and call them inside.
  3. 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.

  1. Click cell Q1. Type: =10*0.5
  2. Click cell Q2. Type: =SQRT(10*0.5*0.5)
  3. 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.

  1. Click cell O5. Type: 1
  2. Click cell P5. Type: =AVERAGE(F:F)-O5*STDEV(F:F)
  3. Click cell Q5. Type: =AVERAGE(F:F)+O5*STDEV(F:F)
  4. 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

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.

Values are close to normal, with mean 50 and SD 8. About 95% fall between which two numbers?

A test has mean 70 and SD 4. Find the z-score of a 78.

Same test. About what percent of scores are higher than the 78?

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.

Flip 20 fair coins and count the heads. What SD does the theory give, to two places?

Jo’s score is at the 90th percentile. What does that mean?

Theory for 10 coins: mean 5, SD 1.58. You get 9 heads. How unusual is that?

Project Checkpoint

Part of P3 · due Wed 13 Jan

The rule for a bell, most values within 1 SD of the mean and nearly all within 2, works only on a bell. Your histogram says how far to trust the mean and SD your claim reports.

Tick each step once it is in your Sheet. Your ticks go into the PDF you hand in. Where everything goes: your Sheet, tab by tab.

Read More

OpenStax, Introductory Statistics 2e, section 6.1: The Standard Normal Distribution. A free college textbook. It calls the 68, 95 and 99.7 rule the Empirical Rule, and works z-scores the same way: the value minus the mean, divided by the SD.

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.