longleaf
longleaf

Reputation: 41

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.

Upvotes: 4

Views: 1838

Answers (1)

david25272
david25272

Reputation: 974

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.

Upvotes: 2

Related Questions