Statistics Chapter 2 of 15

Chapter 2: Collecting Data

Sampling, bias, observational studies, and experiments

All chapters
On this page
What you will be able to do after this chapter
  • Distinguish a census from a sample, and explain why a good sample beats a big bad one.
  • Carry out simple random, systematic, stratified, and cluster sampling, and recognize convenience and voluntary-response samples.
  • Identify undercoverage, non-response, response, and voluntary-response bias in a description of a survey.
  • Distinguish observational studies from experiments, and explain what a confounder is and why randomization defeats it.
  • Design a randomized experiment with control, randomization, replication, blocking, and blinding.
  • State what each of random sampling and random assignment allows you to conclude.
  • Use the rule \(\text{margin of error} \approx 1/\sqrt{n}\) to plan a survey.
2.1

Why design comes first

In Chapter 1 we said that a poorly designed study cannot be rescued by clever analysis. This chapter explains why, and what "well designed" means. The single most important idea is this:

Garbage in, garbage out

Statistical formulas assume the data were collected in a particular way (usually by random selection or random assignment). If that assumption is false, the formulas still produce numbers, but the numbers do not mean what they claim to mean.

Census versus sample

A census measures everyone. It sounds ideal, but it is often impractical (too expensive, too slow), sometimes impossible (destructive testing: you cannot test every fuse by burning it out), and, surprisingly, not always more accurate. A national census can miss people, record errors, and take years to process. A carefully collected sample can be more accurate than a sloppy census.

The sampling frame

Definitions
  • The sampling frame is the list (or other mechanism) from which the sample is actually drawn: a voter roll, a phone directory, a list of addresses.
  • Undercoverage occurs when the frame leaves out part of the population you care about (for example, a landline directory omits everyone who uses only a mobile phone).
  • A probability sample is one in which every member of the population has a known, nonzero chance of being selected, and selection is done by a chance mechanism.

The chance mechanism is the heart of the matter. Probability samples let us calculate how far a statistic is likely to be from the parameter. Non-probability samples do not.

2.2

Sampling methods

Simple random sample (SRS)

A simple random sample of size \(n\) is chosen so that every possible group of \(n\) members of the population has the same chance of being the sample. It is like drawing names from a well-mixed hat, without replacement. In practice we number the population \(1, \dots, N\) and use a random number generator or a table of random digits to pick \(n\) distinct numbers.

The number of distinct possible samples is \(\binom{N}{n}\), so with \(N = 12\) and \(n = 3\) there are \(\binom{12}{3} = 220\) possible samples, each with probability \(1/220\).

Example 2.1: Drawing an SRS with random digits

A company has 80 employees, numbered 01 to 80. We want an SRS of 5 for an interview. Here is a row of random digits (generated for this example):

8 1 2 2 3 9 5 0 3 4 0 5 7 5 6 2

Step 1: decide how many digits per label

Labels go up to 80, so use two-digit groups: 81, 22, 39, 50, 34, 05, 75, 62.

Step 2: read groups and skip invalid or repeated labels

81 is above 80, so skip it. Then 22, 39, 50, 34, 05 are all valid and distinct.

Step 3: report the sample

Employees numbered 22, 39, 50, 34, and 05. Skipping invalid labels does not bias the selection: every valid label still has the same chance at every step.

Systematic sampling

List the population in order, compute the interval \(k = N/n\), pick a random starting point between 1 and \(k\), and then take every \(k\)th unit. It is simple and spreads the sample across the list, but it can go badly wrong if the list has a repeating pattern that lines up with \(k\) (for example, sampling every 7th day from a daily record when the pattern repeats weekly).

Example 2.2: Systematic sample from a list of 2,400

We want \(n = 60\) from a list of \(N = 2400\).

The interval is \(k = 2400/60 = 40\). Choose a random start between 1 and 40, say 17. The selected positions are 17, 57, 97, ..., and the 60th is \(17 + 40 \times 59 = 2377\). Every position has probability \(1/40\) of being included, but not every group of 60 is possible (for instance, positions 1 and 2 can never both be chosen), so it is not an SRS.

