lmmpower {longpower} | R Documentation |
Sample size calculations for linear mixed models of rate of change based on lmer, lme, or gee "placebo" pilot estimates.
Description
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.
Usage
## 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,
...
)
Arguments
object |
an object returned by lme4 |
n |
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. |
parameter |
the name or position
of the rate of change parameter of interest, e.g. ( |
pct.change |
the percent change
in the pilot estimate of the parameter of interest ( |
delta |
the change in the pilot estimate
of the parameter of interest, computed from |
t |
vector of time points |
sig.level |
Type I error |
power |
power |
alternative |
|
beta |
pilot estimate of the placebo effect (slope or rate of change in the outcome) |
beta.CI |
95% confidence limits of the pilot estimate of beta |
delta.CI |
95% confidence limits of the effect size |
sig2.i |
pilot estimate of variance of random intercept |
sig2.s |
pilot estimate of variance of random slope |
sig2.e |
pilot estimate of residual variance |
cov.s.i |
pilot estimate of covariance of random slope and intercept |
cor.s.i |
pilot estimate of correlation of random slope and intercept |
R |
pilot estimate of a marginal model working correlation matrix |
p |
proportion vector for both groups; if i indexes visits, p[i] = the proportion whose last visit was at visit i (p sums to 1) |
method |
the formula to use. Defaults
to |
tol |
numerical tolerance used in root finding. |
... |
other arguments |
Details
Any parameters not explicitly stated are extracted from the fitted
object
.
Value
An object of class power.htest
giving the calculated sample
size, N, per group and other parameters.
Author(s)
Michael C. Donohue
References
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.
See Also
liu.liang.linear.power
,
diggle.linear.power
, edland.linear.power
,
hu.mackey.thomas.linear.power
Examples
## 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 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
lmmpower(fm1, pct.change = 0.30, t = seq(0,9,1), power = 0.80)
library(nlme)
fm2 <- lme(Reaction ~ Days, random=~Days|Subject, sleepstudy)
lmmpower(fm2, pct.change = 0.30, t = seq(0,9,1), power = 0.80)
# random intercept only
fm3 <- lme(Reaction ~ Days, random=~1|Subject, sleepstudy)
lmmpower(fm3, pct.change = 0.30, t = seq(0,9,1), power = 0.80)
library(gee)
fm4 <- gee(Reaction ~ Days, id = Subject,
data = sleepstudy,
corstr = "exchangeable")
lmmpower(fm4, pct.change = 0.30, t = seq(0,9,1), power = 0.80)
## End(Not run)