7
$\begingroup$

I want to include 2 covariates that are group characteristics as fixed effects in predicting a variable that is at the individual level. How to include them in the lmer formula? At this point my random effects are given just by the intercept and my fixed effects are only individual level variables.

a <- lmer(DV ~ 1 + v1 + v2 + (1 | Team), data = dat)

Should they they be included as random effects?

$\endgroup$

1 Answer 1

4
$\begingroup$

If they are level-2 predictors ("group characteristics" as you say), then they cannot have random effects. We would need to be able to compute separate slopes of the predictors for each group, but this doesn't make sense because the slope can only be computed across groups, not within a group. So the model that you have written already is correct.

$\endgroup$
2
  • $\begingroup$ SO, iv v3 and v4 would be level-2 predictors, they formular would be just a <- lmer(DV ~ 1 + v1 + v2+v3+v4 + (1 | Team), data = dat)?? and lmer would recognize that it's a variable that explain (should explain) variation at level 2 ? $\endgroup$ Commented Aug 22, 2013 at 6:10
  • 1
    $\begingroup$ @user2520918 Yes, lmer() will recognize that these predictor variables have no within-group variation. In fact, if you do try to fit a model with random effects of v3 and v4, the model estimation will fail. (Or at least it should fail... if it doesn't fail, then something is seriously amiss, because those random effects cannot be estimated even in theory given these data!) $\endgroup$ Commented Aug 22, 2013 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.