Description Usage Arguments Value Examples
Calculation of power for a lmm with cluster as random effect, fixed timepoint effects, but set to null, TP number of timepoints, I number of cluster. The design matrix has to be coded by zeros and ones.
1 2 3 |
ThetaEst |
expected treatment effect |
alpha |
singificance level (by default 0.05) |
Design |
design matrix for a given SWD model |
sigmaq |
within cluster variance(between subject variance) |
tauq |
between cluster variance |
sigmaq.error |
within subject variance/error variance |
noSub |
number of subjects within each cluster and each timepoint (for all an equal size) |
time |
a logical (FALSE, if no time trends are expected, otherwise TRUE) is only relevant for evaluation of cross-sectional data |
type |
is of cross-sectional (by default) or longitudinal assigns the type of data (2 or 3 level nested structure) |
Aproximated power of two tailed test, although the design matrix is fractionated, then power is not valid formula used for cross-sectional data provided by Michael A. Hussey and James P. Hughes, Design and analysis of stepped wedge cluster randomized trials, Contemporary Clinical Trials(28),2007, and for longitudinal data by Heo M., Kim N., Rinke ML., Wylie-Rosett J., Sample size determinations for stepped-wedge clinical trials from a three-level data hierarchy perspective, Stat Methods Med Res., 2016
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | noCl<-10
noT<-6
switches<-2
DM<-designMatrix(noCl,noT,switches)
sigma.e <- 2
sigma.alpha <- 2
#Power for cross-sectional SWD design by formula of Hussey&Hughes
calcPower.SWD(ThetaEst=1,Design=DM, sigmaq=sigma.e^2, tauq=sigma.alpha^2, time=FALSE)
calcPower.SWD(ThetaEst=1,Design=DM, sigmaq=sigma.e^2, tauq=sigma.alpha^2, time=TRUE)
#Power for longitudinal SWD design by formula of Heo&Kim
DM.new<-NULL
for(i in 1:dim(DM)[2]){
DM.new<-cbind(DM.new,DM[,i], DM[,i])
}
s.e <- sqrt(7/10)
s <- sqrt(2/10)
s.a <- sqrt(1/10 )
K<- 10 #number of participants within each 'cell'
calcPower.SWD(ThetaEst=1, Design=DM.new, s.a^2, s^2, s.e^2, noSub=K, type="longitudinal")
|
[1] 0.9894964
[1] 0.204382
numeric(0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.