L19 How Far From Average

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

For your project: the SD of your number goes on ANALYSIS. The checkpoint is at the end.

Why It Matters

Drawing split down the middle: the Golden Gate Bridge in fog on the left, the Capitol under a blazing sun on the right
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 FranciscoWashington
Average temperature57.9°F59.3°F
Average July high67°F89°F
SD of the daily highs7.5°F17.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.

StepDo this
1Find the mean.
2Take the mean away from each value. Each answer is a deviation.
3Square each deviation, so none is negative.
4Add the squares.
5Divide by n − 1, one less than how many values.
6Take 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 strategy

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

ValueMinus the mean, 4Squared
1−39
3−11
3−11
400
9525
Add36

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 check

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

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

CellTypeIt 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 check

Both 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:

  1. Get the pandas toolbox and call it pd.
  2. Make a column of the five numbers, and call it late.
  3. Print the mean of late.
  4. 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

Q1 is 22 and Q3 is 35. What is the IQR? L18

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?

Find the SD of 1, 3, 5, 7, 14 by hand.

A column holds 8 values. In step 5, what does =STDEV divide the added squares by?

Which change makes the SD of 1, 3, 3, 4, 9 bigger?

Strong hand: SD 2.1 cm. Other hand: SD 4.8 cm. Which sentence belongs on the ANALYSIS tab?

Project Checkpoint

ANALYSIS · part of P2, due Fri 18 Dec

The SD says how far a typical value sits from the mean. A gap between your two groups means more when the values inside each group bunch close together.

Do these once your CLEAN tab exists (L22, Fri 4 Dec). Column B of CLEAN is your number.

Check these numbers in Python: Your Project File on the practice page opens your CLEAN tab and prints them.

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 2.7: Measures of the Spread of the Data. A free college textbook. Read the part on the standard deviation. Its formula is the same six steps, written in symbols: s is the SD, and the bar over x is the mean.

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.