Mixed Models and Longitudinal Data
Sample size for a two-group longitudinal study testing the treatment difference at the final visit with a fixed-slope repeated-measures mixed model. The calculation follows the published this method formulation from Ahn, Heo & Zhang (2015), including within-subject correlation and the number of repeated measurements.
This calculator implements the two-group, two-level longitudinal mixed model described by Ahn, Heo, and Zhang (2015) and used in the this method procedure Mixed Models Tests for Two Means at the End of Follow-Up in a 2-Level Hierarchical Design. Subjects are randomized to treatment or control and measured repeatedly over equally spaced time points. The estimand is the treatment difference at the final measurement.
The fixed-slope model can be written as a baseline intercept plus treatment, time, and treatment-by-time terms, with a subject-specific random intercept and measurement error. Time is rescaled so the final visit is zero; the treatment coefficient at that visit is therefore the final-visit mean difference.
For M equally spaced measurements, the variance of the rescaled time variable is V(S) = (M2 − 1)/12 and its mean is S̄ = −(M − 1)/2. The this method/Ahn formulation defines f = 1 + (M − 1)ρ and C(2) = 1 + (1 − ρ)/(CV(S)2f), where CV(S)2 = V(S)/S̄2.
The calculator searches over integer control-group sample sizes and applies the requested treatment:control allocation ratio. It reports the first allocation whose computed power is at least the target. If a dropout rate is entered, the analyzable sample size is calculated first and then inflated by 1/(1 − dropout), rounding each group up.
This yields a published validation example from Ahn, Heo, and Zhang (2015): power = 0.80, α = 0.05, final-visit mean difference = 0.4, SD = 1, within-subject correlation = 0.1, and M = 5. With equal allocation, the required sample size is 63 subjects per group (126 total), with achieved power 0.8013. This calculator reproduces that result.
Ahn, C., Heo, M., & Zhang, S. (2015). Sample Size Calculations for Clustered and Longitudinal Outcomes in Clinical Research. CRC Press, New York. the relevant methodological literature identifies this book, Chapter 5, Section 5.4.4, pages 165–167, as the source of the fixed-slope longitudinal mixed-model formulation.
the software, LLC. this method Sample Size Software: Mixed Models Tests for Two Means at the End of Follow-Up in a 2-Level Hierarchical Design, Chapter 372. This method uses the model, power formula, examples, and the Ahn, Heo & Zhang validation example.