Each module page lets you change one assumption and watch what happens to an estimate. The data are simulated, so every module page knows the true value of what it estimates. You can see when a method recovers the true value and when it does not.
How the pages work
- Each module page starts with In brief, a short explanation of one method, and then the simulation.
- In the simulation, move a slider to change one part of the setting. The charts and the numbers update at once.
- Press Draw a new sample to see how much an estimate changes by chance. Press Reset to return to the starting values and the first sample.
- Below the simulation, a What to notice box suggests moves to try. The full explanation and a short list of references follow.
- Solid lines show what real data would show. Dashed lines show true values that only a simulation knows. Dotted gray lines show what a method assumes.
Modules
The modules come in six parts. A module number such as 5.2 gives the part and the place in the part.
1. Randomized experiments
- 1.1 Randomization inference
How a small experiment gives an exact test from the random assignment alone. How the choice of test statistic changes the answer. How a series of tests gives a confidence interval.
- 1.2 Neyman variance and blocking
How much an experimental estimate moves when the coin flips change. Why the Neyman standard error is too large on average when effects differ. What blocking changes.
2. Observational studies
- 2.1 Regression adjustment and good and bad controls
How adjusting for a confounder works in an observational study. Why one regression coefficient can miss the average effect. Which variables in a causal diagram should not be adjusted for.
3. Noncompliance
- 3.1 Noncompliance and instrumental variables
What a randomized swipe ad estimates when few customers swipe through to the reveal. When the Wald estimate recovers the effect for compliers. How a direct effect of the ad, defiers, or a weak instrument change the estimate.
- 3.2 Principal strata
Why a comparison among workers can mislead when a training program changes who works, and which comparison is fair.
4. Regression discontinuity
- 4.1 Regression discontinuity
How to estimate a jump at a cutoff. How the bandwidth, a curved outcome line, and manipulation of the score change the estimate.
5. Difference-in-differences
- 5.1 Difference-in-differences
What the parallel trends assumption says, and what happens to the estimate when it fails.
- 5.2 Staggered adoption
Why a two-way fixed effects regression can mislead when groups adopt a policy at different times and the effect changes over time. How to estimate the effect for each adoption group and period instead.
- 5.3 Event study and placebo dates
How to read the estimates for the periods before and after a policy starts. How to rank the actual date against dates when nothing happened.
6. Prediction and decisions
- 6.1 Selective labels
Why data produced by past decisions make it hard to judge a prediction model.
- 6.2 Uplift targeting
Why the customers most likely to leave are not always the customers that an offer helps most.
Key terms
The pages use these terms with these meanings. This site writes \(Y(1)\) and \(Y(0)\) for the potential outcomes and D for the treatment indicator (1 for treated units, 0 for untreated units). Some textbooks use other symbols, for example \(Y^1\) and \(Y^0\) (Cunningham 2021). \(E[\,\cdot\,]\) means the average over the whole population. A vertical bar means among: \(E[Y(0) \mid D = 1]\) is the average of \(Y(0)\) among the treated units.
- Potential outcomes
- Each unit (a person, a store, a firm) has two potential outcomes. Y(1) is its outcome with the treatment. Y(0) is its outcome without the treatment. After the unit receives the treatment or does not, we can observe at most one of the two. (Imbens and Rubin 2015, ch. 1)
- No interference
- Two potential outcomes per unit are enough only under two conditions. The treatment of one unit does not change the outcome of another unit. Every treated unit gets the same version of the treatment. This pair of conditions is called the stable unit treatment value assumption (SUTVA). For example, a funded supplier may require its own unfunded subcontractors to meet higher standards. Then the outcome of a subcontractor depends on the treatment of another firm. (Cunningham 2021, ch. 4)
- Individual treatment effect
- The difference between the two potential outcomes of one unit: Y(1) − Y(0). (Cunningham 2021, ch. 4)
- Fundamental problem of causal inference
- Nobody can observe both potential outcomes of the same unit. So no individual treatment effect is ever observed directly. Holland gave the problem this name. (Holland 1986, p. 947)
- Counterfactual outcome
- The outcome that a unit would have had in the state that did not happen. For a treated unit, the counterfactual outcome is Y(0). For an untreated unit, it is Y(1). Nobody can observe a counterfactual outcome, so a study must estimate it, for example from a comparison group. The comparison group is a tool to estimate the counterfactual. It is not the counterfactual itself. (Cunningham 2021, ch. 4)
- Average treatment effect (ATE)
- The average of the individual treatment effects over the whole population: \(E[Y(1) - Y(0)]\). (Cunningham 2021, ch. 4)
- Average treatment effect on the treated (ATT)
- The average treatment effect among the units that received the treatment: \(E[Y(1) - Y(0) \mid D = 1]\). When effects differ across units and units choose the treatment based on the gains that they expect, the ATT usually differs from the ATE. (Cunningham 2021, ch. 4)
- Sample and population average treatment effects (SATE and PATE)
- The SATE is the average of the individual treatment effects among the units in a study. The PATE is the average in the larger population that the units come from. Imbens and Rubin call them the finite-sample and the super-population average treatment effects. The definition of the ATE above is the population version. Module 1.2 shows that the choice changes how much the estimate varies and whether the Neyman standard error is too large. (Imbens and Rubin 2015, ch. 6)
- Conditional average treatment effect (CATE)
- The average treatment effect among the units that share given characteristics \(X = x\): \(E[Y(1) - Y(0) \mid X = x]\). The characteristics X are measured before the treatment. When the effect differs from unit to unit, the CATE can differ from one group of units to another. Module 6.2 uses the CATE to decide which customers get an offer. (Huntington-Klein 2025, ch. 10)
- Selection bias
- The difference in the average untreated potential outcome, Y(0), between the treated group and the untreated group. In symbols, it is \(E[Y(0) \mid D = 1] - E[Y(0) \mid D = 0]\). It shows how far apart the average outcomes of the two groups would be if neither group received the treatment. The difference between the average outcome of the treated group and the average outcome of the untreated group equals the ATT plus the selection bias.
- For example, suppose that a support fund accepts only suppliers that already meet high environmental standards. The funded suppliers would score higher even without the fund. A simple comparison of funded and unfunded suppliers then counts this old gap as an effect of the fund. (Angrist and Pischke 2009, ch. 2; Cunningham 2021, ch. 4)
- Confounder, mediator, and collider
- A causal diagram draws each variable as a node and each direct cause as an arrow. In such a diagram, a confounder is a common cause of the treatment and the outcome. A mediator lies on a causal path from the treatment to the outcome. A collider is a common effect of two variables on a path. The path is blocked at the collider unless a study adjusts for the collider.
- Adjusting for a confounder removes bias. Adjusting for a mediator removes part of the effect, and adjusting for a collider creates bias. Some texts call the last bias selection bias. This site calls it collider bias and keeps the name selection bias for the term above. Module 2.1 shows each case. (Huntington-Klein 2025, ch. 8; Cinelli, Forney, and Pearl 2024)
- Random assignment
- Assignment of the treatment by a chance device, such as a coin flip. Who gets the treatment then has nothing to do with Y(1) or Y(0). So the treatment is independent of the potential outcomes, and the selection bias is zero. In any one experiment, the two groups can still differ by chance. (Angrist and Pischke 2009, ch. 2; Cunningham 2021, ch. 4)
- Principal strata
- Some variables can change because of the treatment, for example whether a person has a job after a training program. Each person then has two potential values of this variable: S(1) with the treatment and S(0) without it. A principal stratum is a group of people with the same pair of values. In the job example there are four strata. They are a job in both cases, a job in neither case, a job only with the program, and a job only without it.
- The treatment cannot change the stratum of a person. So a comparison inside one stratum is a causal comparison. For example, a wage effect is well defined only for people who would have a job in both cases. Nobody can see which stratum a person belongs to, because each person shows only one of the two values. Module 3.2 explains the idea with this example, and Module 6.1 applies it to the decisions of judges. (Frangakis and Rubin 2002)
- Local average treatment effect (LATE)
- In an experiment where people choose whether to take the treatment, the random assignment can work as an instrumental variable. An instrumental variable changes who takes the treatment and changes the outcome only through the treatment. Compliers take the treatment when they are assigned to it and do not take it otherwise. The LATE is the average treatment effect for compliers.
- The intention-to-treat (ITT) effect compares outcomes by assignment. Suppose that the assignment changes outcomes only through the treatment and that nobody does the opposite of the assignment. Then the ITT effect divided by the difference in the share treated equals the LATE. Module 3.1 shows this and what happens when the conditions fail. (Imbens and Rubin 2015, ch. 23 and 24)
- Identification assumption
- A condition about how the data were produced, usually about how the treatment was assigned. If the condition holds, a quantity that we could compute from observed data with an unlimited sample equals the causal quantity that we want. In a real sample, the estimate still differs from the causal quantity because of sampling error. Parallel trends in difference-in-differences is one example. These assumptions involve outcomes that nobody observes, so the data alone cannot fully confirm them. (Cunningham 2021, ch. 4; Hernán and Robins 2020, sec. 10.1)
- Estimand, estimator, estimate
- The estimand is the quantity that we want to learn, for example the ATT. The estimator is a rule that turns any sample into a number. The estimate is the number that the rule gives in one particular sample. (Hernán and Robins 2020, sec. 10.1)
- Bias and sampling error
- The error of an estimate is the estimate minus the true value. The bias of an estimator is its average over all possible samples minus the true value. So the bias is the part of the error that is the same in every sample. Sampling error is the rest of the error. It changes from sample to sample.
- On the module pages, the readout Estimate minus true effect shows the error in the current sample. Draw many new samples, or set the noise to zero where a page has a noise slider, to see the bias. (Hernán and Robins 2020, ch. 10)
- p-value
- A test statistic measures how far the data are from what a hypothesis predicts. Suppose that the hypothesis and every other assumption of the test are true. The p-value is then the probability of a test statistic at least as large as the one in the data. A p-value is not the probability that the hypothesis is true. (Greenland et al. 2016)
- 95% confidence interval
- A range computed from the data by a rule. If the assumptions hold and the study is repeated many times, about 95% of the intervals from this rule contain the true value. One computed interval either contains the true value or does not. (Greenland et al. 2016)
- Randomization inference
- A test that uses the way the treatment was assigned. It computes the same statistic under every assignment that the design could have produced, the actual assignment included. Under the sharp null hypothesis, the treatment changes no unit's outcome, so the outcomes stay the same under every assignment. The p-value is the share of assignments whose statistic is at least as extreme as the actual statistic. The test needs no normal approximation. Module 1.1 explains the test in a small experiment, and Module 5.3 applies the same logic to dates. (Cunningham 2021, ch. 4)
- Prediction question and causal question
- A prediction question asks what will happen. A causal question asks what would change if someone acted. To decide whether to carry an umbrella, a person needs only a prediction of rain. To decide whether to perform a rain dance, the person needs to know whether the dance causes rain. A model can predict well and still give no answer to a causal question. Modules 6.1 and 6.2 show both kinds of questions. (Kleinberg et al. 2015)
References for the key terms
- Angrist, J. D., & Pischke, J.-S. (2009). Mostly harmless econometrics: An empiricist's companion. Princeton University Press. Chapter 2, The Experimental Ideal. https://doi.org/10.1515/9781400829828
- Cinelli, C., Forney, A., & Pearl, J. (2024). A crash course in good and bad controls. Sociological Methods & Research, 53(3), 1071-1104. https://doi.org/10.1177/00491241221099552
- Cunningham, S. (2021). Causal inference: The mixtape. Yale University Press. Chapter 4, Potential Outcomes Causal Model. https://doi.org/10.2307/j.ctv1c29t27. Free online first edition: chapter 4.
- Frangakis, C. E., & Rubin, D. B. (2002). Principal stratification in causal inference. Biometrics, 58(1), 21-29. https://doi.org/10.1111/j.0006-341X.2002.00021.x
- Greenland, S., Senn, S. J., Rothman, K. J., Carlin, J. B., Poole, C., Goodman, S. N., & Altman, D. G. (2016). Statistical tests, P values, confidence intervals, and power: A guide to misinterpretations. European Journal of Epidemiology, 31(4), 337-350. https://doi.org/10.1007/s10654-016-0149-3
- Hernán, M. A., & Robins, J. M. (2020). Causal inference: What if. Chapman & Hall/CRC. Chapter 10, Random variability (section 10.1, Identification versus estimation). https://miguelhernan.org/whatifbook
- Holland, P. W. (1986). Statistics and causal inference. Journal of the American Statistical Association, 81(396), 945-960. https://doi.org/10.1080/01621459.1986.10478354
- Huntington-Klein, N. (2025). The effect: An introduction to research design and causality (2nd ed.). Chapman & Hall. Chapter 8, Causal Paths and Closing Back Doors, and chapter 10, Treatment Effects. Free online edition: chapter 8 and chapter 10.
- Imbens, G. W., & Rubin, D. B. (2015). Causal inference for statistics, social, and biomedical sciences: An introduction. Cambridge University Press. Chapter 1, Causality: The Basic Framework; chapter 6, Neyman's Repeated Sampling Approach to Completely Randomized Experiments; chapter 23, Instrumental Variables Analysis of Randomized Experiments with One-Sided Noncompliance; and chapter 24, Instrumental Variables Analysis of Randomized Experiments with Two-Sided Noncompliance. https://doi.org/10.1017/CBO9781139025751
- Kleinberg, J., Ludwig, J., Mullainathan, S., & Obermeyer, Z. (2015). Prediction policy problems. American Economic Review, 105(5), 491-495. https://doi.org/10.1257/aer.p20151023
About these pages
All data on this site are simulated in your browser. The pages need no installation. The simulations use fixed random seeds. So the same settings and the same sample number always give the same data.