Longitudinal Models · LMM-2G-M
Sample Size for Two-Group Linear Mixed Model: Difference in Mean Response
Plan a two-group Wald test of a clinically important average marginal mean difference across repeated follow-up measurements of a continuous 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 randomized rehabilitation study measures functional status at baseline and at three follow-up visits. Investigators want to detect a clinically important difference between programmes in functional scores averaged across the follow-up period, rather than a difference in slopes or only at the final visit.
Formula and methodological note
The model represents visit-specific marginal means and a comparison-minus-reference contrast at each follow-up. The primary estimand is the equally weighted average of those follow-up contrasts. With participant covariance V = ZGZ′ + R, group-specific generalized least-squares information matrices are combined at the planned allocation ratio. The variance of the average contrast is c′(X′V⁻¹X)⁻¹c. Exact whole-number allocation multiples are searched until normal-theory Wald power reaches the target.
When baseline is included, the model constrains randomized groups to a common baseline mean and uses baseline covariance for adjustment; baseline receives zero weight. The method assumes a continuous outcome, common equally spaced visits, independent participants, common covariance, and credible variance components. Dropout is recruitment inflation only. It excludes partial or informative missingness, irregular visits, custom weights, clusters, crossed effects, and 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.
- Statsmodels developers. NormalIndPower documentation.
Suggested citation
Yaacob, Najib Majdi. “Sample Size for Two-Group Linear Mixed Model: Difference in Mean Response (LMM-2G-M).” Web calculator. NajibMY, 2026. Accessed August 1, 2026. https://najibmy.netlify.app/tools/sample-size/clinical-complex-study-designs/linear-mixed-model-difference-in-mean-response/.