Method document
Sample size to estimate a change over time in repeated measurements
How many participants are needed to estimate the mean change per unit of time of a numerical outcome measured repeatedly in one group, from a linear mixed model or GEE, within a chosen margin. Assumes equally spaced visits and compound symmetry. Covers non-response.
https://statwisely.com/methods/precision-time-slope/
When to use it
- A cohort followed with repeated measurements, such as lung function each year, when the rate of change and its interval are the aim.
Not for
- Comparing rates of change between groups. Use the longitudinal slopes test.
- Unequal visit schedules, a correlation that fades with time, or much missing data; these need their own calculation or a simulation.
Notation
- Number of participants
- Standard deviation of the outcome at any one visit
- Margin of error, in outcome units 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
The slope’s variance under compound symmetry
A participant’s own level drops out of their slope, so only the within-person variance σ²(1 − ρ) is paid for, spread over the visits and their span [1]. This is the one-group form of the longitudinal slopes calculation.
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.
Margin of error
Values: Above 0, outcome units per time unit
Half the width of the interval wanted around the rate of change.
Standard deviation at one visit
Values: Above 0
Between participants at a single time point.
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; within a participant every pair of measurements correlates equally (compound symmetry); visits are equally spaced and the change is linear.
- Non-response is unrelated to the outcome.
Worked examples
Four yearly visits
SD 10, ρ = 0.6, 4 visits over 3 years, so s_t² = 1.25: n = 1.96² × 100 × 0.4 / (4 × 1.25 × 0.25) = 122.9, rounded up to 123.
Sample size: 123
Open this example in the calculatorMore visits over the same period
7 visits over the same 3 years: n = 88.
Sample size: 88
Open this example in the calculatorAllowing for dropout
Expecting 15% to drop out: 123 / 0.85 = 144.7, so 145 are enrolled.
Needed for analysis: 123 · To approach: 145
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.
- Fitting random-intercept models with nlme::lme in R to 1,000 simulated cohorts of 123 participants, four visits over three years, gave a median interval half-width of 0.4995 against a target of 0.5. An independent R evaluation of the formula reproduces the engine’s sizes.
How to cite
StatWisely. Sample size to estimate a change over time in repeated measurements. Method document, engine version 1.0.0, reviewed 2026-10-04. https://statwisely.com/methods/precision-time-slope/
Cite the original references for the formulas your design uses as well.
References
- 1.Diggle PJ, Heagerty P, Liang KY, Zeger SL. Analysis of Longitudinal Data. 2nd ed. Oxford: Oxford University Press; 2002.