Exam practice
Every question from the end of every unit, with hints and answers to open. After you check an answer, mark how you did, and come back to the ones you didn’t get.
11 questions
Unit 5 · Data, Evidence and Decisions
Explain these words, with an example of each: population, sample, sampling error, bias, 95% interval.
Answer
- Population: the whole group you want to know about. Example: every household in a ward.
- Sample: the members you actually ask or measure. Example: 40 of the ward’s households.
- Sampling error: the difference between a sample’s estimate and the population’s true value that comes only from which members happened to be chosen. Example: a random 40 households give 35% with internet when the ward really has 40%.
- Bias: a way of choosing a sample that makes its estimates miss in the same direction again and again. Example: asking only houses along the road, which have internet more often, so the estimate is always too high.
- 95% interval: the range in which the true value reasonably lies, given the sample, worked out for example by resampling and keeping the middle 95%. Example: average data spending Rs. 612 (95% interval Rs. 518 to Rs. 710).
Write a program that works out a 95% interval, by resampling, for the median of these 12 waiting times at a health post, in minutes: 5, 12, 8, 30, 15, 9, 45, 11, 7, 20, 14, 10. Why might a median be a better summary than the mean here?
Answer
import randomimport statistics waits = [5, 12, 8, 30, 15, 9, 45, 11, 7, 20, 14, 10]print("Median:", statistics.median(waits), "minutes") random.seed(1)medians = sorted(statistics.median(random.choices(waits, k=len(waits))) for i in range(1000))print("The middle 95%:", medians[25], "to", medians[974], "minutes")Output
Median: 11.5 minutesThe middle 95%: 8.5 to 17.5 minutesA few very long waits (30 and 45 minutes) pull the mean up to about 15.5 minutes, more than most patients waited; the median, 11.5, is the middle patient’s wait and isn’t moved by how long the longest were. With only 12 patients the interval is wide: the post should time more patients before deciding anything.
The least-squares line for the stations in this unit is: temperature (°C) = 25.45 − 0.00487 × height (m). a. Say the slope and intercept in words. b. Predict the average temperature at 2,000 m. c. Why should you not use it to predict the average temperature on the summit of Everest, 8,849 m?
Answer
a. Slope: for every 1,000 m higher, the average temperature over the year is about 4.9 °C lower, on average, across these stations. Intercept: the line predicts about 25.4 °C at sea level, 0 m, which is a little below the lowest station (72 m), so it is a small extrapolation.
b. 25.45 − 0.00487 × 2,000 = 25.45 − 9.74 = about 15.7 °C.
c. The highest station is at 2,363 m. Everest is nearly four times as high, far outside the data; the slope may change with height, and nothing here was measured there. The line gives 25.45 − 0.00487 × 8,849 ≈ −17.6 °C, but that is an extrapolation, not a finding.
Explain what r² measures. In this unit, r² = 0.991 for the stations. Give two reasons why it would be wrong to say “height causes 99.1% of the temperature”.
Answer
r² is the share of the variation in the values up the chart (here the stations’ temperatures) that the line accounts for: 1 − (the sum of squared residuals ÷ the sum of squared distances from the mean).
Wrong to say (any two): r² measures how closely the dots follow a line, not cause; the reason for the pattern (air cools as it rises and expands) comes from physics, not from r²; it is about these 15 stations, chosen where stations are, not all of Nepal; it is about the spread between stations, so “99% of the temperature” means nothing (a station’s temperature isn’t made of parts); another factor that goes with height could be part of the pattern.
A student fits polynomials of degree 1 to 9 to the marks of 10 students against their hours of study, and chooses degree 9, because “it has the smallest error, 0”. Explain what is wrong, and what the student should have done.
Answer
A polynomial of degree 9 has 10 numbers to choose, so it can pass exactly through any 10 points: an error of 0 on its own data is guaranteed and means nothing. Between and beyond the points it will swing wildly, and predict new students’ marks badly. This is overfitting.
The student should keep some data back (or use leave-one-out: fit on 9 students, test on the 10th, in turn), compare each degree’s error on the students it didn’t see, and choose the simplest model that does about as well as the best, usually a straight line for so few points. Most of all, with 10 students the uncertainty is large, so any line should be given with its interval.
Districts of Nepal where more households have a motorcycle have higher pass rates in the SEE. A politician says: “Give every family a motorcycle and results will improve.” Explain what is wrong, using the word confounder, and say what kind of study could show whether a thing really raises results.
Answer
A correlation between motorcycles and pass rates doesn’t show that motorcycles cause better results. A confounder, a third factor that affects both, is far more likely: richer districts, with more towns, roads, money and jobs, have more motorcycles and also better-funded schools, more educated parents and more tuition. Giving out motorcycles would change none of those.
To show whether something raises results, use a randomized controlled experiment: let chance decide which students, schools or wards get it (the treatment group) and which don’t (the control group), so that every other factor is spread evenly on average, then compare the results; a difference bigger than chance could explain shows cause.
An online shop tests two designs of its home page. A was shown to 2,000 visitors, of whom 120 bought something; B to 2,000 visitors, of whom 150 bought. a. Work out each version’s share and the difference. b. Describe how a shuffle test would decide whether chance could explain the difference. c. The shuffle test gives p = 0.07. What should the shop conclude?
Answer
a. A: 120 ÷ 2,000 = 6.0%; B: 150 ÷ 2,000 = 7.5%; B sold to 1.5 percentage points more visitors (30 more sales).
b. Suppose the design makes no difference (the null hypothesis). Then the 4,000 visitors, 270 buyers among them, would have bought or not whichever page they saw. Shuffle all 4,000 and deal them into two groups of 2,000 at random, count the buyers in each, and note the difference. Repeat 1,000 times or more. The share of shuffles with a difference of 30 or more, either way, is the p-value.
c. A difference this big would turn up by chance about 7% of the time with no real difference. That is weak evidence, short of the usual 5% line, but it isn’t evidence that the designs are the same either. The shop should not treat 5% as a magic line: it could run the test longer, with a size decided in advance, before changing the page, and look at the size of the difference too, with its interval.
A news story says: “Road deaths in Nepal fell by 40% this year compared with last.” List three questions you would ask before believing that roads became safer.
Answer
Any three, such as:
- Which two years, and why those? Was last year unusually bad (a few big bus accidents), so that any year after it would look better? What does the trend over ten years show?
- Did the counting change: how deaths are recorded, or which deaths (on the spot, or within 30 days in hospital)?
- Did travel change: fewer vehicles, closed roads, a lockdown, fuel shortages? Deaths per vehicle or per kilometer traveled would be fairer than a count.
- Is the fall bigger than the usual ups and downs from year to year?
- Who reported it, and do they gain from the claim?
In your own words, explain why a big sample of phone data might give unfair answers about a district’s people, even if it covers millions of records. What would you do about it?
Answer
Phone data covers only people with phones, and only the ones they carry and use. In Nepal that leaves out many of the poorest, the oldest, young children and many women, who may not own a phone of their own; it counts people who carry two SIMs twice; and it is thin where signal is poor. However many records it has, it is a biased sample: a decision based on it (where to put a clinic, where to send relief) could serve those already best connected and miss those in most need.
What to do: compare the data with the census or a random survey of households to see who is missing; weight or correct the estimates for those groups; collect data in other ways (health volunteers, ward offices) for the people phones miss; and say plainly in the report whom the data doesn’t cover.
A mobile company plans to sell “anonymous” location data of its customers to advertisers: each customer’s movements for a year, with the name and number replaced by a code. Evaluate the plan for privacy, fairness and the environment, and suggest what should be done instead.
Answer
Privacy: a year of locations isn’t anonymous: where a phone spends its nights and its days points to one home and one workplace, which together fit very few people, so anyone who knows those can find a person’s whole record (as researchers found with the Netflix ratings); it would reveal visits to clinics, temples, partners or protests. Customers didn’t agree to this use, and Nepal’s Privacy Act requires consent.
Fairness: advertisers could target or exclude people by where they live or go; the people harmed would have no way to know.
Environment: keeping and copying every customer’s full movements for a year, for advertising, stores and processes far more data than any stated need.
Instead: sell nothing at the level of one person; if anything, only totals over big areas and times, with random noise added (differential privacy); ask customers for clear, separate consent; keep raw locations only as long as the network needs them, then delete them (data minimization); and have the arrangement checked by an independent body.
Write a four-part conclusion (claim, evidence, how sure, limits) for this made-up finding: in a random sample of 300 households in a municipality, 63% have a family member working abroad (95% interval 57% to 68%), and those households spend on average Rs. 4,000 a month more on food than the others.
Answer
Claim. In this municipality, about two households in three have a family member working abroad, and those households tend to spend more on food.
Evidence. In a random sample of 300 households, 63% had a family member abroad. On average they spent Rs. 4,000 a month more on food than households without.
How sure. The share is between about 57% and 68% (95% interval, by resampling). The food difference should also be given with an interval before it is relied on.
Limits. One municipality, at one time: it says nothing about other places. The sample is random, but households who were away or refused to answer could differ. The food difference is a correlation, not proof that money from abroad raises spending on food: households with someone abroad may also be bigger, or better off for other reasons, so a fair comparison would at least compare households of the same size and income before the person left. Spending was reported by the households, not measured.
