Home  /  Resources & support  /  Training  /  Organizational training  /  Courses  /  Multilevel/mixed models using Stata

Organizational training

Multilevel/mixed models using Stata


This two-day course is an introduction to using Stata to fit multilevel/mixed models. Mixed models contain both fixed effects analogous to the coefficients in standard regression models and random effects not directly estimated but instead summarized through the unique elements of their variance–covariance matrix. Mixed models may contain more than one level of nested random effects, and hence, these models are also referred to as multilevel or hierarchical models, particularly in the social sciences. Stata’s approach to linear mixed models is to assign random effects to independent panels where a hierarchy of nested panels can be defined for handling nested random effects.

The course will be interactive, use real data, and offer ample opportunity for specific research questions and for working exercises to reinforce what is learned.

The course will be taught in five parts. During the first four parts, the discussion will be confined to linear mixed models for continuous responses. The fifth part will focus on binary and count responses.

Request this course

Course topics

  • Part I — The classic random-intercept linear model. We will discuss several approaches for fitting this model, along with the associated benefits and assumptions of each approach.
    • What constitutes a linear mixed model?
    • The random-intercept model
    • The within estimator versus the generalized least-squares (GLS) estimator; the Hausman test
    • Maximum likelihood and restricted maximum likelihood
    • Using the xtmixed and xtreg commands for the random-intercept model
  • Part II — Random coefficients and the various covariance structures that can be imposed with multiple random-effects terms.
    • Adding random coefficients
    • Specifying models hierarchically
    • Covariance structures for random effects
    • Growth curves
    • Linear transformations of covariates in a random-effects setting
    • Likelihood-ratio (LR) tests
  • Part III — Tricks of the trade, covering various methods for fitting more complex models, including crossed-effects models, growth curve models, and models with complex and grouped constraints on covariance structures.
    • Multiple-level models
    • Crossed-effects models
    • Using Stata’s “R.” factor notation for mixed models
    • Complex and grouped constraints on variance components
    • Heteroskedastic residual errors
    • Alternate residual-error structures
  • Part IV — Predictions, model diagnostics, and other postestimation tasks.
    • Best linear unbiased predictions (BLUPs)
    • Residuals
    • Fit diagnostics
    • Diagnostic plots
    • Cataloging and comparing mixed-model results in Stata
  • Part V — Models for binary and count responses. During this part of the course, you will learn that most of what is discussed for linear mixed models can be applied equally to mixed models with noncontinuous responses.
    • Binary and count responses
    • Estimation via adaptive Gaussian quadrature
    • Model building using the Laplacian approximation
    • Predictions and other postestimation tasks


Basic knowledge of standard linear regression and a working knowledge of Stata and the Do-file Editor.


This course is available in-person or virtually. In-person training courses generally run for eight hours per day and include morning and afternoon breaks and a lunch break. Virtual training courses are typically divided into three- to four-hour daily sessions. You can arrange a convenient schedule with your instructor.

Request this course