Afshartous, David
2007-Jul-08 17:50 UTC
[R] random effect variance per treatment group in lmer
All, 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 effect 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 for modelling within group errors). Sample repeated measures code below is for a single random effect variance, where the random effect corresponds to patient. cheers, dave 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 = Drug dat.new <- data.frame(time, drug, z, Patient) fm = lmer(z ~ drug + time + (1 | Patient), data = dat.new ) [[alternative HTML version deleted]]
Possibly Parallel Threads
- summarizing dataframe at variable/factor levels
- treatment effect at specific time point within mixed effects model
- treatment effect at specific time point within mixedeffects model
- xyplot and autokey, maintaining colors specified via "col" in key
- maintaining specified factor contrasts when subsetting in lmer