Multilevel modeling: From lme4 to Mplus

My dissertation research involves multivariate multilevel modeling. I would prefer to use lme4, but it can only regress one dependent variable at a time. I am using Mplus because it allows the necessary constraints for multivariate multilevel modeling.

In this entry I demonstrate some univariate multilevel modeling constraints, following lmer’s sleepstudy example. Unlike other Mplus multilevel modeling demonstrations, I avoid Mplus’ syntactic shortcuts (i.e., “TYPE = TWOLEVEL”) in order to highlight the constraints and the underlying measurement assumptions made in conventional multilevel modeling.

I replicate the lmer example first (see below). One of the first differences to note is that Mplus does not apply restricted maximum likelihood, so the REML argument must be set to FALSE. Additionally, I recast the sleepstudy data from long to wide for Mplus. The Mplus estimates match the lmer results. How? As annotated below, Mplus achieves the same results as conventional multilevel models by:

  1. treating the fixed effects (at level two) as latent variables (indicated in this example by level-one observations at points in time)
  2. assuming and imposing configural, scalar and uniqueness invariance.

Configural invariance is imposed by constraining loadings on the latent intercept to 1. Scalar invariance is imposed by constraining indicator intercepts to 0. Uniquenesses are estimated but constrained to be equal. This makes sense from a Generalizability Theory perspective when you consider that the measurement error variance component is for a single observation drawn from a universe of admissible observations.

lmer’s sleepstudy example with random slopes for time

> summary(lmer(Reaction ~ Days + (Days | Subject), sleepstudy, REML = F))
Linear mixed model fit by maximum likelihood ['lmerMod']
Formula: Reaction ~ Days + (Days | Subject)
Data: sleepstudy
AIC       BIC    logLik  deviance
1763.9393 1783.0971 -875.9697 1751.9393
Random effects:
Groups   Name        Variance Std.Dev. Corr
Subject  (Intercept) 565.52   23.781
Days         32.68    5.717   0.08
Residual             654.94   25.592
Number of obs: 180, groups: Subject, 18
Fixed effects:
Estimate Std. Error t value
(Intercept)  251.405      6.632   37.91
Days          10.467      1.502    6.97
Correlation of Fixed Effects:
(Intr)
Days -0.138

Mplus random slopes example with sleepstudy data