Stratified random sampling

Divide the population into non-overlapping groups called strata that are internally similar (for example, year of study, region, gender), then draw a separate SRS from each stratum and combine them. With proportional allocation, each stratum's share of the sample matches its share of the population:

\[ n_h = n \cdot \frac{N_h}{N}. \]

Stratification guarantees representation of every group and usually gives more precise estimates than an SRS of the same size, especially when strata differ a lot from each other on the variable being measured.

Example 2.3: Proportional allocation across four year groups

A school has 1200 students: 480 first-years, 360 second-years, 240 third-years and 120 fourth-years. We want a stratified sample of \(n = 100\).

Stratum\(N_h\)\(N_h/N\)\(n_h = 100 \cdot N_h/N\)
First-year4800.4040
Second-year3600.3030
Third-year2400.2020
Fourth-year1200.1010
Total12001.00100

Then draw an SRS of 40 from the first-years, 30 from the second-years, and so on.

Cluster sampling

Divide the population into clusters that are each a miniature of the whole (for example, city blocks, classrooms, villages). Randomly select some clusters and measure everyone (or a random subset) inside them. It is cheap when the population is spread out, because you travel to fewer places, but estimates are usually less precise than an SRS of the same size, because people in the same cluster tend to resemble each other.

Do not confuse strata and clusters

Strata are groups that differ from each other; we sample from every stratum. Clusters are groups that each look like the whole population; we sample some clusters and take (nearly) all within. A helpful test: if every group were identical to the others, clustering would lose nothing, but stratifying would gain nothing.

Multistage sampling combines these steps: for example, choose districts (clusters), then schools within those districts, then classes within those schools, then students within those classes. Large national surveys use this.

Non-probability samples: avoid for inference

MethodHow it worksWhy it fails
Convenience sampleTake whoever is easiest to reach (students in the corridor, friends)Easy-to-reach people differ systematically from everyone else
Voluntary response samplePeople choose to respond (call-in polls, online votes, product reviews)People with strong opinions respond; the rest stay silent
Quota sampleInterviewers fill quotas by group (50 percent women, 30 percent aged over 50, ...) but choose whom to approachInterviewer choice reintroduces bias inside each quota

Compare the methods in a simulation

Which method gives the best estimates? The tool below builds a population of 300 people living in six neighborhoods with very different incomes, then lets you sample it with each method. Repeating the sampling hundreds of times reveals two separate qualities of a method: bias (does it aim at the right target on average?) and variability (how spread out are the estimates?).

What to look for
  • SRS, systematic, stratified: all centered on the true mean (unbiased). Stratified and systematic are far tighter than the SRS here, because the list is sorted by neighborhood and the neighborhoods differ so much: both methods guarantee every neighborhood its fair share. (Systematic has only 10 possible samples with n = 30, so its exact spread reflects this one population.)
  • Cluster: still unbiased, but the wide spread shows the price of sampling only two neighborhoods.
  • Convenience and voluntary response: the histogram is tight but in the wrong place. Precision without accuracy is worse than useless, because it creates false confidence.
Going deeper: The price of clustering: the design effect

Suppose we sample \(m\) people from each of many clusters, and people within a cluster have intraclass correlation \(\rho\) (the correlation between two randomly chosen members of the same cluster). Then the variance of the sample mean is inflated relative to an SRS of the same total size by the design effect:

\[ \text{deff} = 1 + (m-1)\rho. \]

If \(\rho = 0\) (clusters are perfect miniatures), clustering costs nothing. If \(\rho = 0.05\) and \(m = 21\) people are taken per cluster, then \(\text{deff} = 1 + 20 \times 0.05 = 2\): the cluster sample of 1000 people is only as informative as an SRS of 500. That is the mathematical reason survey designers weigh travel savings against lost precision, and the reason for taking many clusters with few people each when possible.

