View source: R/getDesignMeans.R
getDesignMeanDiffCarryover | R Documentation |
Obtains the power and sample size for direct treatment effects in crossover trials accounting for carryover effects.
getDesignMeanDiffCarryover(
beta = NA_real_,
n = NA_real_,
meanDiffH0 = 0,
meanDiff = 0.5,
stDev = 1,
corr = 0.5,
design = NA_real_,
cumdrop = NA_real_,
allocationRatioPlanned = NA_real_,
normalApproximation = FALSE,
rounding = TRUE,
alpha = 0.025
)
beta |
The type II error. |
n |
The total sample size. |
meanDiffH0 |
The mean difference at the last time point under the null hypothesis. Defaults to 0. |
meanDiff |
The mean difference at the last time point under the alternative hypothesis. |
stDev |
The standard deviation for within-subject random error. |
corr |
The intra-subject correlation due to subject random effect. |
design |
The crossover design represented by a matrix with rows indexing the sequences, columns indexing the periods, and matrix entries indicating the treatments. |
cumdrop |
The cumulative dropout rate over periods. |
allocationRatioPlanned |
Allocation ratio for the sequences. Defaults to equal randomization if not provided. |
normalApproximation |
The type of computation of the p-values.
If |
rounding |
Whether to round up sample size. Defaults to 1 for sample size rounding. |
alpha |
The one-sided significance level. Defaults to 0.025. |
The linear mixed-effects model to assess the direct treatment effect in the presence of carryover treatment effect is given by
y_{ijk} = \mu + \alpha_i + b_{ij} + \gamma_k + \tau_{d(i,k)}
+ \lambda_{c(i,k-1)} + e_{ijk},
i=1,\ldots,n; j=1,\ldots,r_i; k = 1,\ldots,p; d,c = 1,\ldots,t,
where \mu
is the general mean, \alpha_i
is the effect of
the i
th treatment sequence, b_{ij}
is the random effect
with variance \sigma_b^2
for the j
the subject of the
i
th treatment sequence, \gamma_k
is the period effect,
and e_{ijk}
is the random error with variance \sigma^2
for the subject in period k
. The direct effect of the treatment
administered in period k
of sequence i
is
\tau_{d(i,k)}
, and \lambda_{c(i,k-1)}
is the carryover
effect of the treatment administered in period k-1
of sequence
i
. The value of the carryover effect for the observed
response in the first period is \lambda_{c(i,0)} = 0
since
there is no carryover effect in the first period. The intra-subject
correlation due to the subject random effect is
\rho = \frac{\sigma_b^2}{\sigma_b^2 + sigma^2}.
By constructing the design matrix X
for the linear model with
a compound symmetry covariance matrix for the response vector of
a subject, we can obtain
Var(\hat{\beta}) = (X'V^{-1}X)^{-1}.
The covariance matrix for the direct treatment effects and the carryover treatment effects can be extracted from the appropriate sub-matrices. The covariance matrix for the direct treatment effects without accounting for the carryover treatment effects can be obtained by omitting the carryover effect terms from the model.
The power and relative efficiency are for the direct treatment effect comparing the first treatment to the last treatment accounting for carryover effects.
The degrees of freedom for the t-test can be calculated as the
total number of observations minus the number of subjects minus
p-1
minus 2(t-1)
to account for the subject effect,
period effect, and direct and carryover treatment effects.
An S3 class designMeanDiffCarryover
object with the
following components:
power
: The power to reject the null hypothesis.
alpha
: The one-sided significance level.
numberOfSubjects
: The maximum number of subjects.
meanDiffH0
: The mean difference under the null hypothesis.
meanDiff
: The mean difference under the alternative
hypothesis.
stDev
: The standard deviation for within-subject random error.
corr
: The intra-subject correlation due to subject random effect.
design
: The crossover design represented by a matrix with
rows indexing the sequences, columns indexing the periods, and
matrix entries indicating the treatments.
nseq
: The number of sequences.
nprd
: The number of periods.
ntrt
: The number of treatments.
cumdrop
: The cumulative dropout rate over periods.
V_direct_only
: The covariance matrix for direct treatment
effects without accounting for carryover effects.
V_direct_carry
: The covariance matrix for direct and
carryover treatment effects.
v_direct_only
: The variance of direct treatment effects
without accounting for carryover effects.
v_direct
: The variance of direct treatment effects
accounting for carryover effects.
v_carry
: The variance of carryover treatment effects.
releff_direct
: The relative efficiency of the design
for estimating direct treatment effects after accounting
for carryover effects with respect to that without
accounting for carryover effects. This is equal to
v_direct_only/v_direct
.
releff_carry
: The relative efficiency of the design
for estimating carryover effects. This is equal to
v_direct_only/v_carry
.
allocationRatioPlanned
: Allocation ratio for the sequences.
normalApproximation
: The type of computation of the p-values.
If TRUE
, the variance is assumed to be known, otherwise
the calculations are performed with the t distribution.
rounding
: Whether to round up sample size.
Kaifeng Lu, kaifenglu@gmail.com
Robert O. Kuehl. Design of Experiments: Statistical Principles of Research Design and Analysis. Brooks/Cole: Pacific Grove, CA. 2000.
# Williams design for 4 treatments
(design1 = getDesignMeanDiffCarryover(
beta = 0.2, n = NA,
meanDiff = 0.5, stDev = 1,
design = matrix(c(1, 4, 2, 3,
2, 1, 3, 4,
3, 2, 4, 1,
4, 3, 1, 2),
4, 4, byrow = TRUE),
alpha = 0.025))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.