简体   繁体   中英

3-level logistic regression

I am trying to analyze a longitudinal data with binary response using 3-level logistic regression. Hierarchical structure of my data looks like this example- students (level 1) are nested within a class(level 2) and the classes are nested within a school (level 3).

Can anyone suggest me some appropriate readings on the SAS or R codes for performing 3-level mixed effects logistic regression? I am not requesting helps regarding the theory behind 3-level logistic regression. Any examples with SAS or R codes would be of great help.

In R you can use the glmer() function from the lme4 package for mixed effects models. You specify the effects in the formula= option. For nested random effects you probably want something like:

model <- glmer(formula = response ~ (1|student|class/block), family=binomial)

There are some examples of multi-level models on R-sessions

and you can fit non-linear responses, such as binomial, with family=binomial .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM