Methods

Description and testing

  • Table 1 and standardised mean differencesAdvanced

    Why Table 1 asks a different question in a trial than in an observational study, why the standardised mean difference does not inflate with sample size, where the |SMD| < 0.1 convention came from, and how to decide between mean and median and where to put missing values.

  • t-tests and analysis of varianceBasic

    What the normality assumption actually assumes, why Welch belongs as the default, what changes when the data are paired, which multiple comparisons follow an ANOVA, and why testing for normality before choosing a test is a bad habit.

  • Chi-square test and Fisher's exact testBasic

    What the chi-square statistic actually compares, where the expected-count-of-five rule came from, what Fisher's exact test solves and what it costs, why Yates's correction is contested, and why paired categorical data must switch to McNemar.

  • Non-parametric tests: Wilcoxon and Kruskal-WallisBasic

    The null hypothesis of the Wilcoxon rank-sum test is stochastic ordering, not equal medians — so "identical medians but a significant p-value" is not a contradiction. Also why a p-value alone is not enough, how to read the Hodges-Lehmann shift estimate, why a rank test and a log transform estimate different quantities, what ties do to the exact p-value, and which comparisons follow a Kruskal-Wallis test.

  • Distribution plots, and the dynamite plotBasic

    A bar chart with one error bar hides the sample size, the shape of the distribution and the outliers, and that bar may be an SD, an SE or a 95% CI — lengths that differ several-fold. What the box plot, the violin and the raincloud each add back, and why journals have started asking for every data point.

Regression

  • Linear regressionBasic

    What "holding the other variables constant" actually holds constant, why a high R² does not mean the model is useful, why linearity in a continuous predictor is an assumption rather than a fact, and which numbers change when you switch the reference group — and which do not.

  • Logistic regression and the odds ratioAdvanced

    Which ratio an OR actually is, why it necessarily overstates the effect when the outcome is not rare, how an adjusted OR differs from a crude one for reasons other than confounding, what separation looks like and how to fix it, and where the "at least ten events per variable" rule came from and why it is now disputed.

  • Poisson and negative binomial regressionAdvanced

    Why counts cannot go into a linear model, why Poisson's equidispersion assumption almost never holds, how to detect overdispersion, what quasi-Poisson and the negative binomial each repair, and the offset — the difference between a count and a rate is the thing clinical research gets wrong most often.

  • Regression model diagnosticsAdvanced

    What each of the four residual plots is looking for, why passing all four still leaves problems undetected, where the importance of VIF is overstated, how influence is measured, and why stepwise regression is one of the most common statistical errors in the medical literature — demonstrated by simulation.

  • Restricted cubic splines and the dose-response curveAdvanced

    How to drop the linearity assumption: where the knots go, why a zero-inflated clinical variable collides with the default knot placement, how to choose the reference point, why the confidence band pinches to a point there, and why the p value for the overall association and the p value for non-linearity must be reported separately.

  • Interaction terms and subgroup analysisAdvanced

    What each of the four coefficients in an interaction model means, why exp(interaction) is a ratio of ratios, how to recover the stratum estimates from one model instead of splitting the data, and the mistake a subgroup forest plot invites: reading a difference in significance as a significant difference.

  • Clustered and repeated-measures dataAdvanced

    Four measurements on one patient, a hundred patients in one hospital: those rows are not independent. What treating them as independent actually does — between-subject standard errors come out too small, within-subject ones come out too large, and the two errors point in opposite directions. Mixed models, GEE and cluster-robust standard errors answer three different questions.

  • Marginal estimates and G-computationAdvanced

    A logistic model hands you a conditional OR, but the quantities you can interpret at the population level — the risk difference, the NNT — have to be computed separately. This page shows how standardisation (G-computation) works, why the conditional and marginal ORs are not supposed to agree (non-collapsibility), and why the confidence interval has to come from a bootstrap.

  • Adjusted risk ratios: log-binomial and modified PoissonAdvanced

    When the outcome is common an odds ratio overstates the effect, but log-binomial regression — the obvious way to estimate an adjusted risk ratio — very often refuses to run. This page walks the sequence in the order it actually happens: it converges, it fails, it converges with starting values, and then modified Poisson does the job; plus what the robust standard error is really fixing here.

  • Conditional logistic regressionAdvanced

    Why matched data cannot be fitted with ordinary logistic regression, what strata() actually conditions away, what happens when you put the matching variables back into the model (nothing happens, and nothing tells you), and how the 1:1 case relates to McNemar's test — which is four different numbers, not one.

  • Categorising a continuous variable, or keeping it continuousAdvanced

    How much power quartiles cost, why categorising sometimes looks stronger instead (which is bad news, not good), why a searched-for optimal cut-point always exaggerates the effect, what P for trend assumes when it treats 1/2/3/4 as numbers, and why some variables cannot be cut into quartiles at all.

  • ANCOVA, change scores and follow-up onlyAdvanced

    Three ways to analyse the same pre-post trial, why randomised trials reach for ANCOVA (the clue is in the baseline coefficient), how the efficiency gap moves with the pre-post correlation, and what regression to the mean looks like — plus why it is only clean in the control arm.

  • Ordinal logistic regression and the shift plotAdvanced

    When the outcome is graded rather than yes-or-no (mRS, NYHA, CTCAE, a 0-10 pain score), dichotomising throws half the information away. What a common odds ratio is, why proportional odds is an assumption and not a result, how to check it, and how the estimates break down when the cells get too thin.