2.3

Bias: how good-looking samples go wrong

Definition: Bias

A method of collecting data is biased if it systematically overestimates or underestimates the parameter it is aiming at. Bias is about the method, not about a single unlucky sample.

TypeWhat goes wrongExample
Undercoverage (frame) biasPart of the population has no chance of selectionA phone survey using only landline numbers misses mobile-only households
Voluntary response biasRespondents select themselvesAn online poll after a match: fans with strong views vote
Non-response biasChosen people do not respond, and responders differ from non-respondersA mailed survey with a 20 percent return
Response biasRespondents give inaccurate answersUnder-reporting alcohol use; leading question wording; social desirability; interviewer effects
Measurement biasThe instrument itself is offA scale that reads 2 kg heavy

Wording matters

Small changes in wording can move answers by many percentage points. Compare "Do you support allowing the government to reduce the burden of...?" with "Do you support giving the government the power to...?" for the same policy. Good questions are neutral, simple, ask one thing at a time, and offer balanced options. Whenever you read a survey result, find the exact question.

Case study: the 1936 Literary Digest poll

Before the 1936 US presidential election, the magazine Literary Digest mailed roughly ten million ballots and received about 2.4 million back, a colossal sample. It predicted that Alf Landon would beat Franklin Roosevelt with about 57 percent of the vote. Roosevelt won in a landslide with about 61 percent, carrying 46 of the 48 states. A young pollster, George Gallup, predicted a Roosevelt win using a far smaller, carefully quota-designed sample.

What went wrong? The Digest drew its mailing list from telephone directories and car registrations, which in the Depression skewed toward wealthier voters (undercoverage), and only a fraction of those mailed responded (non-response) with those angry at the incumbent more likely to reply. A huge biased sample is still biased. Size shrinks random error; it does nothing about bias.

Example 2.4: Diagnosing the bias in a survey description

A campus radio station wants to know whether students like its programming. It sets up a tent at the main cafeteria during lunchtime and asks passers-by to fill in a form. Of 300 forms, 75 percent are positive.

Identify the sampling method

Convenience sample: whoever happened to walk by the tent.

Identify the problems
  • Undercoverage: students who eat elsewhere, commute home, or are not on campus at lunchtime cannot be selected.
  • Voluntary response: those who stop to fill in a form may be fans of the station.
  • Response bias: answering in front of the station's volunteers may encourage flattering answers.
Fix

Obtain a list of all enrolled students and take an SRS (or a stratified sample by year), then follow up repeatedly with non-responders.

2.4

Observational studies versus experiments

Definitions
  • The response variable is the outcome we measure. The explanatory variable is the variable we think may influence it.
  • In an observational study, the researcher observes and measures but does not assign the explanatory variable. Subjects choose (or nature decides) which group they are in.
  • In an experiment, the researcher assigns subjects to conditions (called treatments) and then measures the response.

Observational studies come in several flavors: cross-sectional (measure everyone once), prospective or cohort (follow groups forward in time), and retrospective or case-control (look back from an outcome to earlier exposures).

Confounding

Definition: Confounding

A confounding variable is one that is related to both the explanatory variable and the response, so that its effect cannot be separated from the explanatory variable's effect. A lurking variable is a confounder that was not measured (or not thought of).

If coffee drinkers are more likely to be smokers and smoking causes heart disease, then even when coffee itself does nothing, coffee drinkers as a group will show more heart disease. The tool below lets you dial that scenario.

Common mistake

"We adjusted for age, sex, and income, so the confounding is gone." You can only adjust for confounders you thought of and measured. A randomized experiment, by contrast, handles all confounders, including unmeasured and unknown ones, on average.

Example 2.5: Classifying a study and naming confounders

Researchers followed 5,000 adults for ten years, recording each person's typical daily step count at the start and whether they later developed heart disease.

Study type

