- Multilevel estimators
- Continuous outcomes, modeled as
- linear
- log linear
- log gamma
- nonlinear

- Binary outcomes, modeled as
- logistic
- probit
- complementary log-log

- Count outcomes, modeled as
- Poisson
- negative binomial

- Categorical outcomes, modeled as
- multinomial logistic via generalized SEM

- Ordered outcomes, modeled as
- ordered logistic
- ordered probit

- Censored outcomes, modeled as
- tobit
- interval

- Survival outcomes, modeled as
- parametric survival

- which is to say,
- generalized linear models (GLM)

- Continuous outcomes, modeled as

You can fit a wide variety of random-intercept and random-slope models.

Let us show you an example with an ordered categorical outcome, random intercepts, and three-level data.

Using a four-level Likert scale, we ran an experiment measuring students' attitudes toward statistics after taking an introductory statistics class. In some of the classes, Stata was used. Other packages were used in the remaining classes. The question is, does exposure to Stata result in a more positive attitude toward statistics?

In the model we fit, we control for use of Stata, each student's average score in previous math courses, and whether either of the student's parents is in a science-related profession.

We will imagine that the fictional data were collected from various courses at various undergraduate schools. School may have an effect, as might class within school.

The results are

. meologit attitude mathscore stata##science || school: || class:Fitting fixed-effects model: Iteration 0: log likelihood = -2212.775 Iteration 1: log likelihood = -2125.509 Iteration 2: log likelihood = -2125.1034 Iteration 3: log likelihood = -2125.1032 Refining starting values: Grid node 0: log likelihood = -2152.1514 Fitting full model: Iteration 0: log likelihood = -2152.1514 (not concave) Iteration 1: log likelihood = -2125.9213 (not concave) Iteration 2: log likelihood = -2120.1861 Iteration 3: log likelihood = -2115.6177 Iteration 4: log likelihood = -2114.5896 Iteration 5: log likelihood = -2114.5881 Iteration 6: log likelihood = -2114.5881 Mixed-effects ologit regression Number of obs = 1,600

No. of Observations per Group | ||

Group Variable | Groups Minimum Average Maximum | |

school | 28 18 57.1 137 | |

class | 135 1 11.9 28 | |

attitude | Coef. Std. Err. z P>|z| [95% Conf. Interval] | |

mathscore | .4085273 .039616 10.31 0.000 .3308814 .4861731 | |

1.stata | .8844369 .2099124 4.21 0.000 .4730161 1.295858 | |

1.science | .236448 .2049065 1.15 0.249 -.1651614 .6380575 | |

stata# | ||

science | ||

1 1 | -.3717699 .2958887 -1.26 0.209 -.951701 .2081612 | |

/cut1 | -.0959459 .1688988 -.4269815 .2350896 | |

/cut2 | 1.177478 .1704946 .8433151 1.511642 | |

/cut3 | 2.383672 .1786736 2.033478 2.733865 | |

school | ||

var(_cons) | .0448735 .0425387 .0069997 .2876749 | |

school>class | ||

var(_cons) | .1482157 .0637521 .063792 .3443674 | |

(**stata##science** is how we introduce a full factorial interaction of **stata** and **school** in Stata; see Factor variables and value labels.)

We discover that exposure to Stata does indeed improve students' attitudes toward statistics.

The effect of school is minimal (the variance is small).

Class has a larger effect as revealed by its larger variance, so teachers matter.

Above we showed you an example with random intercepts. We could just as easily have shown you an example with random slopes.

See the Multilevel Mixed-Effects Reference Manual.

The manual demonstrates many of the possible models, links, and families, including:

Introduction to multilevel mixed-effects models

Multilevel mixed-effects generalized linear model

Multilevel mixed-effects logistic regression

Multilevel mixed-effects probit regression

Multilevel mixed-effects complementary log-log regression

Multilevel mixed-effects ordered logistic regression

Multilevel mixed-effects ordered probit regression

Multilevel mixed-effects Poisson regression

Multilevel mixed-effects negative binomial regression

Multilevel mixed-effects tobit regression

Multilevel mixed-effects interval regression

Multilevel mixed-effects parametric survival model

Nonlinear mixed-effects regression

Watch Multilevel models for survey data in Stata.

In multilevel data, observations—subjects, for want of a better term—can be divided into groups that have something in common:

- perhaps the subjects are students, and the groups share having attended the same high school;
- they are patients that share having been treated at the same hospital; or
- they are tractors that were manufactured at the same factory.

- Some high schools are better (or worse) than others, so it would be reasonable to assume that the identity of the high school had an effect.
- The argument is much the same for hospitals when the outcome is subsequent health; some hospitals are better (or worse) than others, at least with respect to particular health problems.
- For tractors and factories, it would hardly be surprising if tractors from some factories were more reliable than tractors from other factories.

- The first level is the student, patient, or tractor.
- The second level is high school, hospital, or factory.