Survival analysis

  • Censoring and the structure of survival dataBasic

    Why "the event has not happened yet" is information rather than a missing value, what right, left and interval censoring each look like, how the risk set shrinks over time, the non-informative censoring assumption the whole toolkit rests on, and how immortal time bias turns a treatment with no detected effect into a miracle cure.

  • Kaplan-Meier curves and the log-rank testAdvanced

    Why survival data cannot be summarised by an average survival time, what each step of a KM curve is computing, which questions the log-rank test answers and which it cannot, and how to read the median line.

  • The Cox proportional hazards modelAdvanced

    What ratio a hazard ratio actually is (not a ratio of survival times, and not an odds ratio), why the coefficients are estimable without ever specifying the baseline hazard, what multivariable adjustment is really doing, how ties are handled, and how to write up a confidence interval that crosses 1.

  • The proportional hazards assumption and Schoenfeld residualsAdvanced

    What proportional hazards actually assumes, how to read the cox.zph table, what Schoenfeld residual plots and log-log plots each show you, and what the four repairs — stratification, a split time axis, a time-varying coefficient, RMST — each cost once the assumption fails.

  • Competing risks — cumulative incidence and Fine-GrayExpert

    Why 1 − KM always overstates risk when competing events exist, what the cumulative incidence function actually counts, how cause-specific and subdistribution hazards answer two different questions, and why age points in opposite directions in the two models fitted to the MGUS cohort.

  • Time-dependent covariatesExpert

    When exposure changes during follow-up, Cox needs a (start, stop] long table rather than one row per person. How tmerge() builds it, why an Andersen-Gill model for recurrent events must use a robust variance, whether a repeated lab value should enter as its baseline or its current reading, when a landmark analysis is the better choice, and why a time-dependent hazard ratio cannot be used for prediction.

  • Restricted mean survival time (RMST)Advanced

    RMST is the area under the Kaplan-Meier curve between 0 and τ — on average, how long people lived during the first τ of follow-up. This page covers how to read that area, why τ must be fixed in advance, how far the conclusion moves when τ changes, why the difference and the ratio both have to be reported, and how to turn it into one sentence you can say to a patient.

  • Left truncation and delayed entryAdvanced

    Not everybody was under observation from day 0. How left truncation differs from left censoring, the two-time Surv(entry, exit, event) form, how far and in which direction survival is wrong without it, and why the whole bias lands on the people who entered late.

  • Weighted log-rank, max-combo, and milestone survivalExpert

    When curves cross or an effect is delayed, the log-rank test adds every event time with equal weight and the two halves of the signal cancel. This page covers the shape of the Fleming-Harrington weights, why a delayed immunotherapy effect needs late weighting, what max-combo charges you for having tried three weights, and why the two confidence-interval transforms for a milestone survival rate disagree so much. Real data does not hand you a test that flips a null result, and that non-finding is on the page too.

