[R-sig-ME] random effect variance per treatment group in lmer
afshart at exchange.sba.miami.edu
Tue Jul 10 16:23:21 CEST 2007
I didn't receive a response to the query below sent to the general
R-help mailing list so figured I'd try this mailing list. Apologies
in advance if this is an overly simplistic question for this list; I
w/ lmer after not using lme for awhile.
How does one specify a model in lmer such that say the random effect for
the intercept has a different variance per treatment group?
Thus, in the model equation, we'd have say b_ij represent the random
for patient j in treatment group i, with variance depending on i, i.e,
var(b_ij) = tau_i.
Didn't see this in the docs or Pinherio & Bates (section 5.2 is specific
modelling within group errors). Sample repeated measures code below is
a single random effect variance, where the random effect corresponds to
z <- rnorm(24, mean=0, sd=1)
time <- factor(paste("Time-", rep(1:6, 4), sep=""))
Patient <- rep(1:4, each = 6)
drug <- factor(rep(c("D", "P"), each = 6, times = 2)) ## P = placebo, D
dat.new <- data.frame(time, drug, z, Patient)
fm = lmer(z ~ drug + time + (1 | Patient), data = dat.new )
More information about the R-sig-mixed-models