50% off: Unlimited data and AI learning.
The Learning Leader's Guide to AI Literacy

powerMediation (version 0.3.4)

ssLong: Sample size calculation for longitudinal study with 2 time point

Description

Sample size calculation for testing if mean changes for 2 groups are the same or not for longitudinal study with 2 time point.

Usage

ssLong(es, 
       rho = 0.5, 
       alpha = 0.05, 
       power = 0.8)

Arguments

es

effect size of the difference of mean change.

rho

correlation coefficient between baseline and follow-up values within a treatment group.

alpha

Type I error rate.

power

power for testing for difference of mean changes.

Value

required sample size per group

Details

The sample size formula is based on Equation 8.30 on page 335 of Rosner (2006). n=2σd2(Z1α/2+Zpower)2δ2 where σd=σ12+σ222ρσ1σ2, δ=|μ1μ2|, μ1 is the mean change over time t in group 1, μ2 is the mean change over time t in group 2, σ12 is the variance of baseline values within a treatment group, σ22 is the variance of follow-up values within a treatment group, ρ is the correlation coefficient between baseline and follow-up values within a treatment group, and Zu is the u-th percentile of the standard normal distribution.

We wish to test μ1=μ2.

When σ1=σ2=σ, then formula reduces to n=4(1ρ)(Z1α/2+Zβ)2d2 where d=δ/σ.

References

Rosner, B. Fundamentals of Biostatistics. Sixth edition. Thomson Brooks/Cole. 2006.

See Also

ssLongFull, powerLong, powerLongFull.

Examples

Run this code
# NOT RUN {
    # Example 8.33 on page 336 of Rosner (2006)
    # n=85
    ssLong(es=5/15, rho=0.7, alpha=0.05, power=0.8)
# }

Run the code above in your browser using DataLab