Multilevel regression question: can you use level 2 variable as a predictor variable? I was just reading a paper in the field of education and there was a part I couldn't comprehend.
The author did a multilevel regression analysis with the data which was nested in a school level.
So that the 2nd level was school. The dependent variable was school violence.
The syntax in R would be like
lmer(violence ~ (1|schoolid), data=data) 

But the thing really confused me was that the author also included the "private school" variable as a predictor variable in their analysis, saying that being private school would have different effects on school violence.
So that the author included a binary variable (private school=1, public school=0) as a predictor variable.
The syntax would be:
lmer(violence ~ private_school + (1|schoolid), data=data) 

But isn't the school effect already accounted by specifying that the data is nested in a school level? Is it a statistically correct approach?
I would really appreciate if you could answer my query.

This sounds fine to me.
As written, the second model assumes that expected violence is different between private and non-private schools.  Within private and non-private schools, violence is assumed to vary by school.
