I am studying some mixed effect models.
I am quite confused with the notation in R for example:
data(Orthodont,package = "nlme")
Orthodont%>%colnames()
m1<-lmer(distance~age+Sex+(1|Subject),data=Orthodont)
m2<-lmer(distance~age+(Sex|Subject),data=Orthodont)
m3<-lmer(distance~age+(1|Sex)+(1|Subject),data=Orthodont)
m4<-lmer(distance~age+Sex+(1+age|Subject),data=Orthodont)
coef(m1)
coef(m2)
coef(m3)
coef(m4)
In the previous example I consider that the first model m1, gives me a model with random effect as subject, then if I check coef(m1), I will get different estimations for every subject. I am not clear what about the random intercept or slope.
The second model has this additional factor (sex|subject) What is sex in this case? I see that now for every subject the coefficient for sex is different. Then I assume that sex is also random. But in the model m3, what is the difference? Also I am adding sex as a random effect.
Finally, what does it mean this factor? (1+age|Subject)
Thank you for your clarifications.
Best.