------------------------------------------------------------------------------------------------------------------------------------------------------
name: STATA_Chapter11b
log: C:\Dropbox\PilesOfVariance\Chapter11b\STATA\STATA_Chapter11b_Output.smcl
log type: smcl
opened on: 25 Oct 2014, 18:30:52
.
. display as result "Chapter 11b: Descriptive Statistics for Student and Year-Specific Class Variables"
Chapter 11b: Descriptive Statistics for Student and Year-Specific Class Variables
. preserve
. collapse girl classid_year0 grade_year0 classid_year1 grade_year1 classid_year2 grade_year2, by(studentid)
. tabulate girl
(mean) girl | Freq. Percent Cum.
------------+-----------------------------------
0 | 263 54.12 54.12
1 | 223 45.88 100.00
------------+-----------------------------------
Total | 486 100.00
. tabulate classid_year0 grade_year0
(mean) |
classid_ye | (mean) grade_year0
ar0 | 3 4 5 | Total
-----------+---------------------------------+----------
1 | 24 0 0 | 24
3 | 24 0 0 | 24
4 | 25 0 0 | 25
5 | 21 0 0 | 21
6 | 25 0 0 | 25
7 | 22 0 0 | 22
8 | 0 24 0 | 24
10 | 0 24 0 | 24
11 | 0 22 0 | 22
12 | 0 21 0 | 21
13 | 0 25 0 | 25
14 | 0 22 0 | 22
15 | 0 0 26 | 26
16 | 0 0 12 | 12
17 | 0 0 22 | 22
18 | 0 0 21 | 21
19 | 0 0 27 | 27
20 | 0 0 23 | 23
-----------+---------------------------------+----------
Total | 141 138 131 | 410
. tabulate classid_year1 grade_year1
(mean) |
classid_ye | (mean) grade_year1
ar1 | 4 5 6 | Total
-----------+---------------------------------+----------
21 | 22 0 0 | 22
23 | 18 0 0 | 18
24 | 21 0 0 | 21
25 | 21 0 0 | 21
26 | 21 0 0 | 21
27 | 20 0 0 | 20
28 | 0 24 0 | 24
29 | 0 11 0 | 11
30 | 0 21 0 | 21
31 | 0 24 0 | 24
32 | 0 23 0 | 23
33 | 0 21 0 | 21
34 | 0 24 0 | 24
35 | 0 0 23 | 23
36 | 0 0 22 | 22
37 | 0 0 19 | 19
38 | 0 0 20 | 20
39 | 0 0 17 | 17
40 | 0 0 13 | 13
41 | 0 0 18 | 18
-----------+---------------------------------+----------
Total | 123 148 132 | 403
. tabulate classid_year2 grade_year2
(mean) |
classid_ye | (mean) grade_year2
ar2 | 5 6 7 | Total
-----------+---------------------------------+----------
42 | 15 0 0 | 15
43 | 13 0 0 | 13
44 | 17 0 0 | 17
45 | 24 0 0 | 24
46 | 24 0 0 | 24
47 | 20 0 0 | 20
48 | 16 0 0 | 16
49 | 0 26 0 | 26
50 | 0 26 0 | 26
51 | 0 25 0 | 25
52 | 0 20 0 | 20
53 | 0 25 0 | 25
54 | 0 12 0 | 12
55 | 0 26 0 | 26
56 | 0 0 17 | 17
57 | 0 0 20 | 20
59 | 0 0 16 | 16
60 | 0 0 19 | 19
61 | 0 0 20 | 20
63 | 0 0 20 | 20
-----------+---------------------------------+----------
Total | 129 160 112 | 401
. restore
.
. display as result "Chapter 11b: Descriptive Statistics for Level-1 Time-Varying Student Variables"
Chapter 11b: Descriptive Statistics for Level-1 Time-Varying Student Variables
. summarize cmgirl effort aggression
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
cmgirl | 1214 .4588138 .0672026 .2941177 .65
effort | 1214 3.992586 .9862525 1 5
aggression | 1214 1.534843 .7536233 1 5
.
. display as result "Ch 11b: Empty Means, Two-Level Model of Years Within Students"
Ch 11b: Empty Means, Two-Level Model of Years Within Students
. display as result "Predicting Teacher-Perceived Student Effort"
Predicting Teacher-Perceived Student Effort
. mixed effort , ///
> || studentid: , variance reml covariance(unstructured),
Note: single-variable random-effects specification in studentid equation; covariance structure set to identity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1537.7393
Iteration 1: log restricted-likelihood = -1537.7393
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: studentid Number of groups = 486
Obs per group: min = 1
avg = 2.5
max = 3
Wald chi2(0) = .
Log restricted-likelihood = -1537.7393 Prob > chi2 = .
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 3.969861 .0395376 100.41 0.000 3.892368 4.047353
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid: Identity |
var(_cons) | .5803778 .0498155 .4905121 .6867075
-----------------------------+------------------------------------------------
var(Residual) | .4054679 .0212811 .3658315 .4493989
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 340.38 Prob >= chibar2 = 0.0000
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1537.739 3 3081.479 3085.968
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estat icc,
Intraclass correlation
------------------------------------------------------------------------------
Level | ICC Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid | .5887105 .0263621 .5362476 .6392313
------------------------------------------------------------------------------
. estat wcorrelation, covariance,
Covariances for studentid = 4101:
obs | 1 2
-------------+----------------
1 | 0.986
2 | 0.580 0.986
. estat wcorrelation,
Standard deviations and correlations for studentid = 4101:
Standard deviations:
obs | 1 2
-------------+----------------
sd | 0.993 0.993
Correlations:
obs | 1 2
-------------+----------------
1 | 1.000
2 | 0.589 1.000
. estimates store FitEmpty2E,
.
. display as result "Ch 11b: Saturated Means, Unstructured Variance Model"
Ch 11b: Saturated Means, Unstructured Variance Model
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort i.year, ///
> || studentid: , noconstant variance reml covariance(unstructured) ///
> residuals(unstructured,t(year)),
Obtaining starting values by EM:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1707.5747 (not concave)
Iteration 1: log restricted-likelihood = -1535.7878
Iteration 2: log restricted-likelihood = -1531.8154
Iteration 3: log restricted-likelihood = -1531.7134
Iteration 4: log restricted-likelihood = -1531.7134
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: studentid Number of groups = 486
Obs per group: min = 1
avg = 2.5
max = 3
Wald chi2(2) = 18.52
Log restricted-likelihood = -1531.7134 Prob > chi2 = 0.0001
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year |
1 | -.1738107 .0440617 -3.94 0.000 -.2601701 -.0874513
2 | -.1527432 .0462096 -3.31 0.001 -.2433123 -.062174
|
_cons | 4.076956 .0454651 89.67 0.000 3.987846 4.166066
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid: (empty) |
-----------------------------+------------------------------------------------
Residual: Unstructured |
var(e0) | .9039167 .0635038 .7876406 1.037358
var(e1) | 1.024251 .071172 .8938383 1.173691
var(e2) | 1.015324 .0715851 .8842825 1.165785
cov(e0,e1) | .5941793 .0571809 .4821068 .7062517
cov(e0,e2) | .5578924 .0549528 .4501869 .6655979
cov(e1,e2) | .5964931 .0588415 .4811659 .7118204
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(5) = 351.72 Prob > chi2 = 0.0000
Note: The reported degrees of freedom assumes the null hypothesis is not on the boundary of the parameter space. If this is not true, then the
reported test is conservative.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1531.713 9 3081.427 3094.895
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estat wcorrelation, covariance,
Covariances for studentid = 4101:
year | 0 2
-------------+----------------
0 | 0.904
2 | 0.558 1.015
. estat wcorrelation,
Standard deviations and correlations for studentid = 4101:
Standard deviations:
year | 0 2
-------------+----------------
sd | 0.951 1.008
Correlations:
year | 0 2
-------------+----------------
0 | 1.000
2 | 0.582 1.000
. contrast i.year,
Contrasts of marginal linear predictions
Margins : asbalanced
------------------------------------------------
| df chi2 P>chi2
-------------+----------------------------------
effort |
year | 2 18.52 0.0001
------------------------------------------------
. margins i.year,
Adjusted predictions Number of obs = 1214
Expression : Linear prediction, fixed portion, predict()
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year |
0 | 4.076956 .0454651 89.67 0.000 3.987846 4.166066
1 | 3.903146 .0486635 80.21 0.000 3.807767 3.998524
2 | 3.924213 .0486051 80.74 0.000 3.828949 4.019477
------------------------------------------------------------------------------
. margins i.year, pwcompare(pveffects)
Pairwise comparisons of adjusted predictions
Expression : Linear prediction, fixed portion, predict()
-----------------------------------------------------
| Delta-method Unadjusted
| Contrast Std. Err. z P>|z|
-------------+---------------------------------------
year |
1 vs 0 | -.1738107 .0440617 -3.94 0.000
2 vs 0 | -.1527432 .0462096 -3.31 0.001
2 vs 1 | .0210675 .0474434 0.44 0.657
-----------------------------------------------------
. estimates store FitSatUN2E,
.
. display as result "Ch 11b: Piecewise Means, Random Intercept Model"
Ch 11b: Piecewise Means, Random Intercept Model
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort c.year01 c.year12, ///
> || studentid: , variance reml covariance(unstructured),
Note: single-variable random-effects specification in studentid equation; covariance structure set to identity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1533.867
Iteration 1: log restricted-likelihood = -1533.867
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: studentid Number of groups = 486
Obs per group: min = 1
avg = 2.5
max = 3
Wald chi2(2) = 16.81
Log restricted-likelihood = -1533.867 Prob > chi2 = 0.0002
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year01 | -.1706236 .0455843 -3.74 0.000 -.2599671 -.08128
year12 | .0183308 .0460471 0.40 0.691 -.0719198 .1085815
_cons | 3.905594 .0476495 81.97 0.000 3.812203 3.998985
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid: Identity |
var(_cons) | .5820944 .0496825 .4924274 .6880889
-----------------------------+------------------------------------------------
var(Residual) | .3979364 .020911 .3589915 .4411062
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 347.42 Prob >= chibar2 = 0.0000
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1533.867 5 3077.734 3085.216
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estimates store FitPieceRI2E,
. lrtest FitSatUN2E FitPieceRI2E, force
Likelihood-ratio test LR chi2(4) = 4.31
(Assumption: FitPieceRI2E nested in FitSatUN2E) Prob > chi2 = 0.3660
.
. display as result "Eq 11b.13: Adding Fixed Effects of Year-Specific Class"
Eq 11b.13: Adding Fixed Effects of Year-Specific Class
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort c.year01 c.year12 ///
> i.classid_year0#c.aclass0 i.classid_year1#c.aclass1 i.classid_year2#c.aclass2, ///
> || studentid: , variance reml covariance(unstructured),
Note: single-variable random-effects specification in studentid equation; covariance structure set to identity
note: 20.classid_year0#c.aclass0 omitted because of collinearity
note: 9999.classid_year0#c.aclass0 omitted because of collinearity
note: 41.classid_year1#c.aclass1 omitted because of collinearity
note: 9999.classid_year1#c.aclass1 omitted because of collinearity
note: 63.classid_year2#c.aclass2 omitted because of collinearity
note: 9999.classid_year2#c.aclass2 omitted because of collinearity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1474.4658
Iteration 1: log restricted-likelihood = -1474.4658
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: studentid Number of groups = 486
Obs per group: min = 1
avg = 2.5
max = 3
Wald chi2(57) = 248.98
Log restricted-likelihood = -1474.4658 Prob > chi2 = 0.0000
-----------------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
------------------------+----------------------------------------------------------------
year01 | .6720617 .2225141 3.02 0.003 .2359421 1.108181
year12 | -.3713233 .2208165 -1.68 0.093 -.8041156 .061469
|
classid_year0#c.aclass0 |
1 | .5248732 .218988 2.40 0.017 .0956646 .9540819
3 | .6041735 .2184713 2.77 0.006 .1759776 1.032369
4 | .7556879 .2167978 3.49 0.000 .330772 1.180604
5 | .3248628 .2272823 1.43 0.153 -.1206022 .7703279
6 | -.4750732 .2163642 -2.20 0.028 -.8991392 -.0510072
7 | .3400593 .2240093 1.52 0.129 -.0989909 .7791095
8 | .4521102 .2165746 2.09 0.037 .0276319 .8765886
10 | .8411267 .2165718 3.88 0.000 .4166538 1.2656
11 | .4883478 .22006 2.22 0.026 .0570382 .9196575
12 | .6711356 .2254849 2.98 0.003 .2291934 1.113078
13 | .655718 .2138803 3.07 0.002 .2365203 1.074916
14 | .3955473 .2206134 1.79 0.073 -.0368469 .8279415
15 | .4982726 .2028271 2.46 0.014 .1007387 .8958064
16 | .645392 .2641667 2.44 0.015 .1276349 1.163149
17 | .2646329 .2120531 1.25 0.212 -.1509835 .6802494
18 | .7679011 .2145505 3.58 0.000 .34739 1.188412
19 | .2087385 .1989006 1.05 0.294 -.1810995 .5985765
20 | 0 (omitted)
9999 | 0 (omitted)
|
classid_year1#c.aclass1 |
21 | -.3010473 .2358686 -1.28 0.202 -.7633413 .1612467
23 | .0700217 .2466995 0.28 0.777 -.4135004 .5535438
24 | -.3905187 .2375651 -1.64 0.100 -.8561376 .0751003
25 | -.1677703 .2367989 -0.71 0.479 -.6318877 .296347
26 | -.41398 .2371487 -1.75 0.081 -.8787828 .0508229
27 | -.4815539 .2388512 -2.02 0.044 -.9496937 -.0134141
28 | -.2953511 .2305018 -1.28 0.200 -.7471264 .1564242
29 | -.9708222 .3064035 -3.17 0.002 -1.571362 -.3702823
30 | -.4296303 .2365464 -1.82 0.069 -.8932527 .0339921
31 | -.436422 .2299892 -1.90 0.058 -.8871926 .0143485
32 | -.5116981 .2318357 -2.21 0.027 -.9660876 -.0573085
33 | -1.01167 .2358346 -4.29 0.000 -1.473897 -.5494423
34 | -.2054747 .2310338 -0.89 0.374 -.6582927 .2473434
35 | -.3018398 .224326 -1.35 0.178 -.7415107 .1378311
36 | -.4828236 .2218618 -2.18 0.030 -.9176647 -.0479825
37 | -.3025605 .2310581 -1.31 0.190 -.7554261 .1503051
38 | -.7548794 .2293674 -3.29 0.001 -1.204431 -.3053276
39 | -.6238135 .2400438 -2.60 0.009 -1.094291 -.1533362
40 | -.45745 .2684229 -1.70 0.088 -.9835493 .0686492
41 | 0 (omitted)
9999 | 0 (omitted)
|
classid_year2#c.aclass2 |
42 | .2132898 .2481558 0.86 0.390 -.2730866 .6996662
43 | .5280878 .2775166 1.90 0.057 -.0158347 1.07201
44 | .1299444 .2401948 0.54 0.589 -.3408288 .6007175
45 | -.0550547 .2224303 -0.25 0.805 -.49101 .3809007
46 | -.0733091 .2223145 -0.33 0.742 -.5090376 .3624193
47 | -.8169798 .2311737 -3.53 0.000 -1.270072 -.3638877
48 | -.2093384 .2434195 -0.86 0.390 -.6864319 .2677551
49 | .3946721 .2203423 1.79 0.073 -.0371908 .826535
50 | -.0657802 .220599 -0.30 0.766 -.4981463 .3665858
51 | .2025007 .2205098 0.92 0.358 -.2296905 .6346919
52 | .2120589 .2300273 0.92 0.357 -.2387864 .6629041
53 | .1830789 .2204825 0.83 0.406 -.2490589 .6152168
54 | .0480484 .294554 0.16 0.870 -.5292668 .6253636
55 | .4644237 .2195459 2.12 0.034 .0341217 .8947258
56 | -.0513745 .2304614 -0.22 0.824 -.5030705 .4003215
57 | -.3861951 .2168755 -1.78 0.075 -.8112632 .038873
59 | -.6326683 .233994 -2.70 0.007 -1.091288 -.1740485
60 | -.2030365 .2228387 -0.91 0.362 -.6397923 .2337192
61 | -.3395807 .2168895 -1.57 0.117 -.7646763 .0855148
63 | 0 (omitted)
9999 | 0 (omitted)
|
_cons | 4.307554 .1749906 24.62 0.000 3.964579 4.65053
-----------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid: Identity |
var(_cons) | .5959883 .0499542 .5056992 .7023979
-----------------------------+------------------------------------------------
var(Residual) | .3254535 .0179208 .2921583 .3625432
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 375.18 Prob >= chibar2 = 0.0000
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1474.466 60 3068.932 3158.722
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
.
. display as result "Eq 11b.14: Adding Random Acute Year-Specific Class Effects"
Eq 11b.14: Adding Random Acute Year-Specific Class Effects
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort c.year01 c.year12, ///
> || _all: r.studentid, variance reml ///
> || _all: r.aclass0_year0, ///
> || _all: r.aclass1_year1, ///
> || _all: r.aclass2_year2, ,
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1492.3243
Iteration 1: log restricted-likelihood = -1492.3243
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: _all Number of groups = 1
Obs per group: min = 1214
avg = 1214.0
max = 1214
Wald chi2(2) = 0.26
Log restricted-likelihood = -1492.3243 Prob > chi2 = 0.8789
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year01 | -.1816525 .3703219 -0.49 0.624 -.9074701 .544165
year12 | .0205965 .3785597 0.05 0.957 -.7213669 .76256
_cons | 3.894344 .4152209 9.38 0.000 3.080526 4.708162
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
var(R.studen~d) | .5924874 .0492172 .5034668 .6972482
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r0) | .0808217 .0352129 .0344089 .1898388
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r1) | .0476614 .0251064 .016974 .1338289
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r2) | .0870628 .0378152 .0371637 .2039609
-----------------------------+------------------------------------------------
var(Residual) | .3262477 .017905 .2929761 .3632977
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(4) = 430.50 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1492.324 8 3000.649 3012.621
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estimates store FitClassAcuteE,
. lrtest FitClassAcuteE FitPieceRI2E,
Likelihood-ratio test LR chi2(3) = 83.09
(Assumption: FitPieceRI2E nested in FitClassAcuteE) Prob > chi2 = 0.0000
Note: The reported degrees of freedom assumes the null hypothesis is not on the boundary of the parameter space. If this is not true, then the
reported test is conservative.
Note: LR tests based on REML are valid only when the fixed-effects specification is identical for both models.
.
. display as result "Ch 11b: Adding Random Transfer Class Effects Instead"
Ch 11b: Adding Random Transfer Class Effects Instead
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort c.year01 c.year12, ///
> || _all: r.studentid, variance reml ///
> || _all: r.tclass0_year0, ///
> || _all: r.tclass1_year1, ///
> || _all: r.tclass2_year2, ,
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1509.0448
Iteration 1: log restricted-likelihood = -1509.0448
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: _all Number of groups = 1
Obs per group: min = 1214
avg = 1214.0
max = 1214
Wald chi2(2) = 0.67
Log restricted-likelihood = -1509.0448 Prob > chi2 = 0.7141
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year01 | -.1690967 .2065457 -0.82 0.413 -.5739187 .2357254
year12 | .022338 .3208065 0.07 0.944 -.6064313 .6511072
_cons | 3.909181 .3201013 12.21 0.000 3.281794 4.536568
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
var(R.studen~d) | .5447431 .0474845 .4591913 .646234
-----------------------------+------------------------------------------------
_all: Identity |
var(R.tclas~r0) | .044806 .0251506 .0149121 .1346278
-----------------------------+------------------------------------------------
_all: Identity |
var(R.tclas~r1) | .0388674 .0208331 .0135937 .1111305
-----------------------------+------------------------------------------------
_all: Identity |
var(R.tclas~r2) | .0960317 .0413607 .041286 .2233707
-----------------------------+------------------------------------------------
var(Residual) | .3570838 .0193652 .3210762 .3971295
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(4) = 397.06 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1509.045 8 3034.09 3046.062
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estimates store FitClassTransE,
. lrtest FitClassTransE FitPieceRI2E,
Likelihood-ratio test LR chi2(3) = 49.64
(Assumption: FitPieceRI2E nested in FitClassTransE) Prob > chi2 = 0.0000
Note: The reported degrees of freedom assumes the null hypothesis is not on the boundary of the parameter space. If this is not true, then the
reported test is conservative.
Note: LR tests based on REML are valid only when the fixed-effects specification is identical for both models.
.
. display as result "Eq 11b.15: Adding Year-Specific Effects of Class Grade"
Eq 11b.15: Adding Year-Specific Effects of Class Grade
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort c.year01 c.year12 ///
> i.grade#c.aclass0 i.grade#c.aclass1 i.grade#c.aclass2, ///
> || _all: r.studentid, variance reml ///
> || _all: r.aclass0_year0, ///
> || _all: r.aclass1_year1, ///
> || _all: r.aclass2_year2, ,
note: 5.grade#c.aclass0 omitted because of collinearity
note: 6.grade#c.aclass0 omitted because of collinearity
note: 7.grade#c.aclass0 omitted because of collinearity
note: 3.grade#c.aclass1 omitted because of collinearity
note: 6.grade#c.aclass1 omitted because of collinearity
note: 7.grade#c.aclass1 omitted because of collinearity
note: 3.grade#c.aclass2 omitted because of collinearity
note: 4.grade#c.aclass2 omitted because of collinearity
note: 7.grade#c.aclass2 omitted because of collinearity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1491.3134
Iteration 1: log restricted-likelihood = -1491.3134
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: _all Number of groups = 1
Obs per group: min = 1214
avg = 1214.0
max = 1214
Wald chi2(8) = 14.55
Log restricted-likelihood = -1491.3134 Prob > chi2 = 0.0685
---------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
----------------+----------------------------------------------------------------
year01 | -.1341131 .3834671 -0.35 0.727 -.8856948 .6174686
year12 | -.2204311 .3399708 -0.65 0.517 -.8867617 .4458994
|
grade#c.aclass0 |
3 | -.0358766 .2018495 -0.18 0.859 -.4314944 .3597412
4 | .1877634 .2014145 0.93 0.351 -.2070017 .5825286
5 | 0 (omitted)
6 | 0 (omitted)
7 | 0 (omitted)
|
grade#c.aclass1 |
3 | 0 (omitted)
4 | .143459 .1592492 0.90 0.368 -.1686637 .4555817
5 | -.111983 .1536585 -0.73 0.466 -.4131481 .1891821
6 | 0 (omitted)
7 | 0 (omitted)
|
grade#c.aclass2 |
3 | 0 (omitted)
4 | 0 (omitted)
5 | .2073318 .1765684 1.17 0.240 -.1387359 .5533995
6 | .4818956 .1737779 2.77 0.006 .1412972 .8224939
7 | 0 (omitted)
|
_cons | 3.890585 .3890753 10.00 0.000 3.128011 4.653159
---------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
var(R.studen~d) | .5909331 .0491594 .5020273 .6955834
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r0) | .0832629 .0381086 .033952 .2041916
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r1) | .0387983 .0222329 .0126195 .1192843
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r2) | .0559651 .0287618 .0204393 .1532391
-----------------------------+------------------------------------------------
var(Residual) | .3271185 .0179757 .2937176 .3643175
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(4) = 414.12 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1491.313 14 3010.627 3031.578
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. * Grade 3 vs 4 at Year 0
. test 3.grade#c.aclass0=4.grade#c.aclass0
( 1) [effort]3b.grade#c.aclass0 - [effort]4.grade#c.aclass0 = 0
chi2( 1) = 1.25
Prob > chi2 = 0.2636
. * Grade 3 vs 5 at Year 0
. test 3.grade#c.aclass0=5.grade#c.aclass0
( 1) [effort]3b.grade#c.aclass0 - [effort]5o.grade#co.aclass0 = 0
chi2( 1) = 0.03
Prob > chi2 = 0.8589
. * Grade 4 vs 5 at Year 0
. test 4.grade#c.aclass0=5.grade#c.aclass0
( 1) [effort]4.grade#c.aclass0 - [effort]5o.grade#co.aclass0 = 0
chi2( 1) = 0.87
Prob > chi2 = 0.3512
. * Grade 4 vs 5 at Year 1
. test 4.grade#c.aclass1=5.grade#c.aclass1
( 1) [effort]4.grade#c.aclass1 - [effort]5.grade#c.aclass1 = 0
chi2( 1) = 2.65
Prob > chi2 = 0.1039
. * Grade 4 vs 6 at Year 1
. test 4.grade#c.aclass1=6.grade#c.aclass1
( 1) [effort]4.grade#c.aclass1 - [effort]6o.grade#co.aclass1 = 0
chi2( 1) = 0.81
Prob > chi2 = 0.3677
. * Grade 5 vs 6 at Year 1
. test 5.grade#c.aclass1=6.grade#c.aclass1
( 1) [effort]5.grade#c.aclass1 - [effort]6o.grade#co.aclass1 = 0
chi2( 1) = 0.53
Prob > chi2 = 0.4661
. * Grade 5 vs 6 at Year 2
. test 5.grade#c.aclass2=6.grade#c.aclass2
( 1) [effort]5.grade#c.aclass2 - [effort]6.grade#c.aclass2 = 0
chi2( 1) = 2.66
Prob > chi2 = 0.1028
. * Grade 5 vs 7 at Year 2
. test 5.grade#c.aclass2=7.grade#c.aclass2
( 1) [effort]5.grade#c.aclass2 - [effort]7o.grade#co.aclass2 = 0
chi2( 1) = 1.38
Prob > chi2 = 0.2403
. * Grade 6 vs 7 at Year 2
. test 6.grade#c.aclass2=7.grade#c.aclass2
( 1) [effort]6.grade#c.aclass2 - [effort]7o.grade#co.aclass2 = 0
chi2( 1) = 7.69
Prob > chi2 = 0.0056
.
. display as result "Eq 11b.16: Adding Student Gender and Year-Specific Class Contextual Gender Effects"
Eq 11b.16: Adding Student Gender and Year-Specific Class Contextual Gender Effects
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort c.year01 c.year12 ///
> i.grade#c.aclass0 i.grade#c.aclass1 i.grade#c.aclass2 ///
> c.girl c.cmgirl50#c.aclass0 c.cmgirl50#c.aclass1 c.cmgirl50#c.aclass2, ///
> || _all: r.studentid, variance reml ///
> || _all: r.aclass0_year0, ///
> || _all: r.aclass1_year1, ///
> || _all: r.aclass2_year2, ,
note: 5.grade#c.aclass0 omitted because of collinearity
note: 6.grade#c.aclass0 omitted because of collinearity
note: 7.grade#c.aclass0 omitted because of collinearity
note: 3.grade#c.aclass1 omitted because of collinearity
note: 6.grade#c.aclass1 omitted because of collinearity
note: 7.grade#c.aclass1 omitted because of collinearity
note: 3.grade#c.aclass2 omitted because of collinearity
note: 4.grade#c.aclass2 omitted because of collinearity
note: 7.grade#c.aclass2 omitted because of collinearity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1484.1447
Iteration 1: log restricted-likelihood = -1484.1447
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: _all Number of groups = 1
Obs per group: min = 1214
avg = 1214.0
max = 1214
Wald chi2(12) = 25.61
Log restricted-likelihood = -1484.1447 Prob > chi2 = 0.0122
--------------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------------+----------------------------------------------------------------
year01 | -.1641097 .3993688 -0.41 0.681 -.9468582 .6186388
year12 | -.2394524 .3636233 -0.66 0.510 -.9521411 .4732362
|
grade#c.aclass0 |
3 | -.0579069 .20553 -0.28 0.778 -.4607383 .3449244
4 | .202769 .2047064 0.99 0.322 -.198448 .6039861
5 | 0 (omitted)
6 | 0 (omitted)
7 | 0 (omitted)
|
grade#c.aclass1 |
3 | 0 (omitted)
4 | .1357492 .163101 0.83 0.405 -.1839229 .4554213
5 | -.1122326 .1575368 -0.71 0.476 -.420999 .1965339
6 | 0 (omitted)
7 | 0 (omitted)
|
grade#c.aclass2 |
3 | 0 (omitted)
4 | 0 (omitted)
5 | .2177952 .184428 1.18 0.238 -.143677 .5792674
6 | .4919126 .1795045 2.74 0.006 .1400903 .8437349
7 | 0 (omitted)
|
girl | .2612861 .0776729 3.36 0.001 .1090501 .4135221
|
c.cmgirl50#c.aclass0 | .8410395 1.399843 0.60 0.548 -1.902602 3.584681
|
c.cmgirl50#c.aclass1 | -.154803 1.074727 -0.14 0.885 -2.261229 1.951623
|
c.cmgirl50#c.aclass2 | -.3707734 .7947857 -0.47 0.641 -1.928525 1.186978
|
_cons | 3.765733 .4047345 9.30 0.000 2.972468 4.558998
--------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
var(R.studen~d) | .5774793 .048251 .4902467 .6802337
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r0) | .0865021 .0406699 .0344211 .2173845
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r1) | .0430426 .02439 .0141764 .1306862
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r2) | .0613587 .0315805 .0223755 .1682591
-----------------------------+------------------------------------------------
var(Residual) | .3264741 .0179212 .2931727 .3635581
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(4) = 409.51 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1484.145 18 3004.289 3031.227
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. * Multivariate Test of Year-Specific Class Contextual Gender Effects
. test (c.cmgirl50#c.aclass0=0) (c.cmgirl50#c.aclass1=0) (c.cmgirl50#c.aclass2=0)
( 1) [effort]c.cmgirl50#c.aclass0 = 0
( 2) [effort]c.cmgirl50#c.aclass1 = 0
( 3) [effort]c.cmgirl50#c.aclass2 = 0
chi2( 3) = 0.60
Prob > chi2 = 0.8956
. * Grade 3 vs 4 at Year 0
. test 3.grade#c.aclass0=4.grade#c.aclass0
( 1) [effort]3b.grade#c.aclass0 - [effort]4.grade#c.aclass0 = 0
chi2( 1) = 1.58
Prob > chi2 = 0.2086
. * Grade 3 vs 5 at Year 0
. test 3.grade#c.aclass0=5.grade#c.aclass0
( 1) [effort]3b.grade#c.aclass0 - [effort]5o.grade#co.aclass0 = 0
chi2( 1) = 0.08
Prob > chi2 = 0.7781
. * Grade 4 vs 5 at Year 0
. test 4.grade#c.aclass0=5.grade#c.aclass0
( 1) [effort]4.grade#c.aclass0 - [effort]5o.grade#co.aclass0 = 0
chi2( 1) = 0.98
Prob > chi2 = 0.3219
. * Grade 4 vs 5 at Year 1
. test 4.grade#c.aclass1=5.grade#c.aclass1
( 1) [effort]4.grade#c.aclass1 - [effort]5.grade#c.aclass1 = 0
chi2( 1) = 2.38
Prob > chi2 = 0.1228
. * Grade 4 vs 6 at Year 1
. test 4.grade#c.aclass1=6.grade#c.aclass1
( 1) [effort]4.grade#c.aclass1 - [effort]6o.grade#co.aclass1 = 0
chi2( 1) = 0.69
Prob > chi2 = 0.4052
. * Grade 5 vs 6 at Year 1
. test 5.grade#c.aclass1=6.grade#c.aclass1
( 1) [effort]5.grade#c.aclass1 - [effort]6o.grade#co.aclass1 = 0
chi2( 1) = 0.51
Prob > chi2 = 0.4762
. * Grade 5 vs 6 at Year 2
. test 5.grade#c.aclass2=6.grade#c.aclass2
( 1) [effort]5.grade#c.aclass2 - [effort]6.grade#c.aclass2 = 0
chi2( 1) = 2.51
Prob > chi2 = 0.1128
. * Grade 5 vs 7 at Year 2
. test 5.grade#c.aclass2=7.grade#c.aclass2
( 1) [effort]5.grade#c.aclass2 - [effort]7o.grade#co.aclass2 = 0
chi2( 1) = 1.39
Prob > chi2 = 0.2376
. * Grade 6 vs 7 at Year 2
. test 6.grade#c.aclass2=7.grade#c.aclass2
( 1) [effort]6.grade#c.aclass2 - [effort]7o.grade#co.aclass2 = 0
chi2( 1) = 7.51
Prob > chi2 = 0.0061
. * Between-Class Gender Effect at Year 0
. lincom c.girl*1 + c.cmgirl50#c.aclass0*1
( 1) [effort]girl + [effort]c.cmgirl50#c.aclass0 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 1.102326 1.400698 0.79 0.431 -1.642993 3.847644
------------------------------------------------------------------------------
. * Between-Class Gender Effect at Year 1
. lincom c.girl*1 + c.cmgirl50#c.aclass1*1
( 1) [effort]girl + [effort]c.cmgirl50#c.aclass1 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .106483 1.076007 0.10 0.921 -2.002452 2.215418
------------------------------------------------------------------------------
. * Between-Class Gender Effect at Year 2
. lincom c.girl*1 + c.cmgirl50#c.aclass2*1
( 1) [effort]girl + [effort]c.cmgirl50#c.aclass2 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | -.1094873 .7964172 -0.14 0.891 -1.670436 1.451462
------------------------------------------------------------------------------
.
. display as result "Ch 11b: Empty Means, Two-Level Model of Years Within Students"
Ch 11b: Empty Means, Two-Level Model of Years Within Students
. display as result "Predicting Teacher-Perceived Student Aggression"
Predicting Teacher-Perceived Student Aggression
. mixed aggression , ///
> || studentid: , variance reml covariance(unstructured),
Note: single-variable random-effects specification in studentid equation; covariance structure set to identity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1267.1554
Iteration 1: log restricted-likelihood = -1267.1554
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: studentid Number of groups = 486
Obs per group: min = 1
avg = 2.5
max = 3
Wald chi2(0) = .
Log restricted-likelihood = -1267.1554 Prob > chi2 = .
------------------------------------------------------------------------------
aggression | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_cons | 1.551941 .0295938 52.44 0.000 1.493938 1.609944
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid: Identity |
var(_cons) | .3016847 .0290051 .2498708 .3642427
-----------------------------+------------------------------------------------
var(Residual) | .2831168 .0150785 .2550536 .3142677
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 228.91 Prob >= chibar2 = 0.0000
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1267.155 3 2540.311 2544.8
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estat icc,
Intraclass correlation
------------------------------------------------------------------------------
Level | ICC Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid | .5158754 .0303722 .4564032 .5749013
------------------------------------------------------------------------------
. estat wcorrelation, covariance,
Covariances for studentid = 4101:
obs | 1 2
-------------+----------------
1 | 0.585
2 | 0.302 0.585
. estat wcorrelation,
Standard deviations and correlations for studentid = 4101:
Standard deviations:
obs | 1 2
-------------+----------------
sd | 0.765 0.765
Correlations:
obs | 1 2
-------------+----------------
1 | 1.000
2 | 0.516 1.000
. estimates store FitEmpty2A,
.
. display as result "Ch 11b: Saturated Means, Unstructured Variance Model"
Ch 11b: Saturated Means, Unstructured Variance Model
. display as result "Predicting Student Aggression"
Predicting Student Aggression
. mixed aggression i.year, ///
> || studentid: , noconstant variance reml covariance(unstructured) ///
> residuals(unstructured,t(year)),
Obtaining starting values by EM:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1383.9108
Iteration 1: log restricted-likelihood = -1328.3466
Iteration 2: log restricted-likelihood = -1269.1301
Iteration 3: log restricted-likelihood = -1265.7686
Iteration 4: log restricted-likelihood = -1265.7258
Iteration 5: log restricted-likelihood = -1265.7258
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: studentid Number of groups = 486
Obs per group: min = 1
avg = 2.5
max = 3
Wald chi2(2) = 5.05
Log restricted-likelihood = -1265.7258 Prob > chi2 = 0.0801
------------------------------------------------------------------------------
aggression | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year |
1 | .0821448 .0387978 2.12 0.034 .0061025 .158187
2 | .072281 .0397772 1.82 0.069 -.0056807 .1502428
|
_cons | 1.501819 .037243 40.32 0.000 1.428824 1.574814
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid: (empty) |
-----------------------------+------------------------------------------------
Residual: Unstructured |
var(e0) | .5937505 .0430017 .5151773 .6843074
var(e1) | .6123294 .0431599 .5333206 .7030429
var(e2) | .5457945 .0390181 .4744363 .6278855
cov(e0,e1) | .3125977 .0373702 .2393536 .3858419
cov(e0,e2) | .2659354 .0322141 .202797 .3290739
cov(e1,e2) | .3279213 .0340972 .2610921 .3947505
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(5) = 236.37 Prob > chi2 = 0.0000
Note: The reported degrees of freedom assumes the null hypothesis is not on the boundary of the parameter space. If this is not true, then the
reported test is conservative.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1265.726 9 2549.452 2562.92
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estat wcorrelation, covariance,
Covariances for studentid = 4101:
year | 0 2
-------------+----------------
0 | 0.594
2 | 0.266 0.546
. estat wcorrelation,
Standard deviations and correlations for studentid = 4101:
Standard deviations:
year | 0 2
-------------+----------------
sd | 0.771 0.739
Correlations:
year | 0 2
-------------+----------------
0 | 1.000
2 | 0.467 1.000
. contrast i.year,
Contrasts of marginal linear predictions
Margins : asbalanced
------------------------------------------------
| df chi2 P>chi2
-------------+----------------------------------
aggression |
year | 2 5.05 0.0801
------------------------------------------------
. margins i.year,
Adjusted predictions Number of obs = 1214
Expression : Linear prediction, fixed portion, predict()
------------------------------------------------------------------------------
| Delta-method
| Margin Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year |
0 | 1.501819 .037243 40.32 0.000 1.428824 1.574814
1 | 1.583964 .037833 41.87 0.000 1.509812 1.658115
2 | 1.5741 .0358653 43.89 0.000 1.503805 1.644394
------------------------------------------------------------------------------
. margins i.year, pwcompare(pveffects)
Pairwise comparisons of adjusted predictions
Expression : Linear prediction, fixed portion, predict()
-----------------------------------------------------
| Delta-method Unadjusted
| Contrast Std. Err. z P>|z|
-------------+---------------------------------------
year |
1 vs 0 | .0821448 .0387978 2.12 0.034
2 vs 0 | .072281 .0397772 1.82 0.069
2 vs 1 | -.0098637 .0366363 -0.27 0.788
-----------------------------------------------------
. estimates store FitSatUN2A,
.
. display as result "Ch 11b: Piecewise Means, Random Intercept Model"
Ch 11b: Piecewise Means, Random Intercept Model
. display as result "Predicting Student Aggression"
Predicting Student Aggression
. mixed aggression c.year01 c.year12, ///
> || studentid: , variance reml covariance(unstructured),
Note: single-variable random-effects specification in studentid equation; covariance structure set to identity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1269.4043
Iteration 1: log restricted-likelihood = -1269.4043
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: studentid Number of groups = 486
Obs per group: min = 1
avg = 2.5
max = 3
Wald chi2(2) = 5.15
Log restricted-likelihood = -1269.4043 Prob > chi2 = 0.0763
------------------------------------------------------------------------------
aggression | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year01 | .0798776 .0382655 2.09 0.037 .0048785 .1548767
year12 | -.0101816 .0386349 -0.26 0.792 -.0859046 .0655415
_cons | 1.582474 .0370607 42.70 0.000 1.509836 1.655112
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
studentid: Identity |
var(_cons) | .30112 .0289368 .2494258 .363528
-----------------------------+------------------------------------------------
var(Residual) | .2823043 .0150533 .2542897 .3134052
------------------------------------------------------------------------------
LR test vs. linear regression: chibar2(01) = 229.01 Prob >= chibar2 = 0.0000
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1269.404 5 2548.809 2556.291
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estimates store FitPieceRI2A,
. lrtest FitSatUN2A FitPieceRI2A, force
Likelihood-ratio test LR chi2(4) = 7.36
(Assumption: FitPieceRI2A nested in FitSatUN2A) Prob > chi2 = 0.1182
.
. display as result "Ch 11b: Adding Random Acute Year-Specific Class Effects"
Ch 11b: Adding Random Acute Year-Specific Class Effects
. display as result "Predicting Student Aggression"
Predicting Student Aggression
. mixed aggression c.year01 c.year12, ///
> || _all: r.studentid, variance reml ///
> || _all: r.aclass0_year0, ///
> || _all: r.aclass1_year1, ///
> || _all: r.aclass2_year2, ,
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1152.6151
Iteration 1: log restricted-likelihood = -1152.6151
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: _all Number of groups = 1
Obs per group: min = 1214
avg = 1214.0
max = 1214
Wald chi2(2) = 0.05
Log restricted-likelihood = -1152.6151 Prob > chi2 = 0.9762
------------------------------------------------------------------------------
aggression | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year01 | .1091436 .4995367 0.22 0.827 -.8699303 1.088217
year12 | -.0317786 .4149931 -0.08 0.939 -.84515 .7815929
_cons | 1.607239 .48022 3.35 0.001 .666025 2.548453
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
var(R.studen~d) | .3015701 .0271933 .2527165 .3598679
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r0) | .1489948 .0551893 .0720903 .3079394
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r1) | .0868875 .0357184 .0388185 .1944803
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r2) | .0761168 .0293115 .0357845 .161907
-----------------------------+------------------------------------------------
var(Residual) | .1868907 .0104988 .1674057 .2086436
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(4) = 462.59 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1152.615 8 2321.23 2333.202
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estimates store FitClassAcuteA,
. lrtest FitClassAcuteA FitPieceRI2A,
Likelihood-ratio test LR chi2(3) = 233.58
(Assumption: FitPieceRI2A nested in FitClassAcuteA) Prob > chi2 = 0.0000
Note: The reported degrees of freedom assumes the null hypothesis is not on the boundary of the parameter space. If this is not true, then the
reported test is conservative.
Note: LR tests based on REML are valid only when the fixed-effects specification is identical for both models.
.
. display as result "Ch 11b: Adding Random Transfer Class Effects Instead"
Ch 11b: Adding Random Transfer Class Effects Instead
. display as result "Predicting Student Aggression"
Predicting Student Aggression
. mixed aggression c.year01 c.year12, ///
> || _all: r.studentid, variance reml ///
> || _all: r.tclass0_year0, ///
> || _all: r.tclass1_year1, ///
> || _all: r.tclass2_year2, ,
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1220.7843
Iteration 1: log restricted-likelihood = -1220.784
Iteration 2: log restricted-likelihood = -1220.784
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: _all Number of groups = 1
Obs per group: min = 1214
avg = 1214.0
max = 1214
Wald chi2(2) = 0.14
Log restricted-likelihood = -1220.784 Prob > chi2 = 0.9343
------------------------------------------------------------------------------
aggression | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
year01 | .0914905 .2523614 0.36 0.717 -.4031288 .5861097
year12 | -.021322 .3040175 -0.07 0.944 -.6171853 .5745413
_cons | 1.592159 .3056031 5.21 0.000 .9931882 2.19113
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
var(R.studen~d) | .242823 .0253832 .1978383 .2980363
-----------------------------+------------------------------------------------
_all: Identity |
var(R.tclas~r0) | .0505817 .0227171 .0209751 .1219784
-----------------------------+------------------------------------------------
_all: Identity |
var(R.tclas~r1) | .0595033 .0265781 .0247935 .142805
-----------------------------+------------------------------------------------
_all: Identity |
var(R.tclas~r2) | .0866465 .0346982 .0395259 .189942
-----------------------------+------------------------------------------------
var(Residual) | .246615 .0136229 .2213091 .2748144
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(4) = 326.25 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1220.784 8 2457.568 2469.54
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. estimates store FitClassTransA,
. lrtest FitClassTransA FitPieceRI2A,
Likelihood-ratio test LR chi2(3) = 97.24
(Assumption: FitPieceRI2A nested in FitClassTransA) Prob > chi2 = 0.0000
Note: The reported degrees of freedom assumes the null hypothesis is not on the boundary of the parameter space. If this is not true, then the
reported test is conservative.
Note: LR tests based on REML are valid only when the fixed-effects specification is identical for both models.
.
. display as result "Ch 11b: Adding Time-Varying, Student Mean, and Year-Specific Class Contextual Effects of Student Aggression"
Ch 11b: Adding Time-Varying, Student Mean, and Year-Specific Class Contextual Effects of Student Aggression
. display as result "Predicting Student Effort"
Predicting Student Effort
. mixed effort c.year01 c.year12 ///
> i.grade#c.aclass0 i.grade#c.aclass1 i.grade#c.aclass2 ///
> c.girl c.cmgirl50#c.aclass0 c.cmgirl50#c.aclass1 c.cmgirl50#c.aclass2 ///
> c.agg2 c.smagg2 c.cmagg2#c.aclass0 c.cmagg2#c.aclass1 c.cmagg2#c.aclass2, ///
> || _all: r.studentid, variance reml ///
> || _all: r.aclass0_year0, ///
> || _all: r.aclass1_year1, ///
> || _all: r.aclass2_year2, ,
note: 5.grade#c.aclass0 omitted because of collinearity
note: 6.grade#c.aclass0 omitted because of collinearity
note: 7.grade#c.aclass0 omitted because of collinearity
note: 3.grade#c.aclass1 omitted because of collinearity
note: 6.grade#c.aclass1 omitted because of collinearity
note: 7.grade#c.aclass1 omitted because of collinearity
note: 3.grade#c.aclass2 omitted because of collinearity
note: 4.grade#c.aclass2 omitted because of collinearity
note: 7.grade#c.aclass2 omitted because of collinearity
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log restricted-likelihood = -1298.2714
Iteration 1: log restricted-likelihood = -1298.2692
Iteration 2: log restricted-likelihood = -1298.2692
Computing standard errors:
Mixed-effects REML regression Number of obs = 1214
Group variable: _all Number of groups = 1
Obs per group: min = 1214
avg = 1214.0
max = 1214
Wald chi2(17) = 523.71
Log restricted-likelihood = -1298.2692 Prob > chi2 = 0.0000
--------------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
---------------------+----------------------------------------------------------------
year01 | -.051462 .2329012 -0.22 0.825 -.5079401 .405016
year12 | -.2437295 .2907562 -0.84 0.402 -.8136012 .3261423
|
grade#c.aclass0 |
3 | .0049144 .1150669 0.04 0.966 -.2206127 .2304414
4 | .1181397 .1164895 1.01 0.311 -.1101756 .3464549
5 | 0 (omitted)
6 | 0 (omitted)
7 | 0 (omitted)
|
grade#c.aclass1 |
3 | 0 (omitted)
4 | .0419303 .1327531 0.32 0.752 -.218261 .3021216
5 | -.089344 .1246648 -0.72 0.474 -.3336824 .1549945
6 | 0 (omitted)
7 | 0 (omitted)
|
grade#c.aclass2 |
3 | 0 (omitted)
4 | 0 (omitted)
5 | .2015214 .1474706 1.37 0.172 -.0875157 .4905584
6 | .4110342 .1472176 2.79 0.005 .122493 .6995755
7 | 0 (omitted)
|
girl | .0765798 .0630106 1.22 0.224 -.0469187 .2000783
|
c.cmgirl50#c.aclass0 | 1.254117 .7318495 1.71 0.087 -.1802816 2.688516
|
c.cmgirl50#c.aclass1 | -.1971562 .8857216 -0.22 0.824 -1.933139 1.538826
|
c.cmgirl50#c.aclass2 | .0118574 .6591199 0.02 0.986 -1.279994 1.303709
|
agg2 | -.6055431 .0438991 -13.79 0.000 -.6915837 -.5195025
smagg2 | -.1976563 .0624339 -3.17 0.002 -.3200244 -.0752882
|
c.cmagg2#c.aclass0 | .0044718 .108712 0.04 0.967 -.2085998 .2175434
|
c.cmagg2#c.aclass1 | .1260319 .137191 0.92 0.358 -.1428575 .3949213
|
c.cmagg2#c.aclass2 | .0677506 .1807631 0.37 0.708 -.2865385 .4220398
|
_cons | 3.593137 .2506844 14.33 0.000 3.101804 4.084469
--------------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
var(R.studen~d) | .3440759 .0307984 .2887105 .4100585
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r0) | .012818 .0119994 .0020463 .0802903
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r1) | .0243322 .016006 .0067027 .0883305
-----------------------------+------------------------------------------------
_all: Identity |
var(R.aclas~r2) | .0365922 .0212549 .0117209 .1142394
-----------------------------+------------------------------------------------
var(Residual) | .2664478 .0144896 .2395097 .2964156
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(4) = 305.40 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference.
. estat ic, n(33),
Akaike's information criterion and Bayesian information criterion
-----------------------------------------------------------------------------
Model | Obs ll(null) ll(model) df AIC BIC
-------------+---------------------------------------------------------------
. | 33 . -1298.269 23 2642.538 2676.958
-----------------------------------------------------------------------------
Note: N=33 used in calculating BIC
. * Multivariate Test of Year-Specific Class Contextual Aggression Effects
. test (c.cmagg2#c.aclass0=0) (c.cmagg2#c.aclass1=0) (c.cmagg2#c.aclass2=0)
( 1) [effort]c.cmagg2#c.aclass0 = 0
( 2) [effort]c.cmagg2#c.aclass1 = 0
( 3) [effort]c.cmagg2#c.aclass2 = 0
chi2( 3) = 0.94
Prob > chi2 = 0.8160
. * Grade 3 vs 4 at Year 0
. test 3.grade#c.aclass0=4.grade#c.aclass0
( 1) [effort]3b.grade#c.aclass0 - [effort]4.grade#c.aclass0 = 0
chi2( 1) = 0.91
Prob > chi2 = 0.3408
. * Grade 3 vs 5 at Year 0
. test 3.grade#c.aclass0=5.grade#c.aclass0
( 1) [effort]3b.grade#c.aclass0 - [effort]5o.grade#co.aclass0 = 0
chi2( 1) = 0.00
Prob > chi2 = 0.9659
. * Grade 4 vs 5 at Year 0
. test 4.grade#c.aclass0=5.grade#c.aclass0
( 1) [effort]4.grade#c.aclass0 - [effort]5o.grade#co.aclass0 = 0
chi2( 1) = 1.03
Prob > chi2 = 0.3105
. * Grade 4 vs 5 at Year 1
. test 4.grade#c.aclass1=5.grade#c.aclass1
( 1) [effort]4.grade#c.aclass1 - [effort]5.grade#c.aclass1 = 0
chi2( 1) = 1.00
Prob > chi2 = 0.3183
. * Grade 4 vs 6 at Year 1
. test 4.grade#c.aclass1=6.grade#c.aclass1
( 1) [effort]4.grade#c.aclass1 - [effort]6o.grade#co.aclass1 = 0
chi2( 1) = 0.10
Prob > chi2 = 0.7521
. * Grade 5 vs 6 at Year 1
. test 5.grade#c.aclass1=6.grade#c.aclass1
( 1) [effort]5.grade#c.aclass1 - [effort]6o.grade#co.aclass1 = 0
chi2( 1) = 0.51
Prob > chi2 = 0.4736
. * Grade 5 vs 6 at Year 2
. test 5.grade#c.aclass2=6.grade#c.aclass2
( 1) [effort]5.grade#c.aclass2 - [effort]6.grade#c.aclass2 = 0
chi2( 1) = 2.24
Prob > chi2 = 0.1341
. * Grade 5 vs 7 at Year 2
. test 5.grade#c.aclass2=7.grade#c.aclass2
( 1) [effort]5.grade#c.aclass2 - [effort]7o.grade#co.aclass2 = 0
chi2( 1) = 1.87
Prob > chi2 = 0.1718
. * Grade 6 vs 7 at Year 2
. test 6.grade#c.aclass2=7.grade#c.aclass2
( 1) [effort]6.grade#c.aclass2 - [effort]7o.grade#co.aclass2 = 0
chi2( 1) = 7.80
Prob > chi2 = 0.0052
. * Between-Class Gender Effect at Year 0
. lincom c.girl*1 + c.cmgirl50#c.aclass0*1
( 1) [effort]girl + [effort]c.cmgirl50#c.aclass0 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | 1.330697 .7324984 1.82 0.069 -.1049736 2.766367
------------------------------------------------------------------------------
. * Between-Class Gender Effect at Year 1
. lincom c.girl*1 + c.cmgirl50#c.aclass1*1
( 1) [effort]girl + [effort]c.cmgirl50#c.aclass1 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | -.1205764 .8865126 -0.14 0.892 -1.858109 1.616956
------------------------------------------------------------------------------
. * Between-Class Gender Effect at Year 2
. lincom c.girl*1 + c.cmgirl50#c.aclass2*1
( 1) [effort]girl + [effort]c.cmgirl50#c.aclass2 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | .0884372 .6600652 0.13 0.893 -1.205267 1.382141
------------------------------------------------------------------------------
. * Between-Class Aggression Effect at Year 0
. lincom c.agg2*1 + c.smagg2*1 + c.cmagg2#c.aclass0*1
( 1) [effort]agg2 + [effort]smagg2 + [effort]c.cmagg2#c.aclass0 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | -.7987276 .1144295 -6.98 0.000 -1.023005 -.5744498
------------------------------------------------------------------------------
. * Between-Class Aggression Effect at Year 1
. lincom c.agg2*1 + c.smagg2*1 + c.cmagg2#c.aclass1*1
( 1) [effort]agg2 + [effort]smagg2 + [effort]c.cmagg2#c.aclass1 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | -.6771675 .139116 -4.87 0.000 -.9498299 -.4045051
------------------------------------------------------------------------------
. * Between-Class Aggression Effect at Year 2
. lincom c.agg2*1 + c.smagg2*1 + c.cmagg2#c.aclass2*1
( 1) [effort]agg2 + [effort]smagg2 + [effort]c.cmagg2#c.aclass2 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | -.7354487 .1837637 -4.00 0.000 -1.095619 -.3752786
------------------------------------------------------------------------------
. * Between-Student Aggression Effect
. lincom c.agg2*1 + c.smagg2*1
( 1) [effort]agg2 + [effort]smagg2 = 0
------------------------------------------------------------------------------
effort | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
(1) | -.8031994 .0484567 -16.58 0.000 -.8981729 -.7082259
------------------------------------------------------------------------------
. predict PredFinalE, xb,
. corr effort PredFinalE
(obs=1214)
| effort PredFi~E
-------------+------------------
effort | 1.0000
PredFinalE | 0.6052 1.0000
.
. ****** END CHAPTER 11b MODELS ******
.
. * Close log
. log close STATA_Chapter11b
name: STATA_Chapter11b
log: C:\Dropbox\PilesOfVariance\Chapter11b\STATA\STATA_Chapter11b_Output.smcl
log type: smcl
closed on: 25 Oct 2014, 18:37:55
------------------------------------------------------------------------------------------------------------------------------------------------------