INPUT INSTRUCTIONS
DATA: FILE = "Sleepstudy.dat";
VARIABLE:
NAMES = Subject React_0 React_1 React_2 React_3 React_4 React_5 React_6 React_7
React_8 React_9;
MISSING=.;
IDVARIABLE IS Subject;
USEVARIABLE = Subject React_0 React_1 React_2 React_3 React_4 React_5 React_6 React_7
React_8 React_9;
ANALYSIS:
ESTIMATOR = ML;
MODEL:
!Specify intercept fixed effect (latent intercept factor).
!Fix loadings at 1; assume configural invariance.
FI by React_0-React_9@1;
[FI]; !intercept fixed effect (mean)
!Specify fixed effect for days (latent slope factor).
!Fix loadings at corresponding day.
FS by React_0@0 React_1@1 React_2@2 React_3@3 React_4@4 React_5@5
React_6@6 React_7@7 React_8@8 React_9@9;
[FS]; !slope fixed effect (mean)
!Suppress indicator intercepts; assume scalar invariance.
[React_0 - React_9 @0];
!Specify residual (error) variance component; assume invariant uniquenesses.
React_0 - React_9 (1);
!Specify factor (facet) variance and covariance components.
FI FS;
FI with FS;
!Suppress slope variance if specifying a random intercept model.
!FS@0;
!FI with FS @0;
INPUT READING TERMINATED NORMALLY
Replication of lmer sleepstudy random slopes example;
SUMMARY OF ANALYSIS
Number of groups                                                 1
Number of observations                                          18
Number of dependent variables                                   10
Number of independent variables                                  0
Number of continuous latent variables                            2
Observed dependent variables
Continuous
REACT_0     REACT_1     REACT_2     REACT_3     REACT_4     REACT_5
REACT_6     REACT_7     REACT_8     REACT_9
Continuous latent variables
FI          FS
Variables with special functions
ID variable           SUBJECT
Estimator                                                       ML
Information matrix                                        OBSERVED
Maximum number of iterations                                  1000
Convergence criterion                                    0.500D-04
Maximum number of steepest descent iterations                   20
Maximum number of iterations for H1                           2000
Convergence criterion for H1                             0.100D-03
Input data file(s)
C:/Sleepstudy.dat
Input data format  FREE
SUMMARY OF DATA
Number of missing data patterns             1
COVARIANCE COVERAGE OF DATA
[omitted: 100% coverage]
THE MODEL ESTIMATION TERMINATED NORMALLY
TESTS OF MODEL FIT
Chi-Square Test of Model Fit
Value                            141.141
Degrees of Freedom                    59
P-Value                           0.0000
Chi-Square Test of Model Fit for the Baseline Model
Value                            260.682
Degrees of Freedom                    45
P-Value                           0.0000
CFI/TLI
CFI                                0.619
TLI                                0.710
Loglikelihood
H0 Value                        -875.970
H1 Value                        -805.399
Information Criteria
Number of Free Parameters              6
Akaike (AIC)                    1763.939
Bayesian (BIC)                  1769.282
Sample-Size Adjusted BIC        1750.845
(n* = (n + 2) / 24)
RMSEA (Root Mean Square Error Of Approximation)
Estimate                           0.278
90 Percent C.I.                    0.220  0.337
Probability RMSEA <= .05           0.000
SRMR (Standardized Root Mean Square Residual)
Value                              0.379
MODEL RESULTS
Two-Tailed
Estimate       S.E.  Est./S.E.    P-Value
FI       BY
REACT_0            1.000      0.000    999.000    999.000
REACT_1            1.000      0.000    999.000    999.000
REACT_2            1.000      0.000    999.000    999.000
REACT_3            1.000      0.000    999.000    999.000
REACT_4            1.000      0.000    999.000    999.000
REACT_5            1.000      0.000    999.000    999.000
REACT_6            1.000      0.000    999.000    999.000
REACT_7            1.000      0.000    999.000    999.000
REACT_8            1.000      0.000    999.000    999.000
REACT_9            1.000      0.000    999.000    999.000
FS       BY
REACT_0            0.000      0.000    999.000    999.000
REACT_1            1.000      0.000    999.000    999.000
REACT_2            2.000      0.000    999.000    999.000
REACT_3            3.000      0.000    999.000    999.000
REACT_4            4.000      0.000    999.000    999.000
REACT_5            5.000      0.000    999.000    999.000
REACT_6            6.000      0.000    999.000    999.000
REACT_7            7.000      0.000    999.000    999.000
REACT_8            8.000      0.000    999.000    999.000
REACT_9            9.000      0.000    999.000    999.000
FI       WITH
FS                11.055     42.876      0.258      0.797
Means
FI               251.405      6.632     37.906      0.000
FS                10.467      1.502      6.968      0.000
Intercepts
REACT_0            0.000      0.000    999.000    999.000
REACT_1            0.000      0.000    999.000    999.000
REACT_2            0.000      0.000    999.000    999.000
REACT_3            0.000      0.000    999.000    999.000
REACT_4            0.000      0.000    999.000    999.000
REACT_5            0.000      0.000    999.000    999.000
REACT_6            0.000      0.000    999.000    999.000
REACT_7            0.000      0.000    999.000    999.000
REACT_8            0.000      0.000    999.000    999.000
REACT_9            0.000      0.000    999.000    999.000
Variances
FI               565.516    265.266      2.132      0.033
FS                32.682     13.573      2.408      0.016
Residual Variances
REACT_0          654.941     77.186      8.485      0.000
REACT_1          654.941     77.186      8.485      0.000
REACT_2          654.941     77.186      8.485      0.000
REACT_3          654.941     77.186      8.485      0.000
REACT_4          654.941     77.186      8.485      0.000
REACT_5          654.941     77.186      8.485      0.000
REACT_6          654.941     77.186      8.485      0.000
REACT_7          654.941     77.186      8.485      0.000
REACT_8          654.941     77.186      8.485      0.000
REACT_9          654.941     77.186      8.485      0.000
QUALITY OF NUMERICAL RESULTS
Condition Number for the Information Matrix              0.453E-04
(ratio of smallest to largest eigenvalue)

This entry was posted in Praxes. Bookmark the permalink.