Learn R Programming

powerMediation (version 0.3.4)

ssLongFull: 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

ssLongFull(delta, 
           sigma1, 
           sigma2, 
           rho = 0.5, 
           alpha = 0.05, 
           power = 0.8)

Arguments

delta

absolute difference of the mean changes between the two groups: \(\delta=|\mu_1 - \mu_2|\) where \(\mu_1\) is the mean change over time \(t\) in group 1, \(\mu_2\) is the mean change over time \(t\) in group 2.

sigma1

the standard deviation of baseline values within a treatment group

sigma2

the standard deviation of follow-up values within a treatment group

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=\frac{2\sigma_d^2 (Z_{1-\alpha/2} + Z_{power})^2}{\delta^2} $$ where \(\sigma_d = \sigma_1^2+\sigma_2^2-2\rho\sigma_1\sigma_2\), \(\delta=|\mu_1 - \mu_2|\), \(\mu_1\) is the mean change over time \(t\) in group 1, \(\mu_2\) is the mean change over time \(t\) in group 2, \(\sigma_1^2\) is the variance of baseline values within a treatment group, \(\sigma_2^2\) is the variance of follow-up values within a treatment group, \(\rho\) is the correlation coefficient between baseline and follow-up values within a treatment group, and \(Z_u\) is the u-th percentile of the standard normal distribution.

We wish to test \(\mu_1 = \mu_2\).

References

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

See Also

ssLong, powerLong, powerLongFull.

Examples

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

Run the code above in your browser using DataLab