…
…
Open the tables behind three stories for the student newspaper; question the metric, the observation unit and how the data was collected, then fix each headline to say only what the data can carry.
You are a volunteer editor at the school's student newspaper. Before printing, the writers brought three stories:
The numbers in all three stories come from a table. Your job is to ask four questions for each headline, in order: What is the question? (metric, comparison) What does one row describe? (observation unit, variable types) Where did the data come from? (population, sample, how it was selected, observation or experiment) What claim can this data carry? At the end you will fix each headline so it says only what the data can carry.
Data (fictional sample data):
| File | One row | Columns |
|---|---|---|
coffee.csv (H1) | One student (12 rows) | student, coffee (yes/no), weekly_study_hours, grade_avg |
canteen_poll.csv (H2) | One survey response (40 rows) | response_no, satisfied (yes/no), channel |
experiment.csv (H3) | One participant (20 rows) | participant, group (flashcards/rereading), exam_score |
Lessons used: analysis loop and measurable question (1); observation unit, variable types, counting, share and average (2); population and sample, volunteer sample, observation and experiment, lottery (3). The code uses only csv, Counter and random; there are no new concepts.
This task has no points and does not lock the next unit; it is a recommended stop after the test of lesson 3.
<!-- TODO(Can): The real data (R6) was not approved; this was written with the fictional data in the plan. Showing the task in the Projects list is also a suggestion in the plan (open question 4). -->
What you'll do
Required topics
coffee.csvDownload file
Reading file…
canteen_poll.csvDownload file
Reading file…
experiment.csvDownload file
Reading file…
Code cells are for members
You can read the steps. Sign up free to run the code, complete the steps and save your progress.
The three headlines the writers brought are at the top of the cell, in the headlines dictionary. Before anything goes to print, write down the question behind each one. As in lesson 1, say three things for every question:
metric: what are we counting or averaging?comparison: what are we comparing with what? If nothing is compared, write "none".kind: does the headline only describe a situation ("descriptive") or does it say that one thing causes another ("causal")?Watch the verbs: "raises" and "boosts" are cause-and-effect claims, while "satisfied" describes a state. You can write the metric and the comparison in your own words; the check looks for keywords (for example, the metric of H1 must contain "grade").
This step's code cell is for members.Sign up free
Behind every headline there is a table: coffee.csv (H1),
Code cells are for members
You can read the steps. Sign up free to run the code, complete the steps and save your progress.
canteen_poll.csvexperiment.csvcsv.DictReadercoffeecanteenexperimentcoffee.csvThen ask the two questions from lesson 2:
1. What does one row describe? In the units dictionary, write the observation unit of each table as a single word.
2. Which column has which type? Split the columns of coffee.csv: the name of the ID column goes in identifier, categorical columns in the categorical list, numeric columns in the numeric list.
Careful: the student column (O01, O02...) and response_no in canteen_poll.csv look like numbers or codes but they are not measurements; they identify the row. You never average them, so they go in neither the categorical nor the numeric list.
This step's code cell is for members.Sign up free
Is the number in the headline correct? Split the coffee list in two by the coffee column and compute the average grade of both groups (1 decimal, round(..., 1)). Values that come from a CSV are text, so convert them with int(...) before adding.
Even if the number is right, you are not done. Also compute the average weekly study hours of the same two groups and ask the question from lesson 3: is this data an observation or an experiment? Who decided whether a student drinks coffee? Finally, write the name of the other column that separates the two groups, besides grades, into the variable other_difference.
This step's code cell is for members.Sign up free
The canteen survey was collected through a story on the school's Instagram account; anyone who wanted to could answer. The school has 1,200 students (school_size).
First check the number: count the satisfied column with Counter, then compute the share of "yes" and the response rate (number of responses / school size), both with 3 decimals. Then answer the three questions from lesson 3: population (who do we want to talk about?), sample (whose data do we have?), selection (how was the sample chosen: randomly, by convenience, or by volunteering?).
Finally, look at the writer's objection: *"If 400 students had answered the same survey, the result would be reliable."* Why is this sentence wrong? Write the letter of the correct explanation into the variable answer:
This step's code cell is for members.Sign up free
The writer of H3 asks: *"What if I had put my more hardworking friends in the flashcards group?"* Then we could not tell whether the high scores of the flashcards group came from the cards or from hard work. That is why nobody picked the groups in the experiment: the list of 20 volunteers was shuffled with random.seed and random.shuffle, as in lesson 3, and the first 10 people went to the flashcards group.
The lottery code is ready. The random.seed(7) line makes the shuffle come out the same every time you run it. Take the first 10 people of the shuffled list, sorted from smallest to largest, into the list flashcards_group; the cell prints whether this list is the same as the flashcards group in experiment.csv. Then write who decided the groups into the variable who_chose.
This step's code cell is for members.Sign up free
Now look at the number in H3: in the experiment list, compute the average exam score of the flashcards and rereading groups (1 decimal).
Because the groups were assigned by lottery, the two groups are similar on average except for the cards: hardworking and lazy students were mixed into both groups. Unlike H1, does this allow us to link the difference to the cards? Write your answer into the variable causal_ok as True or False.
The lottery carries cause and effect, but for whom? Only volunteers took part in the experiment. Write who the result applies to into the variable applies_to.
This step's code cell is for members.Sign up free
As the editor, make your final call: for each story, pick the headline that the data can carry. Of the three suggestions for each story, one is right, one claims too much, and one gets the number wrong.
H1 (coffee)
H2 (canteen)
H3 (flashcards)
Write the letters you pick into the new_headline dictionary. After that, if you want to write a headline of your own, the example claim table in the next step gives you a benchmark.
This step's code cell is for members.Sign up free
The deliverable is a claim table: for each headline, the question, the observation unit, the data source and selection, and the claim the data can carry. First write your own table on a sheet of paper or in a notebook (we work with fictional headlines; do not use real people or school names), then compare it with the example below.
Example claim table
| Headline | Question | Observation unit | Data source and selection | Claim the data can carry |
|---|---|---|---|---|
| H1 | Is the average grade different for students who drink coffee and those who do not? | Student | Self-reports of 12 students; observational | Among these 12 students, coffee drinkers have an average grade 9 points higher; but they also study about 4 more hours a week on average. We cannot say that coffee raises grades. |
| H2 | How many students are satisfied with the canteen? | Response (one student) | 40 volunteers who answered an Instagram story (about 3% of the school) | 34 of the 40 students who answered are satisfied. Because the answers are voluntary, this says nothing about the school as a whole. |
| H3 | Is the average of the flashcards group higher than the rereading group? | Participant | 20 volunteers, assigned to two groups by lottery; experiment | In this experiment, volunteers who used flashcards scored 8 points higher; thanks to the lottery, linking the difference to the cards is reasonable. The result does not generalize directly to students who did not volunteer. |
Checklist (tick every item on your own table)
A weak example. A writer fixed the headlines like this:
Match the mistake in each headline with the types below and write the letters into the weak_error dictionary:
Quick review (no points)
For H1 to carry the claim "coffee raises grades", how should the data have been collected?
For H2 to say something about the whole school, how should the 40 students have been chosen?
In H3, what problem would come up if each volunteer chose their own group instead of a lottery?
In a magazine you see the headline "People who jog in the morning are happier". Which two questions would you ask first to question its data?
This step's code cell is for members.Sign up free