Diagnostic accuracy

  • The 2x2 table, sensitivity and specificityBasic

    What each of the four cells and four margins actually answers, why sensitivity and specificity are properties of the test and predictive values are not, when the SpPIN / SnNOUT mnemonics mislead, and the commonest bias in diagnostic research — when only test-positive patients go on to the reference standard, sensitivity and specificity are pushed in opposite directions at the same time.

  • Predictive values and prevalenceAdvanced

    PPV and NPV answer the question patients actually ask, but they are not properties of the test — the same test can have PPVs two orders of magnitude apart at different prevalences. This page opens up the Bayes formula, tells the same story again in whole people, shows why most positives in a rare-disease screening programme are false positives, and then handles a qualification textbooks rarely state: "sensitivity and specificity do not vary with prevalence" is a statement about the arithmetic, not about the world.

  • Likelihood ratios and the Fagan nomogramAdvanced

    A likelihood ratio turns a test result into "multiply the pre-test odds by this much", which is why it does not vary with prevalence and yet still yields this patient's post-test probability. This page covers where LR+ and LR− come from, how to read a Fagan nomogram, why multilevel LRs beat a dichotomy — and the fact that in this dataset the two lowest bands cannot be told apart, because the data are not enough to say whether their LRs differ.

  • ROC curves and the area under themAdvanced

    An ROC curve is the trace of every cut-off at once, and the area under it has one clean probabilistic meaning — the chance that a randomly drawn diseased patient scores higher than a randomly drawn non-diseased one. This page verifies that meaning by counting pairs, then shows the two things AUC cannot see: it says nothing about calibration, and by construction it does not react to prevalence, so it does not degrade on imbalanced data — precision-recall does.

  • Choosing a cut-off, and comparing two ROC curvesExpert

    The "optimal cut-off" that the Youden index picks rests on an assumption that almost never holds — that a percentage point of sensitivity is worth a percentage point of specificity, which quietly fixes the implied threshold probability at the prevalence of the cohort it was chosen in — and it was chosen on the same data it is reported on, which makes it optimistic. This page measures that optimism by bootstrap, raises the cost ratio until the cut-off collapses, then compares two markers with a paired DeLong test, demolishes a common belief along the way (pairing does not necessarily give you more power), and finally restricts the comparison to the high-specificity region with a partial AUC, where the same patients give a different answer from the whole curve.

