Privacy note: We capture your IP address to provide customised and focused services. See our Privacy Policy.

Data Science & Statistics with Python — Alpha School

Lesson 12: Designing a Fair Experiment

When you want to know whether something causes a change, an experiment is the strongest tool you have — but only if it is designed fairly. The core idea is comparison: one group gets the treatment, another does not, and everything else is kept as similar as possible. If the groups differ in some other way — one is older, keener, or better prepared — you cannot tell whether the treatment or the difference caused the result. A fair experiment removes those alternative explanations in advance, by design, rather than trying to argue them away afterwards.

Random assignment is the key. When students are assigned to the new timetable or the old one by chance, the two groups will be similar on average — in ability, motivation, background, and everything else, including things you never thought to measure. That is the magic of randomisation: it balances the unknown as well as the known. Without it, you must hope you thought of every difference that matters, and hope is not a method.

Blinding, Controls and Placebos

A control group is the group that does not receive the treatment, and it is essential: without it you cannot know what would have happened anyway. Blinding means keeping people from knowing which group they are in, so expectations cannot change the result — a student who knows they are using the "new, better" app may try harder for that reason alone. Where a treatment has a psychological component, a placebo — a harmless stand-in that looks like the treatment — lets you separate the real effect from the effect of believing you are being helped.

Good experiments are also planned in advance. Decide the question, the sample size, and the analysis before collecting data, and write it down. This pre-registration protects you from the temptation to keep analysing until something looks significant. It also forces you to think about sample size: too few participants and even a real effect will be missed; too many and you waste people's time. The power of the test — from the last lesson — is the guide.

Experiments Have Limits Too

Not everything can be tested by experiment. You cannot randomly assign people to smoke, or to grow up in poverty, and some questions are about the past or about whole countries, where no experiment is possible. In those cases you must work with observation and be honest about what it cannot prove — the subject of the next unit. And even a good experiment only answers the question it asked, for the people it studied: a timetable that works in one school may not work in another. Report who was studied and how, so readers can judge how far the result travels.

Ethics of Experimentation

Experiments on people carry responsibilities that go beyond good design. Participants should understand what they are agreeing to, be free to leave at any time, and never be exposed to harm for the sake of a result. In a school, that means a survey or an experiment needs the agreement of the people involved and, where appropriate, their parents and teachers — not just the enthusiasm of the researcher. It also means the control group should not be denied something valuable: if a new timetable is expected to help, the fair design is to try it with one group first and extend it to the other if it works, rather than leaving one group behind permanently.

There is also the question of what happens to the results. An experiment that finds a real benefit creates an obligation to act on it, and one that finds a harm creates an obligation to stop. Designing an experiment without a plan for acting on the answer is collecting data for its own sake. Before you run an experiment, write down not only the question and the method, but what you will do with each possible outcome — and who needs to agree.

Watch & Learn

One video to watch for this unit, from a trusted educator.

Key Terms

Experiment
A study that changes one thing and measures the effect, with a comparison group.
Random assignment
Allocating participants to groups by chance, so the groups are similar on average.
Control group
The group that does not receive the treatment, showing what would have happened anyway.
Blinding
Keeping participants — or researchers — from knowing who is in which group.
Placebo
A harmless stand-in treatment, used to separate a real effect from expectation.
Pre-registration
Writing down the question, sample size and analysis before collecting data.

Discussion Questions

  1. Why does random assignment balance things you never thought to measure, while matching on known traits cannot?
  2. A student knows they are using the 'new, better' app and tries harder. Is that a real effect of the app? How would you separate it?
  3. Why is it dishonest to decide your analysis after seeing the data?

Practice Questions

  1. What is the purpose of a control group?
  2. Why is random assignment better than letting students choose their group?
  3. What is blinding, and why does it matter?
  4. What is pre-registration?
  5. Give one question that cannot be tested by experiment, and say why.
Show answers
  1. To show what would have happened without the treatment, so the treatment's effect can be isolated. Without it you cannot tell whether the change would have happened anyway.
  2. Because chance balances the groups on average — in ability, motivation and background, including things you never thought to measure — while self-selection lets the keenest students cluster in one group.
  3. Keeping people from knowing which group they are in, so expectations cannot change the result. A student who knows they have the new app may try harder for that reason alone.
  4. Writing down the question, sample size and analysis before collecting data. It prevents fishing through analyses until something looks significant.
  5. Any of: whether smoking causes disease (you cannot randomly assign people to smoke), or whether growing up in poverty affects outcomes — experiments on people must be ethical and practical, so some questions can only be studied by observation.
Keep reading to complete this lesson