Method document
Sample size to estimate a change over time in a repeated binary outcome
How many participants are needed to estimate the population-average odds ratio per unit of time of a binary outcome measured repeatedly in one group, from logistic GEE with an exchangeable correlation, within a chosen factor. Covers non-response.
https://statwisely.com/methods/precision-time-odds-ratio/
When to use it
- A cohort in which a yes/no outcome, such as being symptom-free, is recorded at each visit, when the change in its odds over time is to be estimated.
Not for
- Participant-specific (conditional) effects from a mixed model, which are larger than population-average ones and need their own planning.
- Unequal schedules or a correlation that fades with time; these need a simulation.
Notation
- Number of participants
- Outcome probability at the middle of follow-up
- Precision factor: the interval runs from OR / f to OR × f
- Per-participant variance of the log odds ratio per unit of time
- Measurements per participant, equally spaced over the follow-up
- Length of follow-up, in the time unit of the effect
- Variance of the measurement times, T²(m + 1)/[12(m − 1)]
- Correlation between two measurements on the same participant
- Standard normal quantile for confidence 1 − α (1.960 for 95%)
- Non-response rate
Formulas
Small effects: a closed form
With no change over time the GEE slope has variance (1 − ρ)/[p(1 − p) m s_t²]: the binary analogue of the numerical slope [2].
At an expected odds ratio
Given the expected odds ratio per unit of time, the model-based GEE variance is computed over the schedule with A = diag(μ(1 − μ)) at each visit and an exchangeable working correlation taken to be the true one [1].
Non-response
The number to approach so that n respond. Applied last, after any clustering.
Parameters
Confidence level
Values: 90%, 95% or 99%
95% is the convention in health research. A higher level widens the interval, so the same margin needs a larger sample.
Precision factor
Values: Above 1
1.25 means the interval runs from OR / 1.25 to OR × 1.25.
Outcome probability at the middle of follow-up
Values: Between 0 and 1
A probability near 0.5 carries the most information.
Expected odds ratio per unit of timeOptional
Values: Above 0; empty for a small effect
Leave empty to plan as if the change were small.
Measurements per participant
Values: A whole number of at least 2
Including the first. More visits help, but less than a longer follow-up does.
Follow-up length
Values: Above 0
In the unit the change is expressed in: a change per month needs the follow-up in months.
Correlation between measurements
Values: At least 0 and below 1
From a previous study of the same outcome. A higher correlation means each participant’s own trajectory is clearer, so fewer are needed.
Expected non-response rateOptional
Values: 0% up to, but not including, 100%
The share of people approached who will not take part; use the response rate of a comparable study. Approaching more people restores the number of respondents, not their representativeness: if non-responders differ, the estimate can still be biased.
Assumptions
- Participants are independent; a participant’s measurements share one correlation on the binary scale (exchangeable); visits are equally spaced and the log odds change linearly with time.
- Non-response is unrelated to the outcome.
Worked examples
Four visits, small change
p = 0.3, ρ = 0.5, 4 visits over 3 time units, factor 1.25: n = 1.96² × 0.5 / (0.21 × 4 × 1.25 × 0.0498) = 36.7, rounded up to 37.
Sample size: 37
Open this example in the calculatorPlanning at the expected change
Expecting an odds ratio of 1.3 per time unit: n = 39.
Sample size: 39
Open this example in the calculatorLess correlated visits
With ρ = 0.2 each participant’s trajectory is noisier: n = 59.
Sample size: 59
Open this example in the calculatorValidation
- Every worked example on this page is recomputed by the StatWisely engine whenever the software is built. If a number or formula here stopped matching the calculator, the release would be stopped until this document was corrected.
- In R, geepack::geeglm with an exchangeable working correlation, fitted to 1,000 simulated cohorts at each planned size, gave median interval factors of 1.249 at no change (exactly exchangeable binaries) and 1.252 at an odds ratio of 1.3 per time unit (a calibrated Gaussian copula), against a target of 1.25. An independent R computation of the GEE variance reproduces the engine’s sizes.
How to cite
StatWisely. Sample size to estimate a change over time in a repeated binary outcome. Method document, engine version 1.0.0, reviewed 2026-10-04. https://statwisely.com/methods/precision-time-odds-ratio/
Cite the original references for the formulas your design uses as well.
References
- 1.Liu G, Liang KY. Sample size calculations for studies with correlated observations. Biometrics. 1997;53(3):937–947. doi:10.2307/2533554
- 2.Diggle PJ, Heagerty P, Liang KY, Zeger SL. Analysis of Longitudinal Data. 2nd ed. Oxford: Oxford University Press; 2002.