Prediction models

  • Variable selection for prediction modelsAdvanced

    Picking predictors for a prediction model has nothing to do with causal structure — the only question is whether a variable makes the prediction better. Three common strategies are run on one breast cancer cohort; this dataset cannot tell their external performance apart (the three point estimates differ in the third decimal place, and no uncertainty is estimated here). The difference that does matter lies elsewhere - the same algorithm, on resamples of the same patients, hands back dozens of different "final models". A closing section covers how to read a machine-learning prediction paper - what variable importance and SHAP do and do not say, and why not one item on the acceptance list changes.

  • Shrinkage and penalised regressionExpert

    When the sample is too small, maximum likelihood returns coefficients that are too extreme — the model has learned this particular sample's noise as if it were signal. This page fits one model two hundred times at each of seven development sample sizes to measure how large the overfitting is, and shows that Van Houwelingen's uniform shrinkage factor can almost predict in advance how far the calibration slope will fall. It also covers what separates ridge, lasso and elastic net, and why a penalised coefficient can no longer be read as an effect size.

  • Events per variable, and the Riley sample size criteriaExpert

    The rule of ten events per variable is a rough heuristic from 1990s simulation work, and it has been superseded by the Riley sample size calculation. This page runs both rules on the same breast cancer cohort, then actually fits the model three hundred times at each of the two sample sizes — the sample that only satisfies ten events per variable returns a calibration slope well below 1, with an absolute prediction error nearly twice that of the Riley sample. An inadequate sample does not cost you power; it costs you a model that is overfitted.

  • Internal validation and optimismAdvanced

    Performance measured on the same data the model was fitted to is always flattering, and the gap has a name — optimism. This page carves a 200-person development set out of a large cohort, runs four internal validation methods on it, and checks every answer against the thousands of people left over. It ends with the most expensive mistake in this family — selecting variables on all the data and then cross-validating only the fit.

  • External validationAdvanced

    Internal validation handles optimism; it cannot handle a different group of people. This page puts one breast-cancer model through three validation designs — a random half-split, a split by year of surgery, and a genuinely external cohort. The first two leave the calibration slope sitting near 1; only the external cohort pulls it down to 0.69. It also covers sample size for the validation study itself — below a hundred events, the interval around the calibration slope is too wide to support any conclusion.

  • CalibrationAdvanced

    Calibration asks whether the people a model calls 30% really do have events three times in ten. It is harder to fix and more often skipped than discrimination, and the moment a clinical decision hangs on an absolute probability threshold it matters more than discrimination does. This page measures all four levels of calibration in one real external validation, draws the flexible calibration curve, then applies three levels of recalibration — and checks on a held-out half of the patients whether any of them actually held up.

  • Decision curve analysisExpert

    A decision curve does not ask whether a model is accurate. It asks whether deciding by the model beats treating everyone or treating nobody. The relative cost of a false positive and a false negative is encoded in a threshold probability, and the answer is expressed as net benefit. This page builds, on a real external validation, the comparison that gets mentioned far more often than it gets demonstrated — the model with the higher discrimination having the lower net benefit at the thresholds a clinician would actually use.

  • Time-dependent ROC and cumulative-dynamic AUC(t)Expert

    Harrell's C compresses discrimination at every horizon into a single number, but clinical decisions happen at particular horizons — what you tell a patient is their five-year risk. This page unfolds one breast cancer Cox model's discrimination into a curve over time: how a survival dataset is split into cases and controls at a horizon t, why censored patients force inverse probability of censoring weighting, why AUC(t) sits systematically above Harrell's C, and how to read the curve when it turns out flat — the flatness is itself the conclusion, because you cannot know in advance that it will be flat.

  • NomogramsAdvanced

    The nomogram is the signature figure of the clinical prediction-model literature, and the thing most often misread as a model in its own right. It is not one. It takes an already-fitted model's linear predictor, rescales it into points, and draws it as a ruler — adding no information at all. This page proves that with one patient computed two ways and an exact affine identity across a whole development cohort, then hands the real questions back to internal validation, external validation and calibration.

  • Brier score, NRI and IDIAdvanced

    All three scores exist to answer the same question — is the new model better than the old one? The Brier score folds discrimination and calibration into one number, has no scale of its own, and is simply wrong if you compute it directly on censored survival data. The NRI compresses improvement into a sum of two proportions, at the cost of a sign that depends on which cut-points you picked. This page computes all three, plus the decision curve, on one pair of models and one set of patients, and lets them contradict each other.

