# Question about proper fitting a multilevel Model with lme4

I want to fit a linear mixed-effect model for a multilevel data as the following:

Normally distributed response = $$y$$

Second level cluster = $$\text{group}$$

First level observation from which responses are drawn

Two-level factor predictor = $$x$$ that is given on the cluster level

I am interested in estimating the fixed effects (between-cluster) adjusting for within-cluster correlation. Would it be better to fit random-effects with just a random intercept:

lmer(y ~ x + (1 | group))

Or should I include a random slope even though my predictor is a two-level factor?

lmer(y ~ x + (1 + x | group))

• A random slope is like assuming that the effect of x depends on group. To estimate both a random intercept and slope, though, you would need a lot of observations. May 8, 2020 at 4:33

If x is a level 2 predictor, then it cannot be specified as a random slope at the same level it characterizes. Imagine that we have surveyed students within classrooms about their teachers' instruction (level 1) and also surveyed the teacher about their instruction (level 2). We want to predict student achievement. We can allow the association between student perception and student achievement to vary across classrooms but we cannot specify the association between a teacher's perception of their instruction and student achievement to vary across classrooms. Teacher perceptions are at the same level as the level 2 cluster variable - teacher.