specifying multiple random effects in R lmer (translating from HLM model) -
i'm attempting "translate" model run in hlm7 software r lmer syntax.
this now-ubiquitous "math achievement" dataset. outcome math achievement score, , in dataset there various student-level predictors (such minority status, ses, , whether or not student female) , various school level predictors (such catholic vs. public).
the predictors in model want fit student-level predictors, have been group-mean centered deal dummy variables (aside: contrast codes better). students nested in schools, should (i think) have random effects specified of components of model.
here hlm model:
level-1 model (note: predictors @ level 1 group mean centered) mathachij = β0j + β1j*(minorityij) + β2j*(femaleij) + β3j*(sesij) + rij
level-2 models
β0j = γ00 + u0j
β1j = γ10 + u1j
β2j = γ20 + u2j
β3j = γ30 + u3j
mixed model
mathachij = γ00 + γ10*minorityij + γ20*femaleij + γ30*sesij + u0j + u1j*minorityij + u2j*femaleij + u3j*sesij + rij
translating lmer syntax, try: (note: _gmc means variable has been group mean centered, grouping factor "school_id")
model1<-lmer(mathach~minority_gmc+female_gmc+ses_gmc+(minority_gmc|school_id)+(female_gmc|school_id)+(ses_gmc|school_id), data=data, reml=f)
when run model results don't mesh hlm results. specifying random effects incorrectly?
thanks!
Comments
Post a Comment