Causal inference

  • Confounding, DAGs and what to adjust forAdvanced

    The three conditions a confounder has to meet, how drawing your causal assumptions as a DAG turns "what goes in the model" into a question you can check item by item, and why adjusting for a collider manufactures an association out of nothing — including the collider that happens before the exposure and looks entirely harmless.

  • Propensity score matchingAdvanced

    What matching actually does once a dozen covariates have been compressed into one number, who the caliper throws away, why balance is judged by SMD and never by a p-value, why the matched sample is no longer the population you started with, and how the variance has to be computed afterwards.

  • Inverse probability of treatment weightingExpert

    How weighting uses the same propensity score to construct a hypothetical population, which clinical question each of ATE, ATT and ATO answers, where extreme weights come from and what truncation and stabilisation each cost, and why keeping everybody makes weighting more sensitive to how the score was modelled.

  • Instrumental variablesExpert

    The one method that still has a chance when the confounder that matters was never measured — and the reason it is a hard bargain: two of its three assumptions can never be checked against data, a weak instrument drags the estimate back towards the biased one it was meant to escape, and Mendelian randomisation is the version of this design most clinicians will meet.

  • Self-controlled designsExpert

    Let every person serve as their own control and every characteristic that does not change over time cancels out at once — including the ones you never measured and do not know exist. What separates SCCS from case-crossover, when each of the three assumptions breaks, and why "does the event change what happens to the exposure afterwards?" is the question that decides whether this design works at all.

  • Target trial emulationExpert

    Write down the randomised trial you would run if you could, fill in its seven components, and only then ask which people and which time points in your observational data can stand in for that protocol. The discipline exists to catch immortal time bias, prevalent user bias and the missing active comparator — three design errors no amount of statistical adjustment can repair. Unmeasured confounding is not one of the things it fixes.

  • E-values and sensitivity analysis for unmeasured confoundingAdvanced

    An E-value answers one narrow question: how strongly would an unmeasured confounder have to be associated with both the exposure and the outcome to explain away the association you observed? This page covers the formula and the contour geometry behind it, why the point estimate and the confidence limit each need their own E-value, why a hazard or odds ratio must be converted to a risk ratio first, and why a large E-value is not evidence that no unmeasured confounding exists.

  • Marginal structural models and time-varying IPTWExpert

    Patients start, stop and switch treatment mid-follow-up, and the marker that decides whether they switch is itself a consequence of the earlier treatment. Put that variable in the regression and you get over-adjustment plus collider bias; leave it out and the confounding stays — both are wrong. Weighting is the third route: this page uses a simulation with a known truth to put all three estimates side by side, and shows how stabilised weights are fitted, why the variance cannot be read off the model, and how IPCW multiplies with IPTW.

  • Causal mediation analysisAdvanced

    Putting the mediator into the regression is not a mediation analysis. This page defines the natural direct effect (NDE) and the natural indirect effect (NIE), shows why they add up to the total effect exactly, works through the two places the Baron-Kenny steps fall short, explains why the denominator of the proportion mediated so often collapses, and separates what randomisation buys from what it does not.

  • Interrupted time series and difference-in-differencesAdvanced

    A policy goes live in a particular month and the indicator moves — how much of that belongs to the policy? This page puts two answers on one dataset: ITS extends the pre-intervention trend to build a counterfactual, DiD borrows one from a control series the policy could not touch. It also covers level versus slope, what an unsubtracted seasonal cycle does to the estimate, why a pre-trend check can refute parallel trends but never establish them, and how a panel of negative controls with known null effects measures residual bias directly.

