Levels within levels

#1

I am working on some professor rating data. I would like to model the data in a multilevel fashion as professors are nested within departments, and departments are nested within the school. This is similar to the 8 schools example, except now there is an additional level. From the model, I would like to infer the random effect of the department and the random effect of each instructor.

I’m new to brms and a bit confused on how to specify this relationship. One of the vignettes notes I can use

Average_Rating|se(Rating_Se)~ 1 + (1|Professor_Name/Department)

Does this specify the relationship I’m trying to estimate correctly?

  • Operating System: mac os 10.14.4
  • brms Version: 2.7.0
#2

I think the grouping variables should be the other way round so that you end up with department and professor within department. but you should verify this is correct. I always get confused as well… :-)

#3

So the grouping goes the other way around?

outcome ~ 1 + (1|larger_level/level_within_level)

#4

I think so but you need to verify this.

#5

OK, will do. Thanks!

#6

(1|A/B) can also be written as (1|A) + (1|A:B). Conversely,
(1|B/A) is equal to (1|B) + (1|B:A)

so if you want (random effects) coefficients for each of your larger levels,
outcome ~ 1 + (1|larger_level/level_within_level) it is.

2 Likes