Statistical Calculators › Mixed Models and Longitudinal Data › Sample Size for Rate of Change (Slope) Comparison
← All Calculators

Mixed Models and Longitudinal Data

Sample Size for Rate of Change (Slope) Comparison

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.

Study Design

Enter the expected slope difference, repeated-measure structure, variability, correlation, and desired power.
Absolute difference between the two group rates of change.
Correlation among repeated measurements from the same subject.
Equally spaced measurement occasions.
A value of 1.00 gives equal allocation. Group 2 is rounded up to preserve at least the requested allocation ratio.

Sample Size Result

Finds the smallest integer number of Group 1 subjects whose corresponding Group 2 allocation achieves the requested power.
Enter the study assumptions and click Calculate Sample Size.

Methodology

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.

Longitudinal Model

This calculator uses the model

Yij = β0 + ξXi + τTij + δXiTij + ui + eij

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.

Power Formula

For equally spaced measurements, this method defines V(T) as the average squared deviation of the measurement times from their mean:

V(T) = Σ(Tj - T̄)2 / M
Tj = j - 1,   j = 1,.., M

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

Power = Φ[ (δ/σ) √{ K2M V(T) / [(1 + λ-1)(1 - ρ)] } - Φ-1(1 - α/2) ]

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.

Interpretation of the Inputs

Validation

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.

References

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).