Evidence synthesis

  • Effect measures and their variancesAdvanced

    What a meta-analysis actually pools is a pair of numbers — an effect estimate and its variance. Which effect measures can be pooled, why ratio measures have to be combined on the log scale, where the variance comes from and how it becomes a weight, what to do about zero cells, and why switching effect measure makes the same set of trials look either consistent or wildly heterogeneous.

  • Fixed-effect and random-effects modelsAdvanced

    The difference between the two models is not how conservative they are but what they assume: one asks what common effect this set of studies points to, the other asks where the average of a distribution of effects lies. How the weights get rewritten, which estimators of τ² exist, where DerSimonian-Laird goes wrong when there are few studies, and what the Knapp-Hartung adjustment actually repairs.

  • Heterogeneity — I², τ² and prediction intervalsExpert

    Why I² can run from around half to nearly a hundred per cent while the real differences between studies stay exactly the same, whether a non-significant Q test is evidence of homogeneity, why a prediction interval is closer to what readers actually want to know than a confidence interval is, and the trap in meta-regression where a study-level association gets read as an individual-level one.

  • Forest and funnel plotsAdvanced

    What each visual element of a forest plot encodes, what a high I² does and does not mean, the explanations for funnel plot asymmetry other than publication bias, which of the three asymmetry tests suits which kind of data, and what contour-enhanced funnels and trim-and-fill can and cannot tell you.

  • Network meta-analysis — indirect comparison and treatment rankingAdvanced

    How a network meta-analysis estimates a head-to-head comparison nobody ever randomised, which cell of a league table has no trial behind it at all, why the inconsistency test netmeta prints by default is not the model you fitted, and why a ranking has to be read next to an effect size.

  • Cumulative meta-analysis and information sizeAdvanced

    Ordering the trials by year and re-pooling after each one does two things at once. It shows when the answer was already in the evidence, and it tests the same question dozens of times along a calendar. This page uses the canonical intravenous streptokinase dataset to measure the step at which the pooled estimate stopped moving and how many people were randomised after it, to show significance arriving, leaving and returning, and to explain why a required information size is four assumptions rather than one fact.

  • Sensitivity and influence analysisAdvanced

    What leave-one-out, the per-study influence diagnostics (Cook's D, DFBETAS, hat) and the Baujat plot each answer; why finding that one study is influential calls for an explanation rather than a deletion; and why, on a dataset where the formal cut-offs flag nobody at all, one trial still moves the pooled estimate by close to a tenth.

  • Meta-analysis of diagnostic test accuracyAdvanced

    A diagnostic study reports a pair of numbers, not one, and the pair is tied together by the study's cut-off. This page takes the textbook slogan apart on real AUDIT-C data — pooling the two measures separately barely moves the summary point, and what actually breaks is the joint statement, because crossing two independent intervals gives a rectangle with more area and less coverage whose shape includes exactly the combination the data rule out. Also covered are confidence versus prediction ellipses, and where the SROC curve stops being supported by data.

Cross-cutting issues

  • Missing data and multiple imputationAdvanced

    Complete-case analysis is not a neutral default; it is a choice with an assumption attached. This page uses a dataset that is naturally incomplete to show that the people who get dropped really do differ from the people who stay, then takes multiple imputation apart to reveal what it is — a regression plus noise, followed by two lines of arithmetic.

  • Sample size and powerAdvanced

    Where each input to a sample size calculation pushes the answer, why a rare outcome demands an unreasonably large trial, and one thing demonstrated here with a few thousand simulations — post hoc power is a completely determined function of the p value, so computing it is just restating the p value on another scale.

  • Selection biasAdvanced

    Selection bias is not the vague complaint that a sample "was not representative". It is a rule you can write down — who gets into the analysis. This page runs one cohort under four different attrition rules, against a fifth row in which everyone is kept, and shows that two of them leave the estimate untouched, one damages the risk ratio while sparing the odds ratio, and one wrecks both — and why adjusting for covariates cannot undo any of it.

  • Measurement error and misclassificationAdvanced

    "Non-differential misclassification biases towards the null" is the most widely taught rule in this area, and the most widely over-extended. This page simulates it holding for a binary exposure, then reversing for a three-level one, and lays out regression dilution in continuous variables, error in the outcome, and the residual confounding left behind when a confounder is measured crudely.

  • Multiple comparisons and subgroup analysesAdvanced

    Multiplicity is not a technical detail about discounting p-values; it is a question about what was promised. An alpha of 0.05 guarantees an error rate for one test, and guarantees nothing once you look at twenty. This page measures the inflation of the type I error rate, what three adjustment procedures actually deliver, and why a finely cut subgroup forest plot will almost always hand you a "positive" subgroup.

  • Non-inferiority and equivalenceAdvanced

    A result that is not statistically significant cannot be read backwards as a demonstration that the two treatments are comparable. Claiming comparability means writing down, before any data are seen, the largest loss you would still accept — the margin — and then asking which side of it the upper confidence limit falls on. This page puts one RCT interval in front of four different margins, watches the verdict travel from inferior to non-inferior, and shows that the tipping point sits exactly on the upper confidence limit.

  • Sensitivity analysisAdvanced

    A request to add a sensitivity analysis is among the most common referee comments, and it asks for something more specific than most authors supply. This page runs sixteen individually defensible analyses on one dataset so the spread of estimates becomes visible, then permutes the exposure to measure what it costs to pick a setting after seeing the results.

Agreement and reliability

  • Agreement and the kappa familyAdvanced

    Two people each read the same cases once, and the paper reports a kappa — often a medical student's first study. This page covers why kappa subtracts the agreement chance alone would produce, what weighted kappa measures on an ordinal scale and why it pushes the number down on nominal categories, when three or more raters force a move to Fleiss kappa, and the paradox in which identical observed agreement gives kappas more than three times apart.

  • Intraclass correlation and reliabilityAdvanced

    The ICC is not one coefficient, it is six. On one dataset the six legal forms span a factor of two and a half, so a paper that reports ICC = 0.85 and nothing else has not reported a result. This page first clears the naming collision with the clustered-data chapter (same variance split, different question), then takes the model / type / unit axes apart to show what each one does to the denominator, and finally explains why an ICC close to one is no guarantee that the measurement is precise.

  • Bland-Altman analysis and the limits of agreementAdvanced

    Saying two measurement methods are highly correlated conveys almost nothing. This page uses Bland and Altman's own blood pressure data: first the correlation coefficient talks you into it, then the same 85 people's differences show how wide the limits really are. Then how to handle replicate measurements (what collapses is the precision, not the limits), how to check for proportional bias, and how to translate a limit in mmHg into a clinical decision.