4
votes

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.

1
Since your question is as you point out yourself solely about getting your analysis to run in a software, this question would be more appropriate for Stack Overflow. If this is the case, flag it and it will be migrated over there (but don't cross-post).Patrick Coulombe
Without knowing much about the regression you're trying to perform, and also lacking any information about your familiarity with R, this looks like it might be useful?: cran.r-project.org/doc/contrib/Bliese_Multilevel.pdfScott Ritchie
The situation you describe is clearly multilevel, but I don't follow how it's longitudinal. That said, the references here may be what you're looking for.gung - Reinstate Monica
I am sorry if I was unclear but the situation I described is not the data I am analyzing. It was just an example. My data has more than 10K subjects in total. There are about 190 clusters with 40-60 subjects in each cluster. Each subject were remeasured about 4-7 times.longleaf
I'm not sure if examples and codes for 3-level multilevel logistic regression analysis are commonly available in books/articles. I thought it could be done in SAS with PROC NLMIXED or PROC GLIMMIX or in R with lme4 package but I were looking for code examples here.longleaf

1 Answers

2
votes

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.