Last data update: 2014.03.03

R: Sample size calculations for linear mixed models of rate of...
lmmpowerR 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

lmmpower.default(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, R = NULL, method = c("edland",
  "diggle", "liuliang"), 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. ("time", "t", or 2 if it is the second specified fixed effect).

pct.change

the percent change in the pilot estimate of the parameter of interest (beta, the placebo/null effect)

delta

the change in the pilot estimate of the parameter of interest, computed from pct.change if left missing.

t

vector of time points

sig.level

Type I error

power

power

alternative

"two.sided" or "one.sided"

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

R

pilot estimate of a marginal model working correlation matrix

method

the formula to use. Defaults to "diggle" for Diggle et al (2002). Alternatively "liuliang" can be selected for Liu & Liang (1997).

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.

See Also

liu.liang.linear.power diggle.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)

Results