The average of 400 pounds
An analyst reports that the average pocket money in a school is 400 pounds a week. Nobody believes it. But a number on a screen looks so sure of itself.
Checking that a result is believable is a skill in its own right. So is checking that cleaning did not damage the data.
Key words
| Word | What it means |
|---|---|
| Test plan | a table of tests with data and the answers you expect |
| Believable | makes sense, given the inputs and what you know |
| Accurate | close to the true value |
| Logical reasoning | checking by thinking: are the right inputs used and does the answer make sense? |
| Bias | an unfair lean, such as asking only some of the people |
| Subject matter expert | a person who knows the topic well, who can say if a result looks right |
| Sample | a small group of records picked to check |
| Original | the data as it was before cleaning |
The cells students fill in are left blank in this preview.
By the end of this lesson
Note
I can check a result is believable and accurate, and check that cleaning has not added errors, by sampling against the original.
Starter
Have a go
Starter
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Three ways to check a result
| Method | What you do | Example |
|---|---|---|
| Logical reasoning: the inputs | Check all the relevant inputs are included, with no bias in how they were chosen | Did the survey ask every year group, or only year 7? |
| Logical reasoning: the result | Check the result makes sense for the inputs | The mean cannot be bigger than the largest value |
| Subject matter expert | Ask someone who knows the topic | A head of year says 400 pounds is nonsense |
| Test plans | Run planned tests with known answers | A test with data that has a known mean |
The cells students fill in are left blank in this preview.
Try it: does the mean make sense?
money = [4, 5, 5, 6, 200]
total = 0
for m in money:
total = total + m
mean = total / len(money)
print("mean", mean)
print("between smallest and largest:", mean >= min(money) and mean <= max(money))
# The mean passes this test but 44 pounds is still not typical. A check helps, it does not prove.
# Change the 200 to 7 and look again.
Checking that cleaning added no errors
Cleaning changes data, so cleaning can create mistakes. A script meant to fix capitals might also change a year from 7 to 70.
Take a sample of the cleaned rows. Compare each sampled field with the original. Every difference should be one you meant to make.
Worked example: comparing a sample
| Row | Original | Cleaned | Difference you meant? |
|---|---|---|---|
| 0 | " amy REED", 8 | "Amy Reed", 8 | Yes: spaces and capitals |
| 2 | "cy dean", 9 | "Cy Dean", 9 | Yes: capitals |
| 4 | "Bo Jones", 7 | "Bo Jones", 70 | No: the year changed by mistake |
The cells students fill in are left blank in this preview.
Check
Have a go
Check
4 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.