I want to make a multilevel regression with 3 levels.
I have data from a survey, where I have the information in which county the participants are living. So, I can also dinstinguish between East and West Germany.
In the picture you can see what I want to do:
I have East and West Germany and the counties and the participants filled some qustionnaires and from these variable (v1 to v4) I want to make a regression analysis. After some reading, I decided to make a multilevel analysis and my question is, can I make a three level model?
I tried the following code:
lmer(xenophobia ~ v1+v2+v3+v4+(1|EastWest)+(1|Counties), data, REML = F)
I am not sure if it is correct. But, if I use this I get a warning
boundary (singular) fit: see ?isSingular
After looking into the summary, I saw that the variance for EastWest is 0.00.
So, I tried another approach:
lmer(xenophobia ~ v1+v2+v3+v4+(1|EastWest:Counties), data, REML = F)
Now, I don't get a warning. I know that I nested the "Counties" into "EastWest", but I don't know what is now the difference between a nested model and a three level model.
I hope someone can help me.
Unfortunately I can't give some example data, but my question is not about the data structure, I guess.
Thanks in advance!
EastWest
appears to be a variable with only 2 levels. As such it should not be specified as a grouping variable for random intercepts. Doing this would be asking the software to estimate a variance for a normally distributed variable from only 2 observations. This variable should be a fixed effect.