This page uses the https://stats.idre.ucla.edu/wp-content/uploads/2016/02/imm23.dat data file.
Table 4.2 on page 64.
The variable schid identifies the schools. Using a Raudenbush and Bryk way of the describing the model, the null model is
Level 1
MATHij= β0j+ rij
Level 2
β0j = γ00 + u0j
Here is the Mplus setup for estimating this model.
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 64, Table 4.2
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math;
within = ; ! level 1 variables here (none)
between = ; ! level 2 variables here (none)
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math; ! no fixed effects
%between%
math; ! no predictors of intercept
and here is a selection of the output.
Estimated Intraclass Correlations for the Y Variables
Intraclass
Variable Correlation
MATH 0.234
Loglikelihood
H0 Value -1900.388
H1 Value -1900.388
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Variances
MATH 81.237 5.158 15.750
Between Level
Means
MATH 50.756 1.127 45.044
Variances
MATH 24.855 8.588 2.894
Substituting the results yields
Level 1
MATHij= β0j+ rij
Level 2
β0j = 50.756 + u0j
Var(rij) = 81.237
Var(u0j) = 24.855
Table 4.3 on page 65.
- Input: ///mplus/examples/imm/ch4_p65.inp
- Output: /mplus/examples/imm/ch4_p65.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = γ00 + u0j
β1 = γ10
Here is the Mplus setup for estimating this model.
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 65, Table 4.3
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework;
within = homework; ! level 1 variables here
between = ; ! level 2 variables here (none)
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on homework; ! fixed effect
%between%
math ; ! no predictors of intercept
Here is some of the output
Estimated Intraclass Correlations for the Y Variables
Intraclass
Variable Correlation
MATH 0.194
Loglikelihood
H0 Value -1865.248
H1 Value -1865.247
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
HOMEWORK 2.391 0.255 9.393
Residual Variances
MATH 71.141 4.517 15.751
Between Level
Means
MATH 46.379 1.139 40.719
Variances
MATH 20.251 7.070 2.864
After substitution, the results are…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = 46.379 + u0j
β1 = 2.391
Var(rij) = 71.41
Var(u0) = 20.251
Table 4.4 on page 67.
- Input:/mplus/examples/imm/ch4_p67.inp
- Output: //mplus/examples/imm/ch4_p67.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = γ00 + u0j
β1 = γ10 + u1j
Here is the Mplus setup for estimating this model.
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 67, Table 4.4
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework;
within = homework; ! level 1 variables here
between = ; ! level 2 variables here (none)
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math ; ! no fixed effects
b1 | math on homework; ! random slope for homework
%between%
math; ! nothing predicts intercept
b1; ! nothing predicts slope
math with b1; ! covariance between intercept and slope
Here is some of the output
Estimated Intraclass Correlations for the Y Variables
Intraclass Intraclass
Variable Correlation Variable Correlation
MATH 0.194
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1819.518
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 53.301 3.467 15.375
Between Level
MATH WITH
B1 -26.111 9.839 -2.654
Means
MATH 46.322 1.720 26.934
B1 1.988 0.907 2.191
Variances
MATH 59.242 19.959 2.968
B1 16.754 5.822 2.878
After substitution, the results are…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = 46.322 + u0j
β1j = 1.988 + u1j
Var(rij) = 53.301
Var(u0) = 59.242
Var(u1) = 16.754
Cov(u0,u1)= -26.111
Table 4.5 on page 69.
- Input: ///mplus/examples/imm/ch4_p69.inp
- Output: /mplus/examples/imm/ch4_p69.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(PARENTED) + rij
Level 2
β0j = γ00 + u0j
β1j = γ10 + u1j
β2 = γ20
Here is the Mplus setup for estimating this model.
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 69, Table 4.5
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework parented;
within = homework parented; ! level 1 variables here
between = ; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on parented; ! fixed effect
b1 | math on homework; ! random effect
%between%
math; ! nothing predicts intercept
b1; ! nothing predicts slope
math with b1; ! covariance intercept and slope
and here are some of the results
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1801.181
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
PARENTED 1.822 0.301 6.053
Residual Variances
MATH 50.674 3.302 15.348
Between Level
MATH WITH
B1 -20.821 7.950 -2.619
Means
MATH 40.920 1.770 23.118
B1 1.889 0.813 2.325
Variances
MATH 45.419 15.921 2.853
B1 13.158 4.712 2.792
After substitution, the results are…
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(PARENTED) + rij
Level 2
β0j = 40.920 + u0j
β1j =1.889 + u1j
β2 =1.822
Var(rij) = 50.674
Var(u0) = 45.419
Var(u1) = 13.158
Cov(u0,u1)= -20.821
Table 4.6 on page 71.
A simple traditional regression analysis with HOMEWORK and PARENTED as predictors.
(We have skipped this example)
Table 4.7 on page 74.
- Input: ///mplus/examples/imm/ch4_p74.inp
- Output: /mplus/examples/imm/ch4_p74.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = γ00 + γ01(SCSIZE) + u0j
β1j = γ10 + u1j
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 74, Table 4.7
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework scsize;
within = homework; ! level 1 variables here
between = scsize; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math; ! no fixed effects
b1 | math on homework; ! random effect of homework
%between%
math on scsize; ! scsize predicts intercept
b1; ! nothing predicts homework slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1819.306
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 53.303 3.467 15.374
Between Level
MATH ON
SCSIZE 0.430 0.657 0.655
MATH WITH
B1 -27.235 10.273 -2.651
Means
B1 1.991 0.909 2.191
Intercepts
MATH 44.951 2.730 16.463
Variances
B1 16.817 5.842 2.879
Residual Variances
MATH 62.173 21.461 2.897
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = 44.951 + 0.430(SCSIZE) + u0j
β1j = 1.991 + u1j
Var(rij) = 53.303
Var(u0) = 62.173
Var(u1) = 16.817
Cov(u0,u1)= -27.235
Table 4.8 on page 75.
Variable PUBLIC is added as fixed effect and variable SCSIZE is taken out of the model.
- Input: ///mplus/examples/imm/ch4_p75.inp
- Output: /mplus/examples/imm/ch4_p75.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = γ00 + γ01(PUBLIC) + u0j
β1j = γ10 + u1j
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 75, Table 4.8
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework public;
within = homework; ! level 1 variables here
between = public; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math; ! no fixed effects
b1 | math on homework; ! random effect of homework
%between%
math on public; ! public predicts intercept
b1; ! nothing predicts homework slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1817.421
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 53.347 3.472 15.364
Between Level
MATH ON
PUBLIC -4.085 1.901 -2.150
MATH WITH
B1 -25.957 9.623 -2.698
Means
B1 1.984 0.897 2.212
Intercepts
MATH 49.067 2.113 23.220
Variances
B1 16.338 5.675 2.879
Residual Variances
MATH 56.214 19.221 2.925
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = 49.067 + -4.085(PUBLIC) + u0j
β1j = 1.984 + u1j
Var(rij) = 53.347
Var(u0) = 56.214
Var(u1) = 16.338
Cov(u0,u1)= -25.957
Table 4.10 on page 77.
This model asks whether PUBLIC can predict the relationship between MATH and HOMEWORK (i.e. B1).
- Input: ///mplus/examples/imm/ch4_p77.inp
- Output: /mplus/examples/imm/ch4_p77.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = γ00 + γ01(PUBLIC) + u0j
β1j = γ10 + γ11(PUBLIC) + u1j
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 77, Table 4.10
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework public;
within = homework; ! level 1 variables here
between = public; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math; ! no fixed effects
b1 | math on homework; ! random slope for homework
%between%
math on public; ! intercept predicted by public
b1 on public; ! slope predicted by public
math with b1; ! covariance of intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1817.386
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 53.349 3.472 15.364
Between Level
B1 ON
PUBLIC -0.498 1.874 -0.266
MATH ON
PUBLIC -3.291 3.547 -0.928
MATH WITH
B1 -25.886 9.592 -2.699
Intercepts
MATH 48.548 2.882 16.845
B1 2.308 1.514 1.525
Residual Variances
MATH 56.175 19.181 2.929
B1 16.268 5.655 2.877
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = 48.548 + -3.291(PUBLIC) + u0j
β1j = 2.308 +
-0.498(PUBLIC) + u1j
Var(rij) = 53.349
Var(u0) = 56.175
Var(u1) = 16.268
Cov(u0,u1)= -25.886
Table 4.11 on page 80. This model uses full NELS-88 data (we dont have this data, so this is omitted).
Table 4.12 on page 82.
- Input: ///mplus/examples/imm/ch4_p82.inp
- Output: /mplus/examples/imm/ch4_p82.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(WHITE) + rij
Level 2
β0j = γ00 + γ01(PUBLIC) + u0j
β1j = γ10 + u1j
β2 = γ20
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 82, Table 4.12
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework white public ;
within = homework white; ! level 1 variables here
between = public; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on white; ! fixed effect of white
b1 | math on homework; ! random effect of homework
%between%
math on public; ! public predicts intercept
b1; ! nothing predicts homework slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1811.629
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
WHITE 3.283 0.976 3.364
Residual Variances
MATH 52.627 3.427 15.355
Between Level
MATH ON
PUBLIC -3.914 1.727 -2.267
MATH WITH
B1 -25.360 9.286 -2.731
Means
B1 1.908 0.884 2.158
Intercepts
MATH 46.679 2.126 21.954
Variances
B1 15.851 5.520 2.871
Residual Variances
MATH 52.354 18.079 2.896
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(WHITE) + rij
Level 2
β0j = 46.679 + -3.914(PUBLIC) + u0j
β1j =1.908 + u1j
β2 = 3.283
Var(rij) = 52.627
Var(u0) = 52.354
Var(u1) = 15.851
Cov(u0,u1)= -25.360
Table 4.13 on page 83.
Variable WHITE is now made a random effect.
- Input: ///mplus/examples/imm/ch4_p83.inp
- Output: /mplus/examples/imm/ch4_p83.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(WHITE) + rij
Level 2
β0j = γ00 + γ01(PUBLIC) + u0j
β1j = γ10 + u1j
β2j = γ20 + u2j
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 83, Table 4.13
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework white public;
within = homework white; ! level 1 variables here
between = public; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math; ! no fixed effects
b1 | math on homework; ! random effect homework predicting math
b2 | math on white; ! random effect white predicting math
%between%
math on public; ! public predicts intercept
b1; ! nothing predicts b1 (homework slope)
b2; ! nothing predicts b2 (white slope)
math with b1; ! covariance intercept and b1
math with b2; ! covariance intercept and b2
b1 with b2; ! covariance b1 and b2
and some of the output is shown below.
Loglikelihood
H0 Value -1809.432
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 51.189 3.389 15.105
Between Level
MATH ON
PUBLIC -4.856 1.728 -2.811
MATH WITH
B1 -27.060 11.291 -2.397
B2 -18.912 18.400 -1.028
B1 WITH
B2 2.807 7.059 0.398
Means
B1 1.944 0.880 2.208
B2 2.712 1.510 1.796
Intercepts
MATH 48.061 2.455 19.581
Variances
B1 15.712 5.468 2.873
B2 21.995 19.825 1.109
Residual Variances
MATH 64.017 28.215 2.269
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(WHITE) + rij
Level 2
β0j = 48.061 + -4.856(PUBLIC) + u0j
β1j = 1.944 + u1j
β2j = 2.712 + u2j
Var(rij) = 51.189
Var(u0) = 64.017
Var(u1) = 15.172
Var(u2) = 21.995
Cov(u0,u1)= -27.060
Cov(u0,u2)= -19.912
Cov(u1,u2)= 2.807
Table 4.14 on page 85.
- Input: ///mplus/examples/imm/ch4_p85.inp
- Output: /mplus/examples/imm/ch4_p85.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(WHITE) + rij
Level 2
β0j = γ00 + γ01(PUBLIC) + γ02(MEANSES) + u0j
β1j = γ10 + u1j
β2j = γ20
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 85, Table 4.14
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework white public meanses;
within = homework white; ! level 1 variables here
between = public meanses; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on white; ! fixed effect of white
b1 | math on homework; ! random effect for homework
%between%
math on public meanses; ! intercept predicted from public, meanses
b1; ! no predictors of b1, homework random slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1808.416
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
WHITE 3.072 0.957 3.210
Residual Variances
MATH 52.710 3.437 15.335
Between Level
MATH ON
PUBLIC 0.180 2.121 0.085
MEANSES 5.052 1.831 2.759
MATH WITH
B1 -25.531 9.161 -2.787
Means
B1 1.936 0.873 2.216
Intercepts
MATH 44.637 2.140 20.861
Variances
B1 15.462 5.393 2.867
Residual Variances
MATH 50.158 17.467 2.872
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + β2(WHITE) + rij
Level 2
β0j = 44.637 + 0.180(PUBLIC)
+5.052(MEANSES) + u0j
β1j =1.936 + u1j
β2j = 3.072
Var(rij) = 52.710
Var(u0) = 50.158
Var(u1) = 15.462
Cov(u0,u1)= -25.531
Table 4.15 on page 86.
- Input: ///mplus/examples/imm/ch4_p86.inp
- Output: /mplus/examples/imm/ch4_p86.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK)
+ β2(WHITE) + rij
Level 2
β0j = γ00 + γ02(MEANSES) + u0j
β1j = γ10 + u1j
β2j = γ20
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 86, Table 4.15
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework white meanses;
within = homework white; ! level 1 variables here
between = meanses; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on white; ! fixed effect of white
b1 | math on homework; ! random effect of homework
%between%
math on meanses; ! intercept predicted from meanses
b1; ! no predictors of b1, homework random slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1808.419
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
WHITE 3.079 0.954 3.226
Residual Variances
MATH 52.710 3.437 15.334
Between Level
MATH ON
MEANSES 4.942 1.291 3.828
MATH WITH
B1 -25.519 9.156 -2.787
Means
B1 1.935 0.873 2.216
Intercepts
MATH 44.742 1.743 25.667
Variances
B1 15.455 5.389 2.868
Residual Variances
MATH 50.144 17.464 2.871
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK)
+ β2(WHITE) + rij
Level 2
β0j = 44.742 + 4.942(MEANSES) + u0j
β1j = 1.935 + u1j
β2j = 3.079
Var(rij) = 52.710
Var(u0) = 50.144
Var(u1) = 15.455
Cov(u0,u1)= -25.519
Table 4.16 on page 88.
- Input: ///mplus/examples/imm/ch4_p88.inp
- Output: /mplus/examples/imm/ch4_p88.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK)
+ β2(WHITE) + rij
Level 2
β0j = γ00 + γ02(MEANSES) + u0j
β1j = γ10 + γ12(MEANSES) + u1j
β2j = γ20
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 88, Table 4.16
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework white meanses;
within = homework white; ! level 1 variables here
between = meanses; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on white; ! fixed effect of white
b1 | math on homework; ! random effect of homework
%between%
math on meanses; ! intercept predicted from meanses
b1 on meanses; ! slope predicted from meanses
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1808.353
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
WHITE 3.084 0.955 3.231
Residual Variances
MATH 52.720 3.439 15.332
Between Level
B1 ON
MEANSES 0.565 1.560 0.362
MATH ON
MEANSES 4.011 2.878 1.394
MATH WITH
B1 -25.350 9.100 -2.786
Intercepts
MATH 44.646 1.761 25.348
B1 1.990 0.883 2.255
Residual Variances
MATH 49.945 17.371 2.875
B1 15.316 5.356 2.860
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK)
+ β2(WHITE) + rij
Level 2
β0j = 44.646 + 4.011(MEANSES) + u0j
β1j = 1.990 + 0.565(MEANSES) + u1j
β2j = 3.084
Var(rij) = 52.720
Var(u0) = 49.945
Var(u1) = 15.316
Cov(u0,u1)= -25.350
Table 4.17 on page 89.
- Input: ///mplus/examples/imm/ch4_p89.inp
- Output: /mplus/examples/imm/ch4_p89.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK)
+ β2(WHITE) + β3(SES) + rij
Level 2
β0j = γ00 + γ02(MEANSES) + u0j
β1j = γ10 + u1j
β2 = γ20
β3 = γ30
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 89, Table 4.17
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework white ses meanses;
within = homework white ses; ! level 1 variables here
between = meanses; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on white ses; ! fixed effect of white and ses
b1 | math on homework; ! random effect of homework
%between%
math on meanses; ! intercept predicted from meanses
b1 ; ! no predictors of homework slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1800.043
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
WHITE 2.254 0.974 2.314
SES 2.192 0.536 4.087
Residual Variances
MATH 51.124 3.335 15.330
Between Level
MATH ON
MEANSES 2.997 1.377 2.176
MATH WITH
B1 -23.058 8.398 -2.746
Means
B1 1.834 0.830 2.210
Intercepts
MATH 45.610 1.710 26.677
Variances
B1 13.802 4.870 2.834
Residual Variances
MATH 46.648 16.363 2.851
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK)
+ β2(WHITE) + β3(SES) + rij
Level 2
β0j = 45.610 + 2.997(MEANSES) + u0j
β1j = 1.834 + u1j
β2 = 2.254
β3 = 2.192
Var(rij) = 51.124
Var(u0) = 46.648
Var(u1) = 13.802
Cov(u0,u1)= -23.058
Table 4.19 on page 91.
- Input:/mplus/examples/imm/ch4_p91.inp
- Output: //mplus/examples/imm/ch4_p91.out
This model is…
Level 1
MATHij= β0j + β1(SES)
+ rij
Level 2
β0j = γ00 + u0j
β1j = γ10
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 91, Table 4.19
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math ses;
within = ses; ! level 1 variables here
between = ; ! level 2 variables here (none)
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on ses; ! fixed effect of ses
%between%
math ; ! no predictors of intercept
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1874.178
H1 Value -1874.178
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
SES 4.346 0.580 7.495
Residual Variances
MATH 75.190 4.774 15.749
Between Level
Means
MATH 51.200 0.831 61.649
Variances
MATH 11.866 4.685 2.533
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(SES)
+ rij
Level 2
β0j =51.200
β1j = 4.346
Var(rij) = 75.190
Var(u0) = 11.866
Table 4.20 on page 92.
- Input: ///mplus/examples/imm/ch4_p92.inp
- Output: /mplus/examples/imm/ch4_p92.out
This model is…
Level 1
MATHij= β0j + β1(SES) + rij
Level 2
β0j = γ00 + u0j
β1j = γ10 + u1j
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 92, Table 4.20
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math ses ;
within = ses; ! level 1 variables here
between = ; ! level 2 variables here (none)
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math ; ! no fixed effects
b1 | math on ses; ! random effect of ses
%between%
math ; ! no predictors of intercept
b1 ; ! no predictors of ses slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1874.197
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 74.962 4.949 15.148
Between Level
MATH WITH
B1 -0.764 4.062 -0.188
Means
MATH 51.245 0.853 60.071
B1 4.340 0.608 7.144
Variances
MATH 12.201 5.120 2.383
B1 0.380 3.926 0.097
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(SES) + rij
Level 2
β0j = 51.245 + u0j
β1j = 4.340 + u1j
Var(rij) = 74.962
Var(u0) = 12.201
Var(u1) = 0.380
Cov(u0,u1)= -0.764
Table 4.21 on page 93.
- Input: ///mplus/examples/imm/ch4_p93.inp
- Output: /mplus/examples/imm/ch4_p93.out
This model is…
Level 1
MATHij= β0j + β1(SES) + rij
Level 2
β0j = γ00 + γ01(PERCMIN)
+ u0j
β1j = γ10
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 93, Table 4.21
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math ses percmin;
within = ses; ! level 1 variables here
between = percmin; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on ses; ! fixed effect of ses ;
%between%
math on percmin; ! intercept predicted from percmin
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1871.697
H1 Value -1871.696
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
SES 4.329 0.573 7.550
Residual Variances
MATH 75.010 4.753 15.781
Between Level
MATH ON
PERCMIN -0.804 0.350 -2.295
Intercepts
MATH 53.119 1.130 47.024
Residual Variances
MATH 9.496 3.792 2.504
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(SES) + rij
Level 2
β0j = 53.119 + -0.804(PERCMIN)
+ u0j
β1j = 4.329
Var(rij) = 75.010
Var(u0) = 9.496
Table 4.22 on page 95.
- Input: ///mplus/examples/imm/ch4_p95.inp
- Output: /mplus/examples/imm/ch4_p95.out
This model is…
Level 1
MATHij= β0j + β1(SES) + rij
Level 2
β0j = γ00 + γ01(PERCMIN) + γ02(MEANSES)
+ u0j
β1j = γ10
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 95, Table 4.22
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math ses percmin meanses;
within = ses; ! level 1 variables here
between = percmin meanses; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math on ses; ! fixed effect of ses
%between%
math on percmin meanses; ! intercept predicted from percmin and meanses
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1869.804
H1 Value -1869.803
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
MATH ON
SES 3.865 0.609 6.345
Residual Variances
MATH 75.083 4.763 15.766
Between Level
MATH ON
PERCMIN -0.683 0.323 -2.113
MEANSES 2.905 1.397 2.079
Intercepts
MATH 53.085 1.031 51.490
Residual Variances
MATH 7.215 3.177 2.271
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(SES) + rij
Level 2
β0j = 53.085 + -0.683(PERCMIN) +
2.905(MEANSES)
+ u0j
β1j = 3.865
Var(rij) = 75.083
Var(u0) = 7.215
Table 4.23 and Table 4.24 on page 97.
Analyses with NELS-88, models 2 and 3 (we do not have this data, so these analyses are omitted).
Table 4.25 on page 99.
- Input: ///mplus/examples/imm/ch4_p99.inp
- Output: /mplus/examples/imm/ch4_p99.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = γ00 + γ01(RATIO)
+ u0j
β1j = γ10 + u1j
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 99, Table 4.25
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework ratio;
within = homework; ! level 1 variables here
between = ratio; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math ; ! no fixed effects
b1 | math on homework; ! random effect of homework
%between%
math on ratio; ! intercept predicted from ratio
b1 ; ! no predictors of homework slope
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1819.409
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 53.304 3.467 15.373
Between Level
MATH ON
RATIO -0.095 0.204 -0.468
MATH WITH
B1 -26.220 9.870 -2.657
Means
B1 1.988 0.908 2.190
Intercepts
MATH 47.973 3.922 12.232
Variances
B1 16.776 5.831 2.877
Residual Variances
MATH 59.268 20.000 2.963
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = 47.973 + -0.095(RATIO) + u0j
β1j = 1.988 + u1j
Var(rij) = 53.304
Var(u0) = 59.268
Var(u1) = 16.776
Cov(u0,u1)= -26.220
Table 4.26 on page 100.
- Input: //mplus/examples/imm/ch4_p100.inp
- Output: //mplus/examples/imm/ch4_p100.out
This model is…
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = γ00 + u0j
β1j = γ10 + γ01(RATIO) + u1j
The Mplus setup is shown below
title:
Introducing Multilevel Modeling by Kreft and de Leeuw.
Page 100, Table 4.26
data:
file = imm23.dat ;
variable:
names = schid stuid ses meanses homework white parented public
ratio percmin math sex race sctype cstr scsize urban region;
cluster = schid;
usevar = math homework ratio;
within = homework; ! level 1 variables here
between = ratio; ! level 2 variables here
analysis:
type = twolevel random;
estimator = ml;
model:
%within%
math ; ! no fixed effects
b1 | math on homework; ! random effect of homework
%between%
math ; ! no predictors of intercept
b1 on ratio; ! homework slope predicted from ratio
math with b1; ! covariance intercept and slope
and some of the output is shown below.
TESTS OF MODEL FIT
Loglikelihood
H0 Value -1819.397
MODEL RESULTS
Estimates S.E. Est./S.E.
Within Level
Residual Variances
MATH 53.307 3.468 15.372
Between Level
B1 ON
RATIO -0.053 0.107 -0.495
MATH WITH
B1 -26.232 9.857 -2.661
Means
MATH 46.320 1.721 26.917
Intercepts
B1 2.909 2.065 1.408
Variances
MATH 59.318 19.984 2.968
Residual Variances
B1 16.760 5.824 2.878
And here are the results substituted back into the model.
Level 1
MATHij= β0j + β1(HOMEWORK) + rij
Level 2
β0j = 46.320 + u0j
β1j = 2.909 + -0.053(RATIO) + u1j
Var(rij) = 53.307
Var(u0) = 59.318
Var(u1) = 16.760
Cov(u0,u1)= -26.232
Table 4.27 on page 101.
Analyses with NELS-88, (we do not have this data, so these analyses are omitted).
