Ask Mallard
Analysis method

Andersen-Gill and Lin-Wei-Yang-Ying recurrent-event models

5 min read

Andersen-Gill and LWYY use repeated events, but distinguish effects on a history-specific event intensity from effects on a marginal event rate.

Fit

When to use it, and when not to

Use it when

  • People can have the same event repeatedly and you know event dates and periods at risk.
  • Your question concerns all events, with the intensity or mean-rate interpretation fixed before analysis.

Not when

Before you start

What you need

Decide these first
  1. Repeat-event definition and datesDefine distinct events and when a person can return to risk.
  2. Intensity or marginal ratesummaryMeasurerepeatedMeasuresState which interpretation and covariate history the model uses.
  3. Censoring and terminal eventscompetingEventsRecord follow-up end, death and periods when events cannot occur.
It rests on these
  1. The chosen proportional model fits the question.How to check: Andersen-Gill models intensity given history. LWYY models the marginal mean or rate; proportionality concerns that chosen target.
  2. Independent people provide the units of uncertainty.How to check: Use patient-level robust variance. Many events in a few people do not supply many independent units.
  3. Follow-up loss is noninformative under the model’s conditions.How to check: A robust variance does not remove informative dropout. Death stops future events and requires an explicit estimand and suitable analysis.
  4. Choose a missing-data method because of a stated assumption.How to check: Missing completely at random (MCAR) means gaps depend on neither observed nor unseen data. Missing at random (MAR) means recorded data explain gaps. Under MAR, suitable multiple imputation may help; it is not inherently better. Missing not at random (MNAR) means unseen values still predict gaps. Under plausible MNAR, add a delta or tipping-point sensitivity analysis. Dropping people with missing exposure can cause selection bias.

Plain language

How it works

Split follow-up at each event and at changes in covariates. Record each interval’s start, stop and event indicator. People can return to risk after an event. Keep one patient identifier across all intervals.

Choose what the same fit means

Andersen-Gill specifies event intensity conditional on the modeled history. Lin-Wei-Yang-Ying (LWYY) specifies a marginal mean or rate model with patient-robust variance. Under matching covariates and risk processes, the fits can share estimating equations. Their interpretations and assumptions still differ. Robust variance allows linked events within a person; it does not guarantee either interpretation. Check proportionality and state how death is handled.

Repeated intervals keep the same patient
Keep the same person across recurrent-event intervals. An event may be followed by another at-risk interval. Follow-up ends at censoring or a terminal event.Keep the same person across recurrent-event intervalsEnter follow-upAt risk until first eventReturn to risk for later eventsKeep later events and the same person identifierEnd follow-up: censoring or terminal eventSpecify intensity or marginal rate. Robust variance handles linked records, not informative terminalevents.
Conceptual diagram. It shows the structure of the idea, not data from any study.

Worked example

A worked example

Invented for illustration
Setting
One patient has recurrent admissions during follow-up.
Question
How is follow-up represented without discarding later admissions?
Approach
Admissions occur at months 2 and 5. Follow-up ends at month 8, with no further admission.
Result
Intervals run from 0 to 2, 2 to 5, and 5 to 8 months. Durations are 2, 3 and 3 months: 8 total.
What it means
There are 2 events in 8 person-months, a crude rate of 0.25 per person-month. This is not an adjusted model effect.

In practice

Recent studies PubMed search · not vetted

Searching PubMed…

Watch out

Common mistakes

The one to remember

Andersen-Gill intensity and LWYY marginal rate interpretations require different assumptions, even when fitted coefficients coincide. Robust variance handles within-person dependence, not informative death or a wrong effect model.

  • Calling a recurrent-event rate ratio a risk ratio.Instead: Name the modeled intensity or marginal rate and report the chosen follow-up horizon.
  • Assuming robust errors make an intensity model correct.Instead: Robust errors change uncertainty, not the fitted mean or intensity assumptions.
  • Treating death as routine independent censoring.Instead: Specify how death enters the question and report deaths alongside recurrence.

Inside Mallard

How Mallard uses this

Learn search lists Andersen-Gill and Lin-Wei-Yang-Ying recurrent-event models. The method registry links this method to its single-method article and code.

Code example in Mallard: Andersen-Gill model for recurrent events (andersen-gill-recurrent-events).
Atlas node analysis.andersen_gill_lwyy, the id a plan cue records.
Code for this method
Loading…

Related Learn pages

Related designs and methods

Evidence

Sources & further reading

  1. Cox’s regression model for counting processes: a large sample study (opens in a new tab) · Ann Stat
  2. Semiparametric regression for the mean and rate functions of recurrent events (opens in a new tab) · J R Stat Soc Series B Stat Methodol
  3. Modelling recurrent events: a tutorial for analysis in epidemiology (opens in a new tab) · Int J Epidemiol · doi 10.1093/ije/dyu222
  4. Recurrent disability progression endpoints in multiple sclerosis clinical trials (opens in a new tab) · Mult Scler · doi 10.1177/13524585221125382
Prepared with AI assistance for the owner-approved one-method wave 1. Indexed sources were checked by PMID, title, authors, year and DOI against PubMed on 2026-11-06. Record verification is not methodological approval. Andersen-Gill and LWYY originals are non-indexed statistics-journal sources, with no guessed PMID. Amorim and Cai explain risk processes and interpretations. Bühler and colleagues apply marginal recurrence methods to trial data.
Last source review: 2026-11-06
AI-generated educational content
Mallard uses reputable methodological and reporting sources, but this material may contain errors or omit important context. Verify important methodological decisions with the cited sources and, when appropriate, a qualified research methodologist or statistician.