Skip to main content

    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.

    Engine version 1.0.0 · Reviewed 4 October 2026

    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

    nn
    Number of participants
    pp
    Outcome probability at the middle of follow-up
    ff
    Precision factor: the interval runs from OR / f to OR × f
    V(β)V(\beta)
    Per-participant variance of the log odds ratio per unit of time
    mm
    Measurements per participant, equally spaced over the follow-up
    TT
    Length of follow-up, in the time unit of the effect
    st2s_t^{2}
    Variance of the measurement times, T²(m + 1)/[12(m − 1)]
    ρ\rho
    Correlation between two measurements on the same participant
    z1−α/2z_{1-\alpha/2}
    Standard normal quantile for confidence 1 − α (1.960 for 95%)
    qq
    Non-response rate

    Formulas

    Small effects: a closed form

    n=⌈z1−α/22 (1−ρ)p(1−p) m st2 (ln⁡f)2⌉n = \left\lceil \frac{z_{1-\alpha/2}^{2}\,(1-\rho)}{p(1-p)\,m\,s_t^{2}\,(\ln f)^{2}} \right\rceil

    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

    V(β)=[(D⊤V−1D)−1]ββ,D=AX,V=A1/2R(ρ)A1/2V(\beta) = \left[(D^{\top} V^{-1} D)^{-1}\right]_{\beta\beta}, \qquad D = A X, \quad V = A^{1/2} R(\rho) A^{1/2}

    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

    napproach=⌈n1−q⌉n_{\text{approach}} = \left\lceil \frac{n}{1 - q} \right\rceil

    The number to approach so that n respond. Applied last, after any clustering.

    Parameters

    Confidence level1−α1-\alpha

    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 factorff

    Values: Above 1

    1.25 means the interval runs from OR / 1.25 to OR × 1.25.

    Outcome probability at the middle of follow-uppp

    Values: Between 0 and 1

    A probability near 0.5 carries the most information.

    Expected odds ratio per unit of timeOR\mathrm{OR}Optional

    Values: Above 0; empty for a small effect

    Leave empty to plan as if the change were small.

    Measurements per participantmm

    Values: A whole number of at least 2

    Including the first. More visits help, but less than a longer follow-up does.

    Follow-up lengthTT

    Values: Above 0

    In the unit the change is expressed in: a change per month needs the follow-up in months.

    Correlation between measurementsρ\rho

    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 rateqqOptional

    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 calculator

    Planning at the expected change

    Expecting an odds ratio of 1.3 per time unit: n = 39.

    Sample size: 39

    Open this example in the calculator

    Less correlated visits

    With ρ = 0.2 each participant’s trajectory is noisier: n = 59.

    Sample size: 59

    Open this example in the calculator

    Validation

    • 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. 1.Liu G, Liang KY. Sample size calculations for studies with correlated observations. Biometrics. 1997;53(3):937–947. doi:10.2307/2533554
    2. 2.Diggle PJ, Heagerty P, Liang KY, Zeger SL. Analysis of Longitudinal Data. 2nd ed. Oxford: Oxford University Press; 2002.