These functions are designed to be used by the power.sim.XXX functions as the functions which estimate the treatment effect. They fit simple fixed and random effects models and return the estimated treatment effect. These functions are not designed to be called directly by the user.
fixed.effect(dat, incl.period.effect, outcome.type, alpha)fixed.effect.cluster.level(dat, incl.period.effect, outcome.type, alpha)
random.effect(dat, incl.period.effect, outcome.type, alpha)
weighted.crossover.cluster.level(dat, incl.period.effect, outcome.type, alpha)
observed data as a data.frame with columns named, "y", "trt" and "clust". "per" column is optional if period.var==0.
indicator of whether to include a period effect
one of "gaussian", "binomial", "poisson"
the type I error rate
A numeric vector with the following three elements, in order: [1] a point estimate for the treatment effect, [2] lower bound of (1-alpha) confidence interval, [3] lower bound of (1-alpha) confidence interval.
random.effect()
relies on a call to glmer()
from the lme4
package. fixed.effect()
relies on a call to glm()
.
fixed.effect.cluster.level()
will save lots of time if you just want to
run a cluster-level analysis and you have lots of observations.
weighted.crossover.cluster.level()
implements methods for fitting
a weighted analysis on data from a crossover study (see Turner et al. 1997).