# How to include level-2 variables in a random intercept model when fitting HLM with lme4?

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?

• @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!) – Jake Westfall Aug 22 '13 at 7:11