Hi everyone I do a research about the relationship between kid age and kids' height and other variables. In my data, one mother has many kid, and a kid only have one mom. I have consider the nested kid and mom. How could I consider the autocorrelation of each kid. It is a 3 levels model, It is too hard for me. Question 1: This is my modle now, how chould I correct it to consider the autocorrelation? In my opinion, I have to add a new level age which is nested in kid.id.(z-score here is standsrd children's height) lmm_4<-lmer(weight.z.score ~ KID.AGE.YEARS + (1|MOM.ID/KID.ID), data=data_calculate_without_na) Question 2: When I add more variables, where should I but these variables? Is it right? lmm_age_sib_WAZ<- gls(weight.z.score ~ KID.AGE.YEARS + as.factor(OLDER.SIBLINGS) + as.factor(YOUNG.SIBS) + KID.AGE.YEARS:OLDER.SIBLINGS + KID.AGE.YEARS:YOUNG.SIBS, correlation = corCompSymm(form = ~ 1+KID.AGE.YEARS|MOM.ID/KID.ID), data = HAZ_Sign_sib) Qestion 3: when I want to fit it using gamm, what should I do to fit model consider these three levels. where should I add nested level in this model gamm_age_sib_WAZ <-gamm(weight.z.score ~ s(KID.AGE.YEARS, bs = "ps",k=5) + s(as.factor(HAZ_Sign_sib$OLDER.SIBLINGS), bs = "re",k=length(unique(HAZ_Sign_sib$OLDER.SIBLINGS))) + s(as.factor(HAZ_Sign_sib$YOUNG.SIBS), bs = "re",k=length(unique(HAZ_Sign_sib$YOUNG.SIBS))) + te(KID.AGE.YEARS,by=(OLDER.SIBLINGS)) + te(KID.AGE.YEARS,by=(YOUNG.SIBS)), data = HAZ_Sign_sib) If you can reply me, thank you so much!! Best wishes Xuan
question about nested random effect
2 messages · Xuan Sun (student), David Duffy
You might look at the pedigreemm package, and the examples they analyse there. Because you only have nuclear families, the default genetic model pedigreemm uses is equivalent to what you want for the familial correlations. Cheers, David Duffy.
I do a research about the relationship between kid age and kids' height and other variables. In my data, one mother has many kid, and a kid only have one mom. I have consider the nested kid and mom. How could I consider the autocorrelation of each kid. It is a 3 levels model, It is too hard for me.