These functions compute sample size for linear mixed models based on the formula due to Diggle (2002) or Liu and Liang (1997). These formulae are expressed in terms of marginal model or Generalized Estimating Equations (GEE) parameters. These functions translate pilot mixed effect model parameters (e.g. random intercept and/or slope, fixed effects, etc.) into marginal model parameters so that either formula can be applied to equivalent affect. Pilot estimates are assumed to be from an appropriate "placebo" group and the parameter of interest is assumed to be the rate of change over time of the outcome.
## Default S3 method: lmmpower( object = NULL, n = NULL, parameter = 2, pct.change = NULL, delta = NULL, t = NULL, sig.level = 0.05, power = NULL, alternative = c("two.sided", "one.sided"), beta = NULL, beta.CI = NULL, delta.CI = NULL, sig2.i = NULL, sig2.s = NULL, sig2.e = NULL, cov.s.i = NULL, cor.s.i = NULL, R = NULL, p = NULL, method = c("diggle", "liuliang", "edland", "hu"), tol = .Machine$double.eps^2, . )
an object returned by lme4
sample size per group of a mixed-effects model object to placebo data assumed to have either a random intercept, or a random intercept and random effect for time (slope); and fixed effect representing the rate of change in a placebo group.
the name or position of the rate of change parameter of interest, e.g. ( "time" , "t" , or 2 if it is the second specified fixed effect).
the percent change in the pilot estimate of the parameter of interest ( beta , the placebo/null effect)
the change in the pilot estimate of the parameter of interest, computed from pct.change if left missing.
vector of time points
"two.sided" or "one.sided"
pilot estimate of the placebo effect (slope or rate of change in the outcome)
95% confidence limits of the pilot estimate of beta
95% confidence limits of the effect size
pilot estimate of variance of random intercept
pilot estimate of variance of random slope
pilot estimate of residual variance
pilot estimate of covariance of random slope and intercept
pilot estimate of correlation of random slope and intercept
pilot estimate of a marginal model working correlation matrix
proportion vector for both groups; if i indexes visits, p[i] = the proportion whose last visit was at visit i (p sums to 1)
the formula to use. Defaults to "diggle" for Diggle et al (2002). Alternatively "liuliang" can be selected for Liu & Liang (1997), "edland" for Ard & Edland (2011), or "hu" for Hu, Mackey & Thomas (2021).
numerical tolerance used in root finding.
Any parameters not explicitly stated are extracted from the fitted object .
An object of class power.htest giving the calculated sample size, N, per group and other parameters.
Michael C. Donohue
Diggle P.J., Heagerty P.J., Liang K., Zeger S.L. (2002) Analysis of longitudinal data. Second Edition. Oxford Statistical Science Series.
Liu, G., and Liang, K. Y. (1997) Sample size calculations for studies with correlated observations. Biometrics, 53(3), 937-47.
Ard, C. and Edland, S.D. (2011) Power calculations for clinical trials in Alzheimer's disease. Journal of Alzheimer's Disease. 21:369-377.
Hu, N., Mackey, H., & Thomas, R. (2021). Power and sample size for random coefficient regression models in randomized experiments with monotone missing data. Biometrical Journal, 63(4), 806-824.
## Not run: browseVignettes(package = "longpower") ## End(Not run) lmmpower(delta=1.5, t = seq(0,1.5,0.25), sig2.i = 55, sig2.s = 24, sig2.e = 10, cov.s.i=0.8*sqrt(55)*sqrt(24), power = 0.80) lmmpower(n=208, t = seq(0,1.5,0.25), sig2.i = 55, sig2.s = 24, sig2.e = 10, cov.s.i=0.8*sqrt(55)*sqrt(24), power = 0.80) lmmpower(beta = 5, pct.change = 0.30, t = seq(0,1.5,0.25), sig2.i = 55, sig2.s = 24, sig2.e = 10, cov.s.i=0.8*sqrt(55)*sqrt(24), power = 0.80) ## Not run: library(lme4) fm1