Mixed Models and Longitudinal Data
Calculate the number of subjects needed to detect a difference in rates of change between two treatment groups using a two-level longitudinal fixed-slope mixed model. The calculation tests the time-by-treatment interaction while accounting for repeated measurements within subjects.
This calculator implements the fixed-slope two-level longitudinal mixed model described in the this method procedure Mixed Models Tests for the Slope Difference in a 2-Level Hierarchical Design with Fixed Slopes. Subjects are randomly assigned to two groups and measured repeatedly over time. The parameter of interest is the treatment-by-time interaction, which represents the difference between the two groups' slopes.
This calculator uses the model
Here, X indicates treatment group, T is time, and δ is the treatment-by-time effect. Thus, δ is the difference between the two treatment slopes. The calculation assumes a common fixed slope within each treatment group rather than a separate random slope for every subject.
For equally spaced measurements, this method defines V(T) as the average squared deviation of the measurement times from their mean:
Let K1 and K2 denote the numbers of subjects in Groups 1 and 2 and let λ = K1/K2. The this method normal-approximation power calculation is
The calculator searches over integer Group 1 sample sizes and selects the smallest value for which the computed power is at least the target. For a specified allocation ratio, Group 2 is set to the smallest integer satisfying the requested ratio.
The implementation was checked against the Published worked example example from Ahn, Heo, and Zhang (2015). With power = 0.80, α = 0.05, M = 5, δ = 0.4, σ = 4, and ρ = 0.1, the expected result is 142 subjects in each group. The implemented calculation gives a power of approximately 0.80199 at K1 = K2 = 142.
A second this method example was also reproduced: with M = 4, δ = 3, σ = 9.2, ρ = 0.5, α = 0.05, and target power = 0.90, the required balanced sample size is 20 subjects per group, with achieved power approximately 0.90335.
Ahn, C., Heo, M., & Zhang, S. (2015). Sample Size Calculations for Clustered and Longitudinal Outcomes in Clinical Research. CRC Press, New York.
the software, LLC. this method Sample Size Software: Mixed Models Tests for the Slope Difference in a 2-Level Hierarchical Design with Fixed Slopes, Chapter 384. the relevant methodological literature, including technical details, worked examples, and validation against Ahn, Heo, and Zhang (2015).