Observational (nobody was assigned to walk more or less), prospective cohort study.

Variables

Explanatory: daily step count. Response: heart disease (yes or no), a categorical variable.

Possible confounders

Baseline health (people already ill may walk less), diet, smoking, income, and age.

What can be concluded

An association can be reported (and it is stronger evidence than a single snapshot because exposure preceded outcome), but a causal claim needs randomization or very careful additional argument.

2.5

Designing experiments

Vocabulary

TermMeaning
Experimental unitThe smallest thing to which a treatment is assigned (a person, a plot of land, a classroom). If classes are assigned to a method, the class is the unit, not the student.
SubjectA human experimental unit
FactorAn explanatory variable manipulated by the experimenter
LevelA specific value of a factor
TreatmentA specific combination of levels (with two factors of 3 and 2 levels there are 6 treatments)
Control groupA group receiving a baseline, placebo, or standard treatment for comparison
PlaceboAn inactive treatment that looks like the real one

The four principles of experimental design

Control, randomize, replicate, block
  1. Control other sources of variation: keep everything except the treatment the same across groups, and include a comparison group.
  2. Randomize the assignment of units to treatments using a chance mechanism, so that treatment groups are comparable on every variable, measured or not, on average.
  3. Replicate: use enough units in each group that chance differences average out.
  4. Block when you know a variable affects the response: group similar units into blocks and randomize within each block.

Blinding and the placebo effect

People who believe they are receiving a treatment often improve for psychological reasons (the placebo effect). In a single-blind study the subjects do not know their treatment. In a double-blind study neither subjects nor the people measuring outcomes know, which prevents the researcher's expectations from influencing measurements.

Common designs

DesignHow it worksWhen to use it
Completely randomized designAll units randomly split among treatmentsUnits are fairly homogeneous, or you have no blocking variable
Randomized block designGroup units into similar blocks, then randomize within each blockA known variable (age, baseline score, farm) strongly affects the response
Matched pairsBlocks of size two: pair similar units and randomly assign one of each pair to each treatment; or give both treatments to the same unit in random orderTwo treatments, and units can be matched or measured twice
Example 2.6: A matched pairs design for two teaching methods

A teacher wants to compare method A (traditional) with method B (interactive) using 20 students. Student prior achievement strongly predicts scores, so it is a good blocking variable.

Step 1: block

Rank the 20 students by last term's grade and pair adjacent students: (1st, 2nd), (3rd, 4th), ..., (19th, 20th). This gives 10 pairs of similar students.

Step 2: randomize within pairs

For each pair, flip a coin: heads means the first student gets method A and the other method B; tails means the reverse.

Step 3: measure and compare within pairs

After the term, compute the score difference (A minus B) inside each pair and analyze the 10 differences (Chapter 11). Because each pair is matched on prior achievement, that source of variation cancels out, leaving a much clearer picture of the method effect.

Watch out

Students should not know which method is "the new one" if possible, and the teacher who marks the final exam should not know who used which method (blinding).

What random sampling and random assignment each buy you

The two kinds of randomness
Random assignment to treatmentsNo random assignment
Random sampling from the populationCausal conclusions and generalization to the populationGeneralize to the population, but only report associations
No random sampling (volunteers, convenience)Causal conclusions, but only for the kind of subjects in the studyNeither: descriptive only

Random sampling lets you generalize to the population. Random assignment lets you infer cause. Most clinical trials use volunteers (no random sampling) but assign treatments at random, so their causal conclusions strictly apply to people like the volunteers.

Going deeper: Why randomization works: potential outcomes

Imagine each unit \(i\) has two potential outcomes: \(Y_i(1)\) if treated and \(Y_i(0)\) if not. The causal effect for unit \(i\) is \(Y_i(1) - Y_i(0)\), but we can only ever observe one of the two (the fundamental problem of causal inference). The average treatment effect is \(\text{ATE} = E[Y(1)] - E[Y(0)]\).

