Sub topic 6
Random assignment and why it matters
This chapter assumes you know what an independent variable (the factor the researcher manipulates) and a dependent variable (the outcome measured) are. It also assumes you know the basic idea of an experiment from the previous chapter. Here you will learn what random assignment is, why it supports causal claims, and where it goes wrong.
What random assignment is
Random assignment means that every participant has a known, usually equal, chance of landing in each condition, and that chance does not depend on anything about the participant. A coin flip, a random number generator, or a shuffled list can do this. A researcher's judgment, a participant's preference, or the order in which people arrive cannot.
Random assignment is different from random sampling:
| Feature | Random sampling | Random assignment |
|---|---|---|
| What it decides | Who is selected from the population | Which condition each selected person enters |
| Main benefit | External validity (generalizing to the population) | Internal validity (supporting a causal claim) |
| Used in | Surveys, some correlational studies | Experiments |
| Can an experiment have one without the other? | Yes | Yes |
Many experiments use convenience samples, such as university students, and still randomly assign them to conditions. Such a study can support a causal claim for the people studied, but it may not generalize to other groups.
Why it supports causal conclusions
Suppose you want to know whether a short mindfulness exercise lowers test anxiety. If you let students choose, the students who pick mindfulness may already be calmer, more motivated, or more organized. Any difference in anxiety afterward could come from those pre-existing differences instead of the exercise. Those differences are confounds (variables that differ between groups and offer a rival explanation for the result).
Random assignment deals with confounds you thought of and ones you did not. Because chance decides who goes where, no characteristic, measured or unmeasured, is systematically linked to the condition. On average, the groups are equivalent before the manipulation. If they differ afterward by more than chance would explain, the manipulation is the most plausible cause.
Note the phrase "on average." Random assignment guarantees fairness of the procedure, not equal groups in every single study. With small samples, chance can produce groups that differ noticeably. Statistical tests (covered later in the tutorial) account for this by asking how large a difference chance alone would usually produce.
A worked example in Python
The code below assigns 20 participants to two groups by shuffling the list and splitting it in half.
import random
participants = [f"P{i}" for i in range(1, 21)]
random.seed(42) # fixed seed so the assignment can be reproduced
random.shuffle(participants)
treatment = participants[:10]
control = participants[10:]
print("Treatment:", treatment)
print("Control:", control)The seed makes the shuffle repeatable, which helps with documentation and open science. In a real study, the seed should be chosen and recorded before anyone sees the participants, so no one can try seeds until a favorable split appears. Splitting a shuffled list also guarantees equal group sizes, which simple coin flipping does not.
Common forms of random assignment
- Simple random assignment. Each person is assigned independently, like flipping a coin. It is easy, but with small samples it can give unequal group sizes.
- Block randomization. Participants are assigned in small blocks, for example four at a time with two per condition. Group sizes stay balanced as participants arrive over time.
- Matched random assignment. Researchers first measure a variable that strongly predicts the outcome, such as pretest anxiety. They rank participants on it, group them in sets of two (or more), and randomly assign within each set. This reduces the chance of an unlucky imbalance on that variable.
- Counterbalancing in within-subjects designs. Each participant experiences every condition, and the order is randomized or systematically rotated. This is the within-subjects counterpart to random assignment, because it keeps order from lining up with condition.
Edge cases and common errors
Several practices look random but are not.
- Alternating assignment. Putting every other arrival in the treatment group is predictable. If the researcher knows who is next, they may unconsciously steer certain people into a condition.
- Assignment by day or session. Running the treatment on Monday and the control on Friday links condition to everything that differs between those days, such as weather, exam schedules, and participant type.
- Self-selection. Letting people choose creates groups that differ in motivation. Volunteering for a condition is itself a trait.
- Reassigning after the fact. Moving a participant because the groups "look unbalanced" breaks the randomness. Decide on balancing rules, such as blocks, before data collection.
Random assignment can also be damaged after it is done:
- Attrition. If more people drop out of one condition than the other, the remaining groups may no longer be equivalent. For example, a demanding therapy might lose its most distressed participants, which makes it look more effective. Researchers report dropout by condition and often analyze everyone as originally assigned (intention-to-treat analysis).
- Compromised allocation. If staff can predict the next assignment, they may change who gets enrolled. Concealing the sequence until each person is enrolled prevents this.
- Contamination. Participants in different conditions talk to each other, so the control group picks up the treatment.
What random assignment cannot do
Some variables cannot be randomly assigned, either because it is impossible (age, gender, personality) or unethical (child abuse, trauma, smoking). When you study these, you lose the causal safeguard. A comparison of smokers and nonsmokers is not an experiment, because participants chose their group. Quasi-experiments and correlational designs, covered in later chapters, handle these situations with weaker causal claims.
Random assignment also does not make results generalizable. A perfectly randomized trial in one clinic tells you about causes in that kind of participant. Generalizing needs a sample that represents the target population.
Checking whether randomization worked
Researchers often compare groups on baseline measures such as age, prior experience, and pretest scores. Large differences suggest a problem or bad luck. Small differences are expected. Some methodologists argue that significance tests of baseline differences are not informative, since any difference in a properly randomized study is due to chance by definition. A more useful approach is to measure important predictors of the outcome in advance and adjust for them statistically.
Exercise
A researcher tests a new study technique. She assigns the first 30 students who sign up to the technique group and the next 30 to the control group. Students who sign up early tend to be more conscientious. Is this random assignment? What problem does it create, and how would you fix it?
Show answer
It is not random assignment, because condition depends on sign-up order. Early sign-ups differ in conscientiousness, which also predicts grades, so conscientiousness is a confound and any group difference could reflect it instead of the technique. Fix it by collecting all 60 students and assigning each one by chance, for example by shuffling the list and splitting it in half, or by using block randomization as students sign up.
Exercise
A study randomly assigns 100 people to a therapy or a waitlist. By the end, 30 people from the therapy group and 5 from the waitlist have dropped out. Why might the final comparison be misleading even though assignment was random?
Show answer
Unequal attrition means the remaining groups may no longer be equivalent. If people with the most severe symptoms left the therapy group, the remaining therapy participants look healthier for reasons unrelated to the treatment. Researchers should report dropout by condition, examine why people left, and analyze participants according to their original assignment (intention-to-treat).