Method document
Sample size for repeated measures: comparing average levels across follow-up
How many participants are needed in each of two groups to show that their average levels differ, when each participant is measured several times and their measurements are averaged. Covers unequal groups, one- or two-sided tests and dropout.
https://statwisely.com/methods/longitudinal-mean-level/
When to use it
- An outcome measured repeatedly to reduce noise, such as blood pressure at several visits, compared between groups.
Not for
- Questions about change over time. Use the rates of change.
Notation
- Participants in groups 1 and 2
- Measurements per participant
- Standard deviation of a single measurement
- Correlation between any two measurements on a participant
- Difference to detect between the groups
- Allocation ratio n₂ / n₁
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Number of tails: 2 for a two-sided test, 1 for one-sided
- Expected dropout
Formulas
Variance of the difference in average levels
Averaging M correlated measurements reduces the variance by the factor [1 + (M − 1)ρ]/M, which is never above 1: measuring repeatedly is never worse than measuring once. The more strongly the measurements are correlated, the less each extra one adds [1]. n₁ is solved on the noncentral t distribution.
Dropout
Applied last, to the participants actually recruited.
Parameters
Difference in average level
Values: Not zero
The difference between the groups’ average levels over the follow-up.
Standard deviation
Values: Above 0
Of a single measurement, from previous data.
Measurements per participant
Values: At least 1
Planned visits, equally spaced.
Correlation between measurements
Values: At least 0 and below 1
How strongly a participant’s measurements track each other, from previous data.
Allocation ratioOptional
Values: Above 0; 1 for equal groups
The planned size of group 2 divided by group 1.
Significance level
Values: Between 0 and 1; usually 0.05
The false-positive rate you accept. A smaller α, for example to allow for several primary outcomes, needs a larger sample.
Power
Values: Between 0 and 1; usually 0.80 or 0.90
The chance of a significant result if the assumed effect is real. Funders and ethics committees commonly expect at least 0.80.
One- or two-sided
Values: 2 (two-sided) or 1 (one-sided)
Two-sided is the default. A one-sided test is justified only when an effect in the other direction would be treated exactly as no effect, and should be stated in advance.
Expected dropoutOptional
Values: 0% up to, but not including, 100%
The share of participants expected to provide no outcome, from comparable studies. Recruiting more restores the numbers, not the comparability of the groups: if dropout is related to the outcome, the estimate can still be biased.
Assumptions
- Compound symmetry: every pair of measurements on a participant is equally correlated. Other covariance structures, such as correlation that fades with time, can change power in either direction.
- Every participant completes every visit; dropout is allowed for by recruiting more, not by modelling partial data.
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
Five measurements each
A difference of 1 with SD 2, 5 measurements correlated 0.5: the factor is (1 + 4 × 0.5) / 5 = 0.6, so 39 per group, against 64 with a single measurement.
Group 1: 39 · Group 2: 39 · Total: 78
Open this example in the calculatorProtocol statement
To detect a difference of 1 with 80% power at a two-sided significance level of 0.05, using a comparison of average levels over 5 measurements per participant, and assuming a standard deviation of 2 and a correlation of 0.5 between measurements, the required sample size is 39 per group (78 in total). Calculated with StatWisely (statwisely.com) using: n₁: Var(Δmean)=σ²[1+(m-1)r]/m × (1/n₁+1/n₂), solved on noncentral t. These are planning estimates; confirm the final design with a qualified statistician.
More strongly correlated measurements
With a correlation of 0.8 the factor is 0.8400000000000001: 54 per group. Repetition helps less when measurements agree.
Group 1: 54 · Group 2: 54 · Total: 108
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.
- An independent implementation in R recomputes this test every night and before each production release, and the results are compared with the engine’s.
How to cite
StatWisely. Sample size for repeated measures: comparing average levels across follow-up. Method document, engine version 1.0.0, reviewed 2026-10-01. https://statwisely.com/methods/longitudinal-mean-level/
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.