If units are assigned to treatment by a fair coin flip, then treatment \(T\) is independent of the potential outcomes, so \[ E[Y \mid T=1] - E[Y \mid T=0] = E[Y(1)] - E[Y(0)] = \text{ATE}. \] The difference in group means is an unbiased estimate of the causal effect. Without randomization, the treated group may differ from the control in ways that also affect \(Y\), and that difference is exactly the confounding bias.

2.6

How large should a sample be?

For an SRS, the amount of random error in a proportion depends on the sample size \(n\), not on the population size (as long as the population is much larger than the sample). A quick and famous rule of thumb, which Chapter 9 derives, is:

The \(1/\sqrt{n}\) rule (95 percent confidence) \[ \text{margin of error} \;\approx\; \frac{1}{\sqrt{n}}, \qquad\text{so}\qquad n \;\approx\; \left(\frac{1}{\text{margin of error}}\right)^{2}. \]

It is a slightly cautious approximation to \(1.96\sqrt{\hat{p}(1-\hat{p})/n}\) at its worst case \(\hat{p} = 0.5\).

n1004001000250010000
Margin of error10.0%5.0%3.2%2.0%1.0%

Notice the diminishing returns: to halve the margin of error you must quadruple the sample size. And remember that this only quantifies random error in a random sample. It says nothing about bias.

Example 2.7: Planning a poll

(a) A poll of \(n = 1025\) adults reports a proportion. The approximate margin of error is \(1/\sqrt{1025} = 0.0312\), about plus or minus 3.1 percentage points.

(b) To get a margin of error of 2 percentage points, we need \(n \approx (1/0.02)^2 = 2500\).

(c) To get a margin of error of 1 percentage point we need \(n \approx (1/0.01)^2 = 10{,}000\). Cutting the error from 2 points to 1 point costs four times the sample.

2.7

Ethics of data collection

Experiments on people raise ethical issues that a mathematical design cannot solve. The main requirements are: informed consent, approval by an ethics review board before starting, minimizing risk, protecting privacy and confidentiality, and stopping early if one treatment proves clearly better or clearly harmful (data monitoring committees do this in clinical trials). A key ethical condition for randomizing patients is equipoise: genuine uncertainty among experts about which treatment is better. If we already know one is better, randomly assigning people to the worse one is unethical.

When an experiment is impossible or unethical (we cannot assign people to smoke), careful observational studies are the only route, and we must be correspondingly modest about causal claims.

2.8

Chapter summary

Key ideas
  • Good design comes before analysis: bias cannot be repaired afterwards.
  • Probability samples use a chance mechanism: SRS, systematic, stratified, cluster, multistage.
  • Stratify to guarantee representation and precision; cluster to save cost (at some loss of precision). Do not confuse the two.
  • Convenience, voluntary response, and quota samples are biased; their size does not help.
  • Bias types: undercoverage, voluntary response, non-response, response (including question wording), measurement.
  • Observational studies can show association; only randomized experiments can establish causation. Confounders drive the difference.
  • Experiments: control, randomize, replicate, block; use blinding and placebos where relevant.
  • Random sampling supports generalization; random assignment supports causation.
  • Margin of error for an SRS proportion is about \(1/\sqrt{n}\); halving it needs four times the sample.

Key terms

TermMeaning
BiasA systematic tendency of a method to miss the parameter in one direction
BlockingGrouping similar units and randomizing within groups
Cluster sampleRandom selection of whole groups (clusters) that each resemble the population
ConfounderA variable tied to both explanatory and response variables that muddles their relationship
Double-blindNeither subjects nor evaluators know the treatment assignments
Explanatory / response variableThe variable thought to influence / the outcome measured
Sampling frameThe list from which a sample is actually drawn
Simple random sampleEvery possible group of size n is equally likely to be selected
Stratified sampleSeparate SRS from each of several strata
UndercoveragePart of the population is missing from the frame
2.9

Practice