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.

1. Planning setup

Measurements are equally spaced, including baseline and the final visit.

Use the same time unit as the planned slope difference.

2. Information obtained from previous studies or pilot data

Outcome units per time unit.

3. Inputs decided by the researcher for the new study

Comparison-group slope minus reference-group slope, in outcome units per time unit. Negative values are accepted.

Enter a whole-number ratio from 1:1 to 10:1.

4. Results

Enter the longitudinal design assumptions and select Calculate.

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

  1. Diggle PJ, Heagerty P, Liang KY, Zeger SL. Analysis of Longitudinal Data. 2nd ed. Oxford University Press; 2002.
  2. 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/.