Description Usage Arguments Details Value Note Author(s) References See Also Examples
View source: R/powerLongitudinal.R
Power calculation for testing if mean changes for 2 groups are the same or not for longitudinal study with 2 time point.
1 2 3 4 | powerLong(es,
n,
rho = 0.5,
alpha = 0.05)
|
es |
effect size of the difference of mean change. |
n |
sample size per group. |
rho |
correlation coefficient between baseline and follow-up values within a treatment group. |
alpha |
Type I error rate. |
The power formula is based on Equation 8.31 on page 336 of Rosner (2006).
power=Φ≤ft(-Z_{1-α/2}+\frac{δ√{n}}{σ_d √{2}}\right)
where σ_d = σ_1^2+σ_2^2-2ρσ_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, σ_1^2 is the variance of baseline values within a treatment group, σ_2^2 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 Z_u is the u-th percentile of the standard normal distribution.
We wish to test μ_1 = μ_2.
When σ_1=σ_2=σ, then formula reduces to
power=Φ≤ft(-Z_{1-α/2} + \frac{|d|√{n}}{2√{1-ρ}}\right)
where d=δ/σ.
power for testing for difference of mean changes.
The test is a two-sided test. For one-sided tests, please double the
significance level. For example, you can set alpha=0.10
to obtain one-sided test at 5% significance level.
Weiliang Qiu stwxq@channing.harvard.edu
Rosner, B. Fundamentals of Biostatistics. Sixth edition. Thomson Brooks/Cole. 2006.
ssLong
, ssLongFull
,
powerLongFull
.
1 2 3 | # Example 8.34 on page 336 of Rosner (2006)
# power=0.75
powerLong(es=5/15, n=75, rho=0.7, alpha=0.05)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.