TL;DR
Selection bias happens when the people in a study are not a fair picture of the group the study is about, because of how they came to be in it. If being included depends on the exposure and the outcome, or on something that both of them cause, the association you measure inside the sample can be different from the association in the population, even when the two are unrelated out in the world. The fix is to understand the process that put people into the data before you interpret the numbers.
Where you'll see it: in hospital-based studies, volunteer surveys, trials that lose patients to follow-up, studies of people who are still working, and reviews that only see the studies that got published.
This lesson is an explanation of a statistical idea. It is not medical advice.
Intuition
A hospital that makes two diseases look opposed
Suppose two diseases, A and B, are completely unrelated in the general population. Having one tells you nothing about having the other. Now look only at patients in a hospital. The hospital admits people who have at least one of the two diseases. Among those admitted, a patient who does not have disease B is almost certain to have disease A, because they must have A to be there at all. A patient who does have B is much less likely to also have A, because B alone already explains the admission. Inside the hospital, the two diseases look negatively linked, even though they are independent in the world.
Nothing about the diseases changed. The act of selecting on something they both feed into created the association. This is the core of selection bias. The study population is a filtered version of the population of interest, and the filter depends on the variables under study.
flowchart LR A[exposure] --> S[selected into the study] Y[outcome] --> S A -.-> Y
The dashed arrow is the link we want to study, and in the scenario above it does not exist. The solid arrows show that both variables feed into the selection. Conditioning on S, which is what happens when we only analyse the selected people, opens a path between A and Y through the selection node.
The plot below shows the same effect in a single number. Let be the true probability of disease A in the population, with disease B at 10 percent. The dashed line is the population value. The solid curve is the probability of A among the people who were selected into the hospital, which is far from the population value.
- population P(A)
- P(A | admitted)
Two ways it happens
There are two common routes. The first is selection on something both the exposure and the outcome cause, which is the hospital story above. The second is selection on the outcome itself or on a quantity closely tied to it. Think of a trial in which patients who feel worse leave the study. Whether a patient is still in the data depends on how they are doing, and how they are doing is the outcome. The people left behind are no longer a fair comparison.
Selection bias is different from confounding. Confounding comes from a common cause of the exposure and the outcome in the whole population, and it is present before anyone is selected. Selection bias comes from the way the sample was formed, and it can happen even when no confounder exists. Both can be present in the same study, and they call for different fixes.
The math
Setup
Write for exposure, for outcome, and for an indicator that equals 1 when a person is in the study and 0 otherwise. The quantity we want is the population association:
where the expectations average over everyone in the population. The quantity we can compute is the same contrast restricted to the study:
Selection bias is the gap between these two contrasts. If is independent of once is fixed, the gap is zero, and the study is safe as far as selection goes. The gap is non-zero when the selection depends on the outcome in a way that differs between the exposure groups.
The collider case
Let and be two independent binary variables, with and . Let the selection be when or (or both). Then and are independent in the population, but a variable that is caused by both of them is a collider. Conditioning on a collider creates an association between its causes.
The probability of being selected is
Among the selected, the probability that is
This is larger than whenever , so selection makes more common than it is in the population.
Now condition on as well. If and , then must be 1, because requires or . So
Among the selected people who lack , is certain. Among the selected people who have , is merely . The two conditional probabilities point in opposite directions from each other, which is the negative association that appeared in the hospital story.
Selection on the outcome
When selection depends on directly, the same algebra applies with as the variable that decides inclusion. If differs across values of , then the outcome distribution among the included people is not the population distribution. The simplest case is loss to follow-up. If the people who die or feel worse are more likely to leave the study, the observed death rate among those who stay is a biased estimate of the true death rate, and the bias depends on how different the loss rates are between the arms.
Worked examples
Take 10,000 people. Diseases A and B are each present in 10 percent of people, independently. The expected counts are:
| B present | B absent | Total | |
|---|---|---|---|
| A present | 100 | 900 | 1,000 |
| A absent | 900 | 8,100 | 9,000 |
| Total | 1,000 | 9,000 | 10,000 |
Step by step, if the hospital admits anyone with at least one disease:
- Admitted people are those with A or B. The count is .
- Among admitted people with B present, the count with A is 100, out of . So .
- Among admitted people with B absent, every admitted person has A, since the only way in is through A. The count with A is 900, out of 900 admitted. So .
- Check against the formula: and , matching steps 2 and 3.
- Among all admitted people, , which is far above the population value of 0.10.
Interpretation: in the hospital, having B makes A look rare (0.10 versus 1.00 for those without B), so the two diseases appear to exclude each other. In the population they are independent. A researcher who studied only this hospital would find a strong association that is entirely produced by admission.
Consider an invented trial with 1,000 people in each arm. The true five-year death risk is 10 percent in both arms, so the treatment has no effect. Patients who are doing badly are more likely to drop out, and deaths are not always recorded for them. The numbers below are made up to show the mechanism.
| Arm | Randomised | Lost to follow-up | Deaths among lost (unrecorded) | Deaths among followed | Followed patients | Total deaths |
|---|---|---|---|---|---|---|
| Control | 1,000 | 200 | 40 | 60 | 800 | 100 |
| Treated | 1,000 | 100 | 10 | 90 | 900 | 100 |
Step by step:
- True risk in control: . True risk in treated: . True difference: 0.
- Complete-case risk in control, using only followed patients: .
- Complete-case risk in treated: .
- Complete-case difference: , which suggests the treatment is harmful.
- Complete-case risk ratio: , against a true ratio of 1.00.
Interpretation: the arms have different loss rates (20 percent versus 10 percent), and in the control arm the lost patients died far more often than the followed ones (40 of 200, or 20 percent, versus 60 of 800, or 7.5 percent), while in the treated arm they died at the same rate (10 percent). The analysed population in control is healthier than the full randomised group, so its death rate looks too low. Randomisation balanced the arms at the start, but the selection that happened afterwards broke the balance. The error is not in the treatment itself. It is in which patients the analysis is allowed to see.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| Volunteer survey or self-selected sample | Those who respond differ from those who do not, often in the outcome itself | Random sampling from a defined frame, plus reporting of response rates and comparisons with non-responders |
| Hospital or clinic-based case-control study | Admission depends on both exposure and disease, which creates the collider pattern | Population-based sampling, or a design that does not condition on hospital admission |
| Loss to follow-up that differs between arms | Complete-case analysis compares selected groups, and the bias can point either way | Analyse everyone as randomised, use inverse-probability weighting, and run a sensitivity analysis on the missing outcomes |
| Studies of people who are still working (the healthy worker effect) | Those who became too ill to work have left the study group, so the group looks healthier than the general population | Include people who stopped working, or model the exit from work explicitly |
| Studies that only include people who survived to a time point | Those who died earlier are missing, so the observed group is filtered by the outcome | Define the cohort at the start of exposure, and count all who began |
| Reviews that see only published results | Positive findings are more likely to be published, so the pooled estimate is inflated | Trial registries, unpublished data, and funnel-plot checks, with the caveat that these checks can mislead when studies are few |
A rule carries over from confounding. Do not adjust for a collider or for a variable that is itself affected by the exposure and the outcome. Adjusting for a collider, or analysing only the selected group, creates the association instead of removing it. Draw the causal graph first, and check whether the selection node sits on a path between exposure and outcome.
Randomisation does not remove selection bias from who enters the trial. It balances the arms among those who were enrolled. Who was enrolled, and who stayed, is a separate question, which is why a randomised trial can still give a biased answer when follow-up is uneven. The randomised trial is the standard design against confounding, and it still needs careful follow-up to protect against selection.
History
In 1946, the American statistician Joseph Berkson pointed out that studies of hospital patients can show associations between diseases that do not exist in the general population. His argument was about the mathematics of who gets admitted, and it was an early warning that the sample can manufacture a result. The effect now carries his name as Berkson's paradox.
During the Second World War, a statistical group working for the United States military analysed damage to returning bombers. The planes that came back had holes in some areas, and the obvious response was to armour those areas. Abraham Wald argued that the planes that did not come back were the ones that mattered, and that the armour should go where the returning planes were unhit. The story is often told as the origin of survivorship bias, which is a close relative of selection bias: the sample was filtered by survival, and the filter shaped what was seen.
Publication bias became a named problem as meta-analysis spread through the 1970s. In 1979, Robert Rosenthal described the "file drawer problem", the worry that null results sit unpublished while positive ones reach journals and then get pooled. The concept caught on because it explained why reviews of a literature could reliably overstate effects, and because the same logic applied to every stage at which a study could be filtered. The shared idea is that a conclusion is only as good as the process that decided which observations count.
Check yourself
QuestionIn one or two sentences, explain how selection bias differs from confounding bias.Show answer
Confounding comes from a common cause of the exposure and the outcome in the population, and it is present whether or not anyone is studied. Selection bias comes from the way the study sample was formed, so it depends on inclusion that is related to both the exposure and the outcome, or on a collider. A study can have both, and each needs a different fix, such as adjustment for confounders and changes to sampling or follow-up for selection.
QuestionIn the collider setup with and , what is ?Show answer
The probability of selection is . Then , about 71 percent. The population rate of is 20 percent, so the selected group contains far more than the population does, and this happens without any link between and in the world.
QuestionWhy can a randomised trial still be biased by selection, even though randomisation balanced the arms?Show answer
Randomisation balances the characteristics of people at the moment they are assigned, which is the source of its protection against confounding. Selection can happen afterwards, through loss to follow-up or exclusion from analysis, and if that selection depends on the outcome and differs between arms, the analysed groups are no longer balanced. The balance was real at enrolment, and it was broken by who stayed in the data.
QuestionA study of a drug includes only patients who were discharged alive from hospital. Describe the risk of bias and a fix.Show answer
Patients who died in hospital are excluded, so the analysis is conditioned on survival until discharge. If the drug affects in-hospital death or the conditions that lead to it, the included group is filtered by a variable related to both the exposure and the outcome, which can distort the comparison in either direction. A fix is to define the cohort at the time treatment starts and include everyone who began, using methods that handle deaths as outcomes. This is an explanation of the statistics, not advice about the drug.