Bayesian Case-Crossover Design — Self-Matched Epidemiological Study with Bayesian Inference

Statistics
Introduced by
Malcolm Maclure (case-crossover); Bayesian extension developed by Lumley, Sheppard, and colleagues
Year
1991 (case-crossover); Bayesian extension ~2000s
Type
Self-matched observational study design with Bayesian inference
Family
Clinical / epidemiology

What does it do?

The Bayesian case-crossover design is a self-matched epidemiological method for estimating the transient effect of a time-varying exposure on the risk of an acute event.

Each case serves as its own control, so confounding by time-stable individual characteristics is removed by design. The Bayesian version places a prior distribution on the exposure effect and reports a posterior distribution in place of, or alongside, the conditional logistic estimate of the classical design.

The intuition behind the method

Suppose you want to know whether high air pollution on a given day raises the risk of a heart attack. In a case-crossover study, each patient's exposure in a short hazard window before the event is compared with their exposure in control windows, such as other days in the same month and weekday. Because each person is compared only with themselves, stable traits such as age, sex, or genetic background cannot confound the comparison. The Bayesian extension adds a prior distribution over the log-odds ratio (log-OR) of the exposure effect. This matters most when event counts are small, because the prior limits how far sampling noise can move the estimate. The resulting posterior distribution summarises what the data and the prior together imply about the exposure–event relationship.

History

Malcolm Maclure introduced the case-crossover design in 1991 as a case-only method for studying brief exposures that cause transient changes in the risk of rare acute-onset events. His estimator of the average incidence rate ratio over the hypothesised effect period was the Mantel-Haenszel estimator, and self-matching of cases removed the threat of control-selection bias. Janes, Sheppard and Lumley (2005) later reviewed referent selection for air pollution studies and recommended the time-stratified strategy.

When to use it

Use this design when the question concerns the short-term effect of a transient, time-varying exposure, such as air pollution, temperature, medication use, or physical exertion, on an acute, clearly dated event such as myocardial infarction or injury. It is well suited to settings where time-stable confounders are a serious concern and individual-level time-stamped records of both exposure and events are available. The Bayesian extension is most useful when events are sparse, when prior evidence from earlier studies can inform the exposure effect, or when a probability statement about the effect is needed. Do not use it when the exposure is time-stable (for example, a genetic variant or lifetime smoking status), when the event is chronic rather than acute, or when only aggregate ecological data are available. Strong time trends in exposure also argue against bidirectional referent selection.

Limitations and considerations

  • The design requires individual-level, time-stamped exposure and event data; aggregate or cross-sectional data cannot support it.
  • Time-varying individual-level confounders are controlled only when referent selection is matched to them, as Janes, Sheppard and Lumley describe; otherwise they remain uncontrolled, for example a medication change or a concurrent acute illness during the study period.
  • The referent strategy determines bias. Janes, Sheppard and Lumley note that the design assumes no trend in exposure across referent times, and conditional logistic regression is unbiased only with certain referent strategies.
  • A poorly justified informative prior can pull the posterior toward the prior and away from the data, so sensitivity analyses add analytic work.
  • MCMC computation can be slow for large datasets or complex hierarchical models, and convergence must be verified.
  • The hazard window length and effect period must be fixed in advance. In Maclure's formulation the effect period is assumed to be the duration that maximises the rate ratio estimate, so if the window is chosen after inspecting the data, the estimated effect can be inflated.

Source conditions do not replace independent scientific review or validation by an analysis engine.

Strengths

  • Self-matching removes confounding by time-invariant individual characteristics without requiring that they be measured, and by Maclure's account it also avoids control-selection bias and increases efficiency.
  • Because each case is its own control, the comparison is within-person, which is the defining feature of the design.
  • A prior on the log-OR can stabilise the estimate when events are rare, so that sampling noise does not dominate the result.
  • The posterior distribution allows probability statements about the exposure effect, such as the posterior probability that the OR exceeds one, within the conditional framework of the chosen referent design.

Applications

  • Estimating the acute effect of ambient air pollutants, such as PM2.5, ozone, or NO2, on hospitalisation for myocardial infarction or stroke.
  • Studying the short-term risk of road traffic injury associated with mobile phone use while driving.
  • Assessing medication-associated cardiac events in pharmacoepidemiology using electronic health records.
  • Examining the immediate effects of temperature extremes, such as heat waves or cold spells, on mortality or emergency admissions.
  • Multi-city environmental epidemiology studies that pool city-level estimates hierarchically.

How it works

How it works

1

For each individual who experiences the acute event, a hazard window is defined as a short interval immediately before onset. The time-varying exposure is measured or recorded within this window.

2

One or more control (referent) windows are selected for each case. Time-stratified selection, which uses fixed days of the same weekday within the same month, is the strategy that Janes, Sheppard and Lumley advocate, because it ensures unbiased conditional logistic regression estimates and avoids bias from a time trend in exposure. Bidirectional selection assumes no trend in exposure across the referent times, and this assumption can fail.

