r2_mlm: A command for computing R-squared measures for models fit by mixed

The article by Rights and Sterba (2023, Multivariate Behavioral Research 58: 340-367) provides a comprehensive framework for computing <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures for (linear) multilevel models. In this article, we introduce r2_mlm , a postestimation command for mixed that computes <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures using Rights and Sterba’s framework. We explain how this <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> framework works and demonstrate how r2_mlm can be used to compute various <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures for models fit by mixed . One of the most useful features of r2_mlm is that it will produce warning messages if the user specifies the model in a way that may lead to conflation bias (an easily overlooked issue). Finally, we walk through a simple example and explain how to interpret the various <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures.

Authors

Institutions

Publication Details

Journal
The Stata Journal Promoting communications on statistics and Stata
Published
2025-12-01
DOI
https://doi.org/10.1177/1536867x251398326
Primary Topic
Psychometric Methodologies and Testing
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

r2_mlm: A command for computing R-squared measures for models fit by mixed

D. Betsy McCoach, Anthony J. Gambino
The Stata Journal Promoting communications on statistics and Stata
Psychometric Methodologies and Testing
article

r2_mlm: A command for computing R-squared measures for models fit by mixed

D. Betsy McCoach, Anthony J. Gambino
article en

Abstract

The article by Rights and Sterba (2023, Multivariate Behavioral Research 58: 340-367) provides a comprehensive framework for computing <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures for (linear) multilevel models. In this article, we introduce r2_mlm , a postestimation command for mixed that computes <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures using Rights and Sterba’s framework. We explain how this <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> framework works and demonstrate how r2_mlm can be used to compute various <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures for models fit by mixed . One of the most useful features of r2_mlm is that it will produce warning messages if the user specifies the model in a way that may lead to conflation bias (an easily overlooked issue). Finally, we walk through a simple example and explain how to interpret the various <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" display="inline" overflow="scroll"> <mml:msup> <mml:mi>R</mml:mi> <mml:mn>2</mml:mn> </mml:msup> </mml:math> measures.

The Stata Journal Promoting communications on statistics and StataVol. 25(4)
University of Connecticut (US), Fordham University (US)
Openalex Percentile: Top 57%
Psychometric Methodologies and Testing
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

r2_mlm: A command for computing R-squared measures for models fit by mixed — D. Betsy McCoach, Anthony J. Gambino · The Stata Journal Promoting communications on statistics and Stata (2025) | TGRS Research Map | TGRS