Skip to content
Prev 240 / 20628 Next

random effect variance per treatment group in lmer

On Thu, 2007-07-12 at 06:57 +1000, Andrew Robinson wrote:
The above model specifies a random intercept with one random effect per
Patient, and a random slope term for drug, with 1 random effect per
patient. Covariances of the random effects for intercept and drug are
estimated.

This is the model with zero covariances for the random effects, with
Patient as the single level of grouping:

fm.cov <- lmer(z ~ drug + time + (1|Patient) + (0 + drug|Patient),
data=dat.new)
If your notation is correct, then this is the lmer call:

fm <- lmer(z ~ drug + time + (1|drug:Patient), data=dat.new)

So you get different random effects on the intercept for each drug *
Patient combination. you can estimate one variance of these random
effects.
Hold on, I think the above model can be rewritten as:

Y_ijk = mu + alpha_i + Indicator_i * b1_i + Indicator_ij * b2_ij +
theta_k + epsilon_ijk


fm <- lmer(z ~ drug + time + (1|drug) + (1|drug:Patient), data=dat.new)

Here we have 2 levels of grouping of random effects on the intercept: at
the drug level (b1), and at the drug*patient level (or equivalently,
Patient within drug level (b2)). So two variances are estimated: for b1
and b2. So to get the total random effect for each patient, just sum the
appropriate random effects across the grouping levels.

The only trick with lmer (compared to lme) is that the Patient j's
should have unique identifiers. Don't have Patients  1,2,3 for within
treatment 1 and 1,2,3 for patients within treatment 2. Use 1,2,3 for
treatment 1 and 4,5,6 for treatment 2 etc.

I hope I have now understood your problem correctly!

Simon.