Longitudinal Models · LMM-2G-S
Sample Size for Two-Group Linear Mixed Model: Difference in Slopes
Plan a two-group Wald test of a clinically important difference in mean linear rates of change for a continuous repeated outcome.
4. Results
Enter the longitudinal design assumptions and select Calculate.
Suggested sample-size wording
Warnings
Formula, assumptions, limitations, and methodological note
Example clinical scenario
A chronic kidney disease study measures eGFR at baseline and every six months for two years. The primary hypothesis is that the treatment group has a slower mean annual decline than the reference group, while participant-specific baseline eGFR and rates of change are represented by random effects.
Formula and methodological note
The model includes fixed group, linear time, and group-by-time terms. For visit design X and participant covariance V=ZGZáµ€+R, the per-participant slope-information variance is the slope diagonal of (Xáµ€Vâ»Â¹X)â»Â¹. The variance of the two-group slope difference is this value multiplied by (1/n reference + 1/n comparison). Exact whole-number allocation multiples are searched until normal-theory Wald power reaches the target.
The method assumes a continuous outcome, equally spaced common visits, linear mean trajectories, independent participants, common correctly specified covariance across groups, and credible population variance components. Dropout is recruitment inflation only; partially observed or informative missingness is not modelled. It is not for categorical-time contrasts, nonlinear trajectories, target-visit MMRM effects, more than two groups, cluster randomization, crossed effects, or non-Gaussian outcomes. This tool supports research planning and does not replace statistical consultation.
Technical results
Method references
- Diggle PJ, Heagerty P, Liang KY, Zeger SL. Analysis of Longitudinal Data. 2nd ed. Oxford University Press; 2002.
- Donohue MC, Edland SD. Longitudinal power calculations in the R package longpower. R package documentation.
Suggested citation
Yaacob, Najib Majdi. “Sample Size for Two-Group Linear Mixed Model: Difference in Slopes (LMM-2G-S).” Web calculator. NajibMY, 2026. Accessed August 1, 2026. https://najibmy.netlify.app/tools/sample-size/clinical-complex-study-designs/linear-mixed-model-difference-in-slopes/.