Linear Mixed Models: A Practical Guide Using Statistical Software (Third Edition)
Brady T. West, Ph.D.
Kathleen B. Welch, MS, MPH
Andrzej T. Galecki, M.D., Ph.D.

Linear Mixed Models: A Practical Guide using Statistical Software (Third Edition) Note: The third edition is now available via online retailers (e.g.,,

This book provides readers with a practical introduction to the theory and applications of linear mixed models, and introduces the fitting and interpretation of several types of linear mixed models using the statistical software packages SAS (PROC MIXED / PROC GLIMMIX), SPSS (the MIXED and GENLINMIXED procedures), Stata (mixed), R (the lme() and lmer() functions), and HLM (Hierarchical Linear Models).

The book focuses on the statistical meaning behind linear mixed models. Why fit them? Why are they important? When are they applicable? What do they mean for research conclusions? The book also presents and compares practical, step-by-step analyses of real-world data sets in all of the aforementioned software packages, allowing readers to compare and contrast the packages in terms of their syntax/code, ease of use, available methods and options, and relative advantages.

Click on any of the following chapters for links to the data sets, updates to the software code in the book, and miscellaneous additional information:

Chapter 3 -> Two-level Models for Clustered Data: The Rat Pup Example
Chapter 4 -> Three-level Models for Clustered Data: The Classroom Example
Chapter 5 -> Models for Repeated Measures Data: The Rat Brain Example
Chapter 6 -> Random Coefficient Models for Longitudinal Data: The Autism Example
Chapter 7 -> Models for Clustered Longitudinal Data: The Dental Veneer Example
Chapter 8 -> Models for Data with Crossed Random Factors: The Sat Score Example


Notes on Shrinkage Estimators
SPSS White Paper on the MIXED Procedure, with instructions on data preparation and use of the MIXED Procedure via the SPSS menus


1. Stata
2. Biometrical Journal


1. Technometrics
2. Biometrical Journal
3. Stata


1. Journal of Statistical Theory and Practice
2. Journal of the American Statistical Association
3. Stata
4. Technometrics (Nominated for the 2009 Ziegel Prize)
5. Biometrics
6. Statistics in Medicine
7. Journal of Quality Technology
8. Journal of the Royal Statistical Society-Series A
9. Biometrical Journal

The book was nominated for the 2009 Ziegel Prize, sponsored by the Journal Technometrics and honoring a first edition with clearly discussed statistical methodology that "brings together in one volume a body of material previously only available in scattered research articles and having the potential to significantly improve practice in engineering and science."


1. COMPUTATION OF MARGINAL EFFECTS: An updated version of the marginaleffects package for R is now available, and this has many cool procedures for computing and displaying marginal predictions and effects based on fitted LMMs.

2. The multilevelmod contributed package is now part of the tidymodels universe. You can use this package to fit a variety of different types of multilevel models. You can find examples of use at the multilevelmod website.

3. IHPI Seminar on LMMs in September 2022:
Brady West and Kathy Welch recently presented a seminar on the specification of LMMs for clustered and longitudinal data sets. Please click here to watch this two-hour seminar.

4. Fitting LMMs to non-Gaussian repeated measures data: check out this new article talking about how to fit LMMs to longitudinal data that relax normality assumptions, along with the new ngme package in R!

5. Here is a very cool new graphical interface, programmed in R shiny, for fitting two-level mixed models to clustered data sets. The corresponding paper can be found here.

6. Thomas Lumley has posted a new (and experimental!) R package for fitting mixed-effects models to complex sample survey data! The R community has been waiting for this for a long time, and this is a very nice breakthrough. Keep in mind that the package is still experimental.

7. Check out this excellent article in the Journal of Cognition that walks readers through appropriate (and general!) methods for performing simulation-based power analyses in R for mixed-effects models.

8. Here is a recent article comparing the performance of several popular multilevel modeling software packages.

9. See this link for a fix to the problem with the gls() function in the R nlme package, discussed in Chapter 6.

10. BAYESIAN ANALYSIS: For examples of Bayesian approaches to the analysis of the data sets in each chapter in SAS and R, click on our Bayesian Analysis in SAS page or our Bayesian Analysis in R page. You should also check out the Stan web page, and the web page for "The BUGS Book" (forthcoming). A new R package named brms is now available as well, which makes it very easy to use the Stan machinery in the background to fit mixed-effects models using Bayesian methodology. We agree with recent posts on the strengths of this approach relative to the more traditional frequentist approaches covered in our book, and strongly encourage readers to take advantage of this package's features and work with Stan to fit these models, especially when your research objectives involve making inference about variance components. We have prepared a worked example from Chapter 6 that walks readers through the use of this package.

11. POWER ANALYSIS RESOURCES: Chapter 9 of the third edition summarizes many new developments in this area and provides a great deal of example code. A new R function entitled powerlmm has been developed enabling quick and easy power analyses for two- and three-level multilevel models. Check out the vignettes at the GitHub site linked here for an easy-to-read introduction (for reasons that aren't entirely clear, the powerlmm package is no longer available on CRAN).

Here is a cool new R Shiny App for performing power analysis for LMMs. The underlying paper can be found here.

Here is another very cool new R Shiny App for performing power analysis for LMMs in the specific context of intensive longitudinal study designs. There is a link to the underlying paper at the GitHub site.

Those interested in power analysis and sample size calculations for study designs that are multilevel and/or longitudinal in nature can also check out this site for some very helpful free software and documentation (the Optimal Design software package) developed at the University of Michigan.

Related recent work on optimizing multilevel designs with specific consideration of budget constraints can be found here, and the odr package in R is now available, enabling optimal design and calculation of statistical power for multilevel studies. A related shiny app entitled SPODE, written by the authors of the odr package, is also now available here; stay tuned to this space for new updates!

Additional free simulation-based software and documentation for power analysis in multilevel designs can be found here. We have also prepared an example of a simulation program in SAS for the third edition of the book that can be downloaded here for example power calculations. Also, Dr. West recently reviewed an excellent new book on power analysis for multilevel studies that is really a must-have for anyone designing these types of studies.

12. EFFECT SIZES: Check out the emmeans package in R, which is a tremendously useful package that is capable of computing effect sizes (via the eff_size() function) and post-estimation marginal means for subgroups based on fitted LMMs!

13. An R package containing the data sets for the book, WWGbook, has been posted on CRAN. Please visit the R Project site for links to CRAN mirrors.

14. Use of the lmerTest package in R should be properly cited as follows: Alexandra Kuznetsova, Per Bruun Brockhoff, Rune Haubo, and Bojesen Christensen (2014). lmerTest: Tests for random and fixed effects for linear mixed effect models (lmer objects of lme4 package). R package version 2.0-13/r71.

15. Additional web sites for your reference:
Multilevel software reviews:
Matrix algebra tutorial:


Errata for the third edition can be found here. Errata for the second edition can be found here.

Please direct any questions and/or comments to Brady West (

Last modified 5/25/2023 by Brady T. West