I set up a multilevel model in R with the lme4-package to test different effects on social participation in primary school classes. Now I assume that the effects of academic performance (sp) and emotional-social competence (es) vary between classes, which is why I set up a model with random effects. Now I want to test those random slopes.

This is my model (don’t wonder, In my model, other variables – such as gender, migration background and the teacher’s attitude – are included):

```
mod3 <- lmer(
social_t1 ~ 1 + sex + mig + sl.c + es.c + attitude + (1 + sl.c + es.c|class),
data = kommschreib_ak,
na.action = na.exclude
)
summary(mod3)
```

The problem is that R only outputs the variances and not the p-value, which I want to have.

I have already found out how I can test the two slopes individually in a model (via anova-test), but not together in one. So I want to have a significance test that gives me a p-value for both academic performance and emotional-social competence for my model, which contains both random slopes.

Is there any chance I can do it in R?

My colleague has done this in MPlus so far. And since we assume that the random effects influence each other, we get different results when I test the effects individually.

0

To test the random variation in `sl.c`

and `es.c`

jointly I think you want:

```
mod3B <- update(mod3,
. ~ . - (1 + sl.c + es.c|class) + (1|class)
)
anova(mod3, mod3B)
```

Note that the likelihood ratio test (which is what `anova()`

does) is technically not applicable [it gives strongly conservative results] when testing hypotheses corresponding to parameters on the boundary of the feasible set (i.e., the variances can be zero, but they can’t be negative). The `RLRsim`

package is designed for these kinds of tests.