Epidemiology
Epidemiology asks how often a disease occurs, in whom, and what changes that frequency, and it usually answers from data that nobody randomized. This section teaches the designs and the analyses that make such answers defensible: measures of occurrence, standardization, confounding and its diagrams, case-control studies, quantitative bias analysis, the causal inference methods for treatments that were chosen by clinicians, Mendelian randomization, meta-analysis, and models of epidemics.
Every lesson analyzes a simulated dataset with a known answer. The lesson states the true value of the quantity it estimates, so you can see which analysis recovers it and by how much the others miss. Real data never comes with that answer key, which is the reason to practice where it does.
How to use this section
Section titled “How to use this section”- R and Python together. Each lesson shows both languages in synced tabs. Pick a language once, and every page follows that choice.
- Data you can download. Each lesson links its invented tables as CSV files. The blocks of one tab, pasted in page order, form a complete script.
- One language when only one has the method. Some methods, such as Mendelian randomization with summary data, have an established package in R only. The page then says which steps it shows in one language.
- The estimand first. Each lesson names the population, the contrast and the scale of the effect before it fits a model.
Start from the study question
Section titled “Start from the study question”| Question | Start here |
|---|---|
| How common is the disease, and how fast do new cases appear? | Study designs and measures of occurrence |
| Two regions have different age structures. | Age standardization and the SMR |
| How large is the association, on which scale? | Risk difference, risk ratio and odds ratio |
| Which variables should the model adjust for? | Confounding, DAGs and effect modification |
| Cases were sampled with matched controls. | Case-control studies |
| How far could selection, misclassification or an unmeasured confounder move the estimate? | Bias analysis |
| Treatment started during follow-up. | Time-dependent covariates and immortal time |
| What would the risk be if everyone were treated? | Propensity scores and g-computation |
| Treatment is given several times and depends on the patient’s course. | Marginal structural models |
| How should an observational treatment comparison be designed? | Target trial emulation |
| Can genetic variants stand in for randomization? | Mendelian randomization |
| Several trials answer one question. | Meta-analysis |
| Is the outbreak growing or shrinking? | Epidemic curves and the reproduction number |
| What would an intervention change in an epidemic? | SIR and SEIR models |
The Statistical Analysis section covers the regression, survival and sample size methods that these lessons use. The Population Genetics section covers genotype quality, relatedness and population structure, which matter for any analysis that uses genetic variants.