getDesignRepeatedANOVA {lrstat} | R Documentation |
Power and sample size for repeated-measures ANOVA
Description
Obtains the power and sample size for one-way repeated measures analysis of variance. Each subject takes all treatments in the longitudinal study.
Usage
getDesignRepeatedANOVA(
beta = NA_real_,
n = NA_real_,
ngroups = 2,
means = NA_real_,
stDev = 1,
corr = 0,
rounding = TRUE,
alpha = 0.05
)
Arguments
beta |
The type II error. |
n |
The total sample size. |
ngroups |
The number of treatment groups. |
means |
The treatment group means. |
stDev |
The total standard deviation. |
corr |
The correlation among the repeated measures. |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The two-sided significance level. Defaults to 0.05. |
Details
Let denote the measurement under treatment condition
for subject
. Then
where
denotes the subject random effect,
and
denotes the within-subject
residual. If we set
, then
is the
mean of the last treatment (control), and
is the
difference in means between the
th treatment and the control
for
.
The repeated measures have a compound symmetry covariance structure.
Let , and
. Then
.
Let
denote the design matrix for subject
.
Let
.
It follows that
It can be shown that
It follows that
where the noncentrality parameter for
the
distribution is
Value
An S3 class designRepeatedANOVA
object with the
following components:
-
power
: The power to reject the null hypothesis that there is no difference among the treatment groups. -
alpha
: The two-sided significance level. -
n
: The number of subjects. -
ngroups
: The number of treatment groups. -
means
: The treatment group means. -
stDev
: The total standard deviation. -
corr
: The correlation among the repeated measures. -
effectsize
: The effect size. -
rounding
: Whether to round up sample size.
Author(s)
Kaifeng Lu, kaifenglu@gmail.com
Examples
(design1 <- getDesignRepeatedANOVA(
beta = 0.1, ngroups = 4, means = c(1.5, 2.5, 2, 0),
stDev = 5, corr = 0.2, alpha = 0.05))