I would like to fit a 3-level hierarchical regression in lmer, however, I don’t know how to specify the grouping factor above the second level.

the model would be:`lmer(depedent ~ independent 1 + independent2 + (1|group1)....`

And I would like to specify another group nested within

`group1`

.I’ve tried

`(1|group1/group2)`

but this gives an error message and group1:group2 is an interaction.I’ve also tried separately

`(1|group1) + (1|group2)`

but i’m not sure if this is correct.

thanks

**Answer**

Not enough reputation to comment, so I’ll post this as an answer.

There are a number of questions like this already around. you might want to look at this message.

However, `(1|group1/group2)`

should work with all but very old versions of lme4, so if that gives you an error, there is probably something wrong with the way you set up your data. Note that once your data are correctly set up, `(1|group1/group2)`

and `(1|group1) + (1|group2)`

should give the same results.

**Attribution***Source : Link , Question Author : Community , Answer Author : wolf.rauch*