3

A prior distribution is placed on the log-OR of the exposure effect. An informative prior requires justification from prior evidence, and its influence should be checked. A weakly informative prior, such as Normal(0, 1) on the log-OR scale, is one illustrative choice that can limit extreme estimates when events are sparse. It is not a default to apply without checking it against prior evidence. Sensitivity to the prior should be reported.

4

The likelihood has the conditional logistic form given in the mechanics: for each case, the probability that the event falls in the hazard window rather than in a control window is modelled as a function of the exposure contrast. The product over cases gives L(beta), where beta is the log-OR of the exposure effect. The schematic formula leaves the risk set R_i implicit. In conditional logistic regression for this design, R_i is taken to consist of the case's hazard window together with its referent windows, and the exact definition should be confirmed against the cited sources before implementation.

Formula
L(\beta) = \prod_i \frac{\exp(\beta x_{i,case})}{\sum_{j \in R_i} \exp(\beta x_{ij})}
5

The posterior distribution p(beta | data) is proportional to the likelihood multiplied by the prior. Because the likelihood is conditional on the referent design, the posterior summarises the exposure effect only under that design. It is commonly computed by Markov chain Monte Carlo (MCMC) sampling, such as Hamiltonian Monte Carlo or Gibbs sampling. Integrated nested Laplace approximation (INLA) is an approximate alternative that may be faster for some models but adds approximation error.

Formula
p(\beta | data) \propto L(\beta) \cdot p(\beta)
6

Posterior summaries are reported, including the median, credible intervals, and the posterior probability that the OR exceeds one. These probability statements hold only under the chosen referent strategy and its assumptions, so the referent strategy should be reported with the results. Heterogeneity across strata or cities can be modelled hierarchically. MCMC convergence must be checked before summaries are reported, and prior sensitivity should be assessed by re-running under alternative priors.

Common pitfalls

  • Using bidirectional referents when exposure trends over the study period. Control-window exposures then differ systematically from hazard-window exposures for reasons unrelated to the event, which biases the estimate.
  • Treating the prior as a technical default rather than a scientific commitment. Informative priors need a stated source, and the effect of alternative priors should be reported.
  • Conflating the design with a standard case-control study. Because between-person differences are removed by self-matching, the OR should not be read as a population-level comparison between cases and controls.
  • Reporting posterior summaries without checking MCMC convergence, for example through R-hat statistics and trace plots.

Frequently asked questions

How is the Bayesian case-crossover different from the classical (frequentist) case-crossover?

The classical design estimates the exposure effect with conditional logistic regression and reports a point estimate with a frequentist confidence interval. The Bayesian version places a prior on the exposure effect and computes a posterior distribution. The Bayesian approach allows prior evidence to be included, provides probability statements about the effect, and can regularise estimates when events are sparse. Both versions use the same self-matched data structure and referent logic, so the probability statements hold only under the chosen referent strategy.

Which referent window strategy should I choose?

Janes, Sheppard and Lumley recommend the time-stratified strategy, which uses fixed days of the same weekday within the same month and year as referents. They state that this ensures unbiased conditional logistic regression estimates and avoids bias from a time trend in exposure. Bidirectional referents assume no trend in exposure across the referent times. Justify the chosen strategy in the methods section and consider a sensitivity analysis under an alternative strategy.

Can I use INLA instead of MCMC for Bayesian estimation?

INLA is an approximate method and may be faster than MCMC, which can matter for large or hierarchical models. Its approximation error should be acknowledged, and its suitability for a particular model should be checked against MCMC results on a subset of the data or a simpler model before it is relied upon.

What software is available for Bayesian case-crossover analysis?

Bayesian versions of conditional logistic models of this kind can be fitted with general-purpose MCMC software, and INLA is an approximate alternative. Classical conditional logistic models can be fitted in standard statistical software. Verify the model specification against the formula in the mechanics section and the cited conditional logistic reference before use, and report the software with version numbers.

Does the self-matched design control for all confounding?

It controls for time-stable confounders, such as age, sex, genetic factors, chronic conditions, and socioeconomic status, because these do not change between the hazard and control windows for the same individual. Time-varying confounders are controlled only if the referent selection is matched to them, as Janes, Sheppard and Lumley describe. Otherwise they must be addressed through design restrictions or sensitivity analyses.

Related methods

Sources

  1. Maclure, M. (1991). The case-crossover design: a method for studying transient effects on the risk of acute events. American Journal of Epidemiology, 133(2), 144–153.

    Open DOI reference
  2. Janes, H., Sheppard, L., & Lumley, T. (2005). Case-crossover analyses of air pollution exposure data: referent selection strategies and their implications for bias. Epidemiology, 16(6), 717–726.

    Open DOI reference