------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  STATA_Chapter9
       log:  C:\Dropbox\PilesOfVariance\Chapter9\STATA\STATA_Chapter9_Output.smcl
  log type:  smcl
 opened on:  20 Jan 2015, 16:07:35


. . display as result "Chapter 9: Descriptive Statistics for Time-Varying Variables" Chapter 9: Descriptive Statistics for Time-Varying Variables

. preserve

. collapse attitude12 pmmonitor copymonitor12 copymonitor18, by(personid)

. summarize attitude12 pmmonitor copymonitor12 copymonitor18

Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- attitude12 | 200 3.9505 .6024956 2.437367 5 pmmonitor | 200 3.075439 .5526113 1.153501 4.47294 copymonit~12 | 200 3.078307 .8040337 1 5 copymonit~18 | 200 3.067673 .5561235 1.339776 4.420773

. corr pmmonitor copymonitor12 copymonitor18 (obs=200)

| pmmoni~r copym~12 copym~18 -------------+--------------------------- pmmonitor | 1.0000 copymonit~12 | 0.9137 1.0000 copymonit~18 | 0.7401 0.5246 1.0000



. restore

. . display as result "Chapter 9: Descriptive Statistics for Time-Varying Variables" Chapter 9: Descriptive Statistics for Time-Varying Variables

. summarize age risky monitor wpmon change18mon

Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- age | 1400 15.00103 2.004174 11.53088 18.33688 risky | 1400 19.38489 5.301359 10 36.28243 monitor | 1400 3.075439 .6445657 1 5 wpmon | 1400 1.91e-09 .3337595 -1.136053 1.226129 change18mon | 1400 .0077664 .5200831 -2.355284 1.713193

. corr pmmon3 age18mon3 wpmon change18mon (obs=1400)

| pmmon3 age18m~3 wpmon change~n -------------+------------------------------------ pmmon3 | 1.0000 age18mon3 | 0.7401 1.0000 wpmon | 0.0000 0.0000 1.0000 change18mon | 0.2706 -0.2823 0.6417 1.0000



. . display as result "Ch 9: Empty Means, Random Intercept Model for Monitoring" Ch 9: Empty Means, Random Intercept Model for Monitoring

. mixed monitor , /// > || personid: , variance mle covariance(unstructured), Note: single-variable random-effects specification in personid equation; covariance structure set to identity

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -837.24375 Iteration 1: log likelihood = -837.24375

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(0) = . Log likelihood = -837.24375 Prob > chi2 = .

------------------------------------------------------------------------------ monitor | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | 3.075439 .0389777 78.90 0.000 2.999044 3.151834 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | .2852998 .0303947 .2315357 .3515483 -----------------------------+------------------------------------------------ var(Residual) | .1298685 .0053019 .1198819 .140687 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 1067.84 Prob >= chibar2 = 0.0000

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -837.2438 3 1680.488 1690.382 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. estat icc,

Intraclass correlation

------------------------------------------------------------------------------ Level | ICC Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid | .6871908 .0247281 .6368114 .7335062 ------------------------------------------------------------------------------

. estat wcorrelation, covariance,

Covariances for personid = 1:

obs | 1 2 3 4 5 6 7 -------------+-------------------------------------------------------- 1 | 0.415 2 | 0.285 0.415 3 | 0.285 0.285 0.415 4 | 0.285 0.285 0.285 0.415 5 | 0.285 0.285 0.285 0.285 0.415 6 | 0.285 0.285 0.285 0.285 0.285 0.415 7 | 0.285 0.285 0.285 0.285 0.285 0.285 0.415

. estat wcorrelation,

Standard deviations and correlations for personid = 1:

Standard deviations:

obs | 1 2 3 4 5 6 7 -------------+-------------------------------------------------------- sd | 0.644 0.644 0.644 0.644 0.644 0.644 0.644

Correlations:

obs | 1 2 3 4 5 6 7 -------------+-------------------------------------------------------- 1 | 1.000 2 | 0.687 1.000 3 | 0.687 0.687 1.000 4 | 0.687 0.687 0.687 1.000 5 | 0.687 0.687 0.687 0.687 1.000 6 | 0.687 0.687 0.687 0.687 0.687 1.000 7 | 0.687 0.687 0.687 0.687 0.687 0.687 1.000

. . display as result "Ch 9: Fixed Linear Age, Random Intercept Model for Monitoring" Ch 9: Fixed Linear Age, Random Intercept Model for Monitoring

. mixed monitor c.agec18, /// > || personid: , variance mle covariance(unstructured), Note: single-variable random-effects specification in personid equation; covariance structure set to identity

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -837.0184 Iteration 1: log likelihood = -837.0184

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(1) = 0.45 Log likelihood = -837.0184 Prob > chi2 = 0.5020

------------------------------------------------------------------------------ monitor | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- agec18 | -.0032289 .0048092 -0.67 0.502 -.0126547 .0061969 _cons | 3.065756 .0415588 73.77 0.000 2.984302 3.14721 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | .2852791 .030392 .2315197 .3515216 -----------------------------+------------------------------------------------ var(Residual) | .1298216 .0052999 .1198387 .1406362 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 1068.05 Prob >= chibar2 = 0.0000

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -837.0184 4 1682.037 1695.23 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. estimates store FitFixLin,

. . display as result "Ch 9: Random Linear Age Model for Monitoring" Ch 9: Random Linear Age Model for Monitoring

. mixed monitor c.agec18, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -676.87612 Iteration 1: log likelihood = -676.87612

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(1) = 0.16 Log likelihood = -676.87612 Prob > chi2 = 0.6861

------------------------------------------------------------------------------ monitor | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- agec18 | -.0033057 .0081793 -0.40 0.686 -.0193369 .0127255 _cons | 3.065015 .034128 89.81 0.000 2.998126 3.131905 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .0104944 .0013447 .0081638 .0134905 var(_cons) | .1954436 .0233316 .1546704 .2469652 cov(agec18,_cons) | -.000423 .0040081 -.0082787 .0074326 -----------------------------+------------------------------------------------ var(Residual) | .0807506 .0036117 .0739732 .0881489 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 1388.33 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -676.8761 6 1365.752 1385.542 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. estimates store FitRandLin,

. lrtest FitRandLin FitFixLin,

Likelihood-ratio test LR chi2(2) = 320.28 (Assumption: FitFixLin nested in FitRandLin) 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.

. . display as result "Ch 9: Fixed Quadratic, Random Linear Age Model for Monitoring" Ch 9: Fixed Quadratic, Random Linear Age Model for Monitoring

. mixed monitor c.agec18 c.agec18#c.agec18, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -676.86623 Iteration 1: log likelihood = -676.86623

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(2) = 0.18 Log likelihood = -676.86623 Prob > chi2 = 0.9125

----------------------------------------------------------------------------------- monitor | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------+---------------------------------------------------------------- agec18 | -.0051289 .0153292 -0.33 0.738 -.0351736 .0249158 | c.agec18#c.agec18 | -.0003039 .0021611 -0.14 0.888 -.0045396 .0039318 | _cons | 3.063499 .0357907 85.59 0.000 2.993351 3.133648 -----------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .0104947 .0013447 .008164 .0134908 var(_cons) | .1954453 .0233316 .154672 .246967 cov(agec18,_cons) | -.0004243 .0040081 -.00828 .0074314 -----------------------------+------------------------------------------------ var(Residual) | .0807485 .0036116 .0739713 .0881466 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 1388.29 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -676.8662 7 1367.732 1390.821 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. estimates store FitFixQuad,

. . display as result "Ch 9: Random Quadratic Age Model for Monitoring" Ch 9: Random Quadratic Age Model for Monitoring

. mixed monitor c.agec18 c.agec18#c.agec18, /// > || personid: agec18 agec18sq, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -675.72747 Iteration 1: log likelihood = -674.36638 Iteration 2: log likelihood = -674.17384 Iteration 3: log likelihood = -674.12505 Iteration 4: log likelihood = -674.12064 Iteration 5: log likelihood = -674.12021 Iteration 6: log likelihood = -674.1202

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(2) = 0.19 Log likelihood = -674.1202 Prob > chi2 = 0.9076

----------------------------------------------------------------------------------- monitor | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------+---------------------------------------------------------------- agec18 | -.0060175 .0157907 -0.38 0.703 -.0369667 .0249317 | c.agec18#c.agec18 | -.0004637 .0021911 -0.21 0.832 -.0047581 .0038308 | _cons | 3.062668 .0374521 81.78 0.000 2.989263 3.136072 -----------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .013574 . . . var(agec18sq) | .000032 . . . var(_cons) | .2200984 . . . cov(agec18,agec18sq) | .000349 . . . cov(agec18,_cons) | .0157988 . . . cov(agec18sq,_cons) | .0025617 . . . -----------------------------+------------------------------------------------ var(Residual) | .0801881 . . . ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(6) = 1393.78 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -674.1202 3 1354.24 1364.135 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. estimates store FitRandQuad,

. lrtest FitRandQuad FitFixQuad, force

Likelihood-ratio test LR chi2(4) = -5.49 (Assumption: FitRandQuad nested in FitFixQuad) Prob > chi2 = 1.0000

. . display as result "Ch 9: Fixed Quadratic, Random Linear Age Model for Risky Behavior" Ch 9: Fixed Quadratic, Random Linear Age Model for Risky Behavior

. display as result "Conditional Baseline with Attitudes Predicting Linear Age Slope" Conditional Baseline with Attitudes Predicting Linear Age Slope

. mixed risky c.agec18 c.agec18#c.agec18 /// > c.att4 c.agec18#c.att4, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3801.2664 Iteration 1: log likelihood = -3801.2664

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(4) = 397.26 Log likelihood = -3801.2664 Prob > chi2 = 0.0000

----------------------------------------------------------------------------------- risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------+---------------------------------------------------------------- agec18 | 1.964886 .1460116 13.46 0.000 1.678709 2.251064 | c.agec18#c.agec18 | .1450475 .021963 6.60 0.000 .1020007 .1880943 | att4 | -3.155502 .5512883 -5.72 0.000 -4.236007 -2.074997 | c.agec18#c.att4 | -.5154258 .1042977 -4.94 0.000 -.7198455 -.3110061 | _cons | 23.31201 .350051 66.60 0.000 22.62592 23.9981 -----------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .4880961 .0798137 .3542553 .672503 var(_cons) | 18.08098 2.204655 14.23748 22.96206 cov(agec18,_cons) | 1.884828 .3564732 1.186154 2.583503 -----------------------------+------------------------------------------------ var(Residual) | 8.352883 .373583 7.651849 9.118143 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 663.34 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3801.266 9 7620.533 7650.218 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. predict PredAttOnly, xb,

. . display as result "Eq 9.1: Predicting Quadratic Change in Risky Behavior" Eq 9.1: Predicting Quadratic Change in Risky Behavior

. display as result "From Person Mean Monitoring as Between-Person Monitoring" From Person Mean Monitoring as Between-Person Monitoring

. mixed risky c.agec18 c.agec18#c.agec18 c.att4 c.agec18#c.att4 /// > c.pmmon3 c.agec18#c.pmmon3 c.agec18#c.agec18#c.pmmon3, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3779.776 Iteration 1: log likelihood = -3779.776

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(7) = 452.39 Log likelihood = -3779.776 Prob > chi2 = 0.0000

-------------------------------------------------------------------------------------------- risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------------------------+---------------------------------------------------------------- agec18 | 1.925601 .1470975 13.09 0.000 1.637295 2.213907 | c.agec18#c.agec18 | .1362197 .0221706 6.14 0.000 .0927661 .1796733 | att4 | -3.31951 .5141918 -6.46 0.000 -4.327307 -2.311712 | c.agec18#c.att4 | -.5237898 .1037545 -5.05 0.000 -.727145 -.3204347 | pmmon3 | -2.590697 .5924507 -4.37 0.000 -3.751879 -1.429515 | c.agec18#c.pmmon3 | .4454477 .2618253 1.70 0.089 -.0677203 .9586158 | c.agec18#c.agec18#c.pmmon3 | .1037089 .0395334 2.62 0.009 .0262248 .1811929 | _cons | 23.49447 .3312389 70.93 0.000 22.84525 24.14368 --------------------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .4793567 .0787589 .3473805 .6614732 var(_cons) | 15.18712 1.913957 11.86322 19.44232 cov(agec18,_cons) | 1.722833 .3317575 1.0726 2.373066 -----------------------------+------------------------------------------------ var(Residual) | 8.299335 .3711739 7.602821 9.05966 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 563.42 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3779.776 12 7583.552 7623.132 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. * Effect of PM Monitoring at Age 12 . lincom pmmon3*1 + c.agec18#c.pmmon3*-6 + c.agec18#c.agec18#c.pmmon3*36

( 1) [risky]pmmon3 - 6*[risky]c.agec18#c.pmmon3 + 36*[risky]c.agec18#c.agec18#c.pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.529865 .5449359 -2.81 0.005 -2.597919 -.4618097 ------------------------------------------------------------------------------

. * Effect of PM Monitoring at Age 14 . lincom pmmon3*1 + c.agec18#c.pmmon3*-4 + c.agec18#c.agec18#c.pmmon3*16

( 1) [risky]pmmon3 - 4*[risky]c.agec18#c.pmmon3 + 16*[risky]c.agec18#c.agec18#c.pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -2.713146 .4342648 -6.25 0.000 -3.56429 -1.862003 ------------------------------------------------------------------------------

. * Effect of PM Monitoring at Age 16 . lincom pmmon3*1 + c.agec18#c.pmmon3*-2 + c.agec18#c.agec18#c.pmmon3*4

( 1) [risky]pmmon3 - 2*[risky]c.agec18#c.pmmon3 + 4*[risky]c.agec18#c.agec18#c.pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -3.066757 .4559046 -6.73 0.000 -3.960314 -2.173201 ------------------------------------------------------------------------------

. * Effect of PM Monitoring at Age 18 . lincom pmmon3*1 + c.agec18#c.pmmon3*0 + c.agec18#c.agec18#c.pmmon3*0

( 1) [risky]pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -2.590697 .5924507 -4.37 0.000 -3.751879 -1.429515 ------------------------------------------------------------------------------

. predict PredPMBP, xb,

. corr risky PredPMBP (obs=1400)

| risky PredPMBP -------------+------------------ risky | 1.0000 PredPMBP | 0.5567 1.0000



. . display as result "Eq 9.1: Predicting Quadratic Change in Risky Behavior" Eq 9.1: Predicting Quadratic Change in Risky Behavior

. display as result "From Monitoring at Age 18 as Between-Person Monitoring" From Monitoring at Age 18 as Between-Person Monitoring

. mixed risky c.agec18 c.agec18#c.agec18 c.att4 c.agec18#c.att4 /// > c.age18mon3 c.agec18#c.age18mon3 c.agec18#c.agec18#c.age18mon3, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3783.7589 Iteration 1: log likelihood = -3783.7589

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(7) = 446.85 Log likelihood = -3783.7589 Prob > chi2 = 0.0000

----------------------------------------------------------------------------------------------- risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------------------+---------------------------------------------------------------- agec18 | 1.908314 .1461234 13.06 0.000 1.621918 2.194711 | c.agec18#c.agec18 | .1324328 .0220362 6.01 0.000 .0892427 .1756229 | att4 | -3.324226 .5273662 -6.30 0.000 -4.357845 -2.290607 | c.agec18#c.att4 | -.5327659 .1030131 -5.17 0.000 -.7346679 -.3308639 | age18mon3 | -1.79405 .6036914 -2.97 0.003 -2.977263 -.6108364 | c.agec18#c.age18mon3 | .6551895 .2606553 2.51 0.012 .1443145 1.166065 | c.agec18#c.agec18#c.age18mon3 | .1547255 .0392713 3.94 0.000 .0777552 .2316959 | _cons | 23.41475 .3377242 69.33 0.000 22.75282 24.07667 -----------------------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .4691564 .0774788 .3394268 .648469 var(_cons) | 16.16709 2.009211 12.67203 20.62611 cov(agec18,_cons) | 1.688417 .3338152 1.034151 2.342683 -----------------------------+------------------------------------------------ var(Residual) | 8.226297 .3679571 7.535823 8.980036 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 623.74 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3783.759 12 7591.518 7631.098 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. * Effect of Age 18 Monitoring at Age 12 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*-6 + c.agec18#c.agec18#c.age18mon3*36

( 1) [risky]age18mon3 - 6*[risky]c.agec18#c.age18mon3 + 36*[risky]c.agec18#c.agec18#c.age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1550678 .5560915 -0.28 0.780 -1.244987 .9348515 ------------------------------------------------------------------------------

. * Effect of Age 18 Monitoring at Age 14 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*-4 + c.agec18#c.agec18#c.age18mon3*16

( 1) [risky]age18mon3 - 4*[risky]c.agec18#c.age18mon3 + 16*[risky]c.agec18#c.agec18#c.age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.939199 .4518618 -4.29 0.000 -2.824832 -1.053567 ------------------------------------------------------------------------------

. * Effect of Age 18 Monitoring at Age 16 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*-2 + c.agec18#c.agec18#c.age18mon3*4

( 1) [risky]age18mon3 - 2*[risky]c.agec18#c.age18mon3 + 4*[risky]c.agec18#c.agec18#c.age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -2.485527 .4718341 -5.27 0.000 -3.410305 -1.560749 ------------------------------------------------------------------------------

. * Effect of Age 18 Monitoring at Age 18 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*0 + c.agec18#c.agec18#c.age18mon3*0

( 1) [risky]age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.79405 .6036914 -2.97 0.003 -2.977263 -.6108364 ------------------------------------------------------------------------------

. predict Pred18BP, xb,

. corr risky Pred18BP (obs=1400)

| risky Pred18BP -------------+------------------ risky | 1.0000 Pred18BP | 0.5248 1.0000



. . display as result "Eq 9.2: Adding Within-Person Monitoring by Quadratic Age" Eq 9.2: Adding Within-Person Monitoring by Quadratic Age

. display as result "Using Deviation from Person Mean Monitoring as Within-Person Monitoring" Using Deviation from Person Mean Monitoring as Within-Person Monitoring

. mixed risky c.agec18 c.agec18#c.agec18 c.att4 c.agec18#c.att4 /// > c.pmmon3 c.agec18#c.pmmon3 c.agec18#c.agec18#c.pmmon3 /// > c.wpmon c.agec18#c.wpmon c.agec18#c.agec18#c.wpmon, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3729.9756 Iteration 1: log likelihood = -3729.9756

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(10) = 529.18 Log likelihood = -3729.9756 Prob > chi2 = 0.0000

-------------------------------------------------------------------------------------------- risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------------------------+---------------------------------------------------------------- agec18 | 1.920856 .1419434 13.53 0.000 1.642652 2.19906 | c.agec18#c.agec18 | .1364754 .0208909 6.53 0.000 .0955301 .1774207 | att4 | -3.300859 .526975 -6.26 0.000 -4.333711 -2.268007 | c.agec18#c.att4 | -.5149291 .1101147 -4.68 0.000 -.7307499 -.2991082 | pmmon3 | -1.730816 .6196299 -2.79 0.005 -2.945268 -.5163634 | c.agec18#c.pmmon3 | .7578588 .2639797 2.87 0.004 .2404682 1.275249 | c.agec18#c.agec18#c.pmmon3 | .1218731 .0394164 3.09 0.002 .0446184 .1991278 | wpmon | 2.547224 .6084861 4.19 0.000 1.354613 3.739835 | c.agec18#c.wpmon | -.9522503 .4559129 -2.09 0.037 -1.845823 -.0586774 | c.agec18#c.agec18#c.wpmon | -.2158759 .0741595 -2.91 0.004 -.3612258 -.070526 | _cons | 23.46916 .3365035 69.74 0.000 22.80962 24.12869 --------------------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .6108648 .091911 .4548549 .8203843 var(_cons) | 16.57912 2.02333 13.05209 21.05925 cov(agec18,_cons) | 2.134342 .3715574 1.406103 2.862581 -----------------------------+------------------------------------------------ var(Residual) | 7.341472 .3309385 6.720673 8.019616 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 631.07 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3729.976 15 7489.951 7539.426 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. * Effect of PM Monitoring at Age 12 . lincom c.pmmon3*1 + c.agec18#c.pmmon3*-6 + c.agec18#c.agec18#c.pmmon3*36

( 1) [risky]pmmon3 - 6*[risky]c.agec18#c.pmmon3 + 36*[risky]c.agec18#c.agec18#c.pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.890537 .582485 -3.25 0.001 -3.032186 -.7488869 ------------------------------------------------------------------------------

. * Effect of PM Monitoring at Age 14 . lincom c.pmmon3*1 + c.agec18#c.pmmon3*-4 + c.agec18#c.agec18#c.pmmon3*16

( 1) [risky]pmmon3 - 4*[risky]c.agec18#c.pmmon3 + 16*[risky]c.agec18#c.agec18#c.pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -2.812281 .4350774 -6.46 0.000 -3.665017 -1.959545 ------------------------------------------------------------------------------

. * Effect of PM Monitoring at Age 16 . lincom c.pmmon3*1 + c.agec18#c.pmmon3*-2 + c.agec18#c.agec18#c.pmmon3*4

( 1) [risky]pmmon3 - 2*[risky]c.agec18#c.pmmon3 + 4*[risky]c.agec18#c.agec18#c.pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -2.759041 .4578984 -6.03 0.000 -3.656505 -1.861576 ------------------------------------------------------------------------------

. * Effect of PM Monitoring at Age 18 . lincom c.pmmon3*1 + c.agec18#c.pmmon3*0 + c.agec18#c.agec18#c.pmmon3*0

( 1) [risky]pmmon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.730816 .6196299 -2.79 0.005 -2.945268 -.5163634 ------------------------------------------------------------------------------

. * Effect of WP Monitoring at Age 12 . lincom c.wpmon*1 + c.agec18#c.wpmon*-6 + c.agec18#c.agec18#c.wpmon*36

( 1) [risky]wpmon - 6*[risky]c.agec18#c.wpmon + 36*[risky]c.agec18#c.agec18#c.wpmon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | .4891941 .6492799 0.75 0.451 -.7833712 1.761759 ------------------------------------------------------------------------------

. * Effect of WP Monitoring at Age 14 . lincom c.wpmon*1 + c.agec18#c.wpmon*-4 + c.agec18#c.agec18#c.wpmon*16

( 1) [risky]wpmon - 4*[risky]c.agec18#c.wpmon + 16*[risky]c.agec18#c.agec18#c.wpmon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 2.902211 .3615757 8.03 0.000 2.193536 3.610886 ------------------------------------------------------------------------------

. * Effect of WP Monitoring at Age 16 . lincom c.wpmon*1 + c.agec18#c.wpmon*-2 + c.agec18#c.agec18#c.wpmon*4

( 1) [risky]wpmon - 2*[risky]c.agec18#c.wpmon + 4*[risky]c.agec18#c.agec18#c.wpmon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 3.588221 .3693788 9.71 0.000 2.864252 4.31219 ------------------------------------------------------------------------------

. * Effect of WP Monitoring at Age 18 . lincom c.wpmon*1 + c.agec18#c.wpmon*0 + c.agec18#c.agec18#c.wpmon*0

( 1) [risky]wpmon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 2.547224 .6084861 4.19 0.000 1.354613 3.739835 ------------------------------------------------------------------------------

. predict PredPMBPWP, xb,

. corr risky PredPMBPWP (obs=1400)

| risky PredP~WP -------------+------------------ risky | 1.0000 PredPMBPWP | 0.5669 1.0000



. . display as result "Eq 9.2: Adding Within-Person Monitoring by Quadratic Age" Eq 9.2: Adding Within-Person Monitoring by Quadratic Age

. display as result "Using Change from Age 18 Monitoring as Within-Person Monitoring" Using Change from Age 18 Monitoring as Within-Person Monitoring

. mixed risky c.agec18 c.agec18#c.agec18 c.att4 c.agec18#c.att4 /// > c.age18mon3 c.agec18#c.age18mon3 c.agec18#c.agec18#c.age18mon3 /// > c.change18mon c.agec18#c.change18mon c.agec18#c.agec18#c.change18mon, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3751.7559 Iteration 1: log likelihood = -3751.7559

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(10) = 511.47 Log likelihood = -3751.7559 Prob > chi2 = 0.0000

------------------------------------------------------------------------------------------------- risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------------------------+---------------------------------------------------------------- agec18 | 1.94276 .1411758 13.76 0.000 1.66606 2.219459 | c.agec18#c.agec18 | .1382142 .0210469 6.57 0.000 .0969631 .1794653 | att4 | -3.332456 .5446091 -6.12 0.000 -4.399871 -2.265042 | c.agec18#c.att4 | -.5361196 .1044842 -5.13 0.000 -.7409049 -.3313343 | age18mon3 | -1.410961 .6224682 -2.27 0.023 -2.630976 -.1909458 | c.agec18#c.age18mon3 | .3411646 .2592881 1.32 0.188 -.1670308 .8493601 | c.agec18#c.agec18#c.age18mon3 | .0930822 .0389909 2.39 0.017 .0166613 .169503 | change18mon | 4.716308 .8614941 5.47 0.000 3.02781 6.404805 | c.agec18#c.change18mon | 1.198141 .4729891 2.53 0.011 .2710999 2.125183 | c.agec18#c.agec18#c.change18mon | .0918663 .0606977 1.51 0.130 -.027099 .2108317 | _cons | 23.4013 .3460527 67.62 0.000 22.72305 24.07955 -------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .5177212 .0802292 .3821101 .7014606 var(_cons) | 17.84347 2.156087 14.08075 22.61168 cov(agec18,_cons) | 1.762454 .34705 1.082249 2.44266 -----------------------------+------------------------------------------------ var(Residual) | 7.47218 .3394318 6.835662 8.167968 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 666.65 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3751.756 15 7533.512 7582.987 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. * Effect of Age 18 Monitoring at Age 12 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*-6 + c.agec18#c.agec18#c.age18mon3*36

( 1) [risky]age18mon3 - 6*[risky]c.agec18#c.age18mon3 + 36*[risky]c.agec18#c.agec18#c.age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.1069914 .5928511 -0.18 0.857 -1.268958 1.054976 ------------------------------------------------------------------------------

. * Effect of Age 18 Monitoring at Age 14 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*-4 + c.agec18#c.agec18#c.age18mon3*16

( 1) [risky]age18mon3 - 4*[risky]c.agec18#c.age18mon3 + 16*[risky]c.agec18#c.agec18#c.age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.286305 .4895503 -2.63 0.009 -2.245806 -.3268042 ------------------------------------------------------------------------------

. * Effect of Age 18 Monitoring at Age 16 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*-2 + c.agec18#c.agec18#c.age18mon3*4

( 1) [risky]age18mon3 - 2*[risky]c.agec18#c.age18mon3 + 4*[risky]c.agec18#c.agec18#c.age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.720962 .5037073 -3.42 0.001 -2.70821 -.7337136 ------------------------------------------------------------------------------

. * Effect of Age 18 Monitoring at Age 18 . lincom c.age18mon3*1 + c.agec18#c.age18mon3*0 + c.agec18#c.agec18#c.age18mon3*0

( 1) [risky]age18mon3 = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -1.410961 .6224682 -2.27 0.023 -2.630976 -.1909458 ------------------------------------------------------------------------------

. * Effect of Change in Monitoring at Age 12 . lincom c.change18mon*1 + c.agec18#c.change18mon*-6 + c.agec18#c.agec18#c.change18mon*36

( 1) [risky]change18mon - 6*[risky]c.agec18#c.change18mon + 36*[risky]c.agec18#c.agec18#c.change18mon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | .8346474 .3722552 2.24 0.025 .1050405 1.564254 ------------------------------------------------------------------------------

. * Effect of Change in Monitoring at Age 14 . lincom c.change18mon*1 + c.agec18#c.change18mon*-4 + c.agec18#c.agec18#c.change18mon*16

( 1) [risky]change18mon - 4*[risky]c.agec18#c.change18mon + 16*[risky]c.agec18#c.agec18#c.change18mon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 1.393603 .297395 4.69 0.000 .81072 1.976487 ------------------------------------------------------------------------------

. * Effect of Change in Monitoring at Age 16 . lincom c.change18mon*1 + c.agec18#c.change18mon*-2 + c.agec18#c.agec18#c.change18mon*4

( 1) [risky]change18mon - 2*[risky]c.agec18#c.change18mon + 4*[risky]c.agec18#c.agec18#c.change18mon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 2.68749 .3234863 8.31 0.000 2.053469 3.321512 ------------------------------------------------------------------------------

. * Effect of Change in Monitoring at Age 18 . lincom c.change18mon*1 + c.agec18#c.change18mon*0 + c.agec18#c.agec18#c.change18mon*0

( 1) [risky]change18mon = 0

------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | 4.716308 .8614941 5.47 0.000 3.02781 6.404805 ------------------------------------------------------------------------------

. predict Pred18BPWP, xb,

. corr risky Pred18BPWP (obs=1400)

| risky Pred1~WP -------------+------------------ risky | 1.0000 Pred18BPWP | 0.4894 1.0000



. display as result "Ch 9: Random Linear Age Model for Monitoring" Ch 9: Random Linear Age Model for Monitoring

. display as result "Saving Predicted Random Effects and Residuals as Data" Saving Predicted Random Effects and Residuals as Data

. mixed monitor c.agec18, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -676.87612 Iteration 1: log likelihood = -676.87612

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(1) = 0.16 Log likelihood = -676.87612 Prob > chi2 = 0.6861

------------------------------------------------------------------------------ monitor | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- agec18 | -.0033057 .0081793 -0.40 0.686 -.0193369 .0127255 _cons | 3.065015 .034128 89.81 0.000 2.998126 3.131905 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .0104944 .0013447 .0081638 .0134905 var(_cons) | .1954436 .0233316 .1546704 .2469652 cov(agec18,_cons) | -.000423 .0040081 -.0082787 .0074326 -----------------------------+------------------------------------------------ var(Residual) | .0807506 .0036117 .0739732 .0881489 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 1388.33 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -676.8761 6 1365.752 1385.542 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. predict monUage monU0, reffects,

. predict monEres, residuals

. . * Center random intercept at 3 (have to add fixed effect) . gen monUint = monU0+3.0650-3

. . display as result "Descriptives for Random Effects and Residuals" Descriptives for Random Effects and Residuals

. summarize(monUint monUage monEres)

Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- monUint | 1400 .065 .4101274 -1.497594 1.149218 monUage | 1400 -1.81e-10 .091895 -.2221221 .2739341 monEres | 1400 3.42e-10 .2482451 -.7779043 .757265

. . display as result "Ch 9 Eq 9.6: Predicting Risky Behavior" Ch 9 Eq 9.6: Predicting Risky Behavior

. display as result "from Monitoring Random Effects and Residuals" from Monitoring Random Effects and Residuals

. mixed risky c.agec18 c.agec18#c.agec18 c.att4 c.agec18#c.att4 /// > c.monUint c.monUint#c.agec18 c.monUage c.monUage#c.agec18 c.monEres, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3715.4007 Iteration 1: log likelihood = -3715.4007

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(9) = 602.72 Log likelihood = -3715.4007 Prob > chi2 = 0.0000

------------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------------+---------------------------------------------------------------- agec18 | 2.00976 .1384176 14.52 0.000 1.738467 2.281054 | c.agec18#c.agec18 | .1465475 .0205815 7.12 0.000 .1062086 .1868865 | att4 | -3.331767 .5137492 -6.49 0.000 -4.338697 -2.324837 | c.agec18#c.att4 | -.529372 .1027295 -5.15 0.000 -.7307182 -.3280258 | monUint | -4.359074 .7652822 -5.70 0.000 -5.859 -2.859149 | c.monUint#c.agec18 | -.5474589 .1530265 -3.58 0.000 -.8473854 -.2475325 | monUage | 3.756083 3.412991 1.10 0.271 -2.933257 10.44542 | c.monUage#c.agec18 | -1.748057 .6858482 -2.55 0.011 -3.092294 -.403819 | monEres | 3.557998 .3013236 11.81 0.000 2.967414 4.148581 _cons | 23.59709 .3294869 71.62 0.000 22.95131 24.24287 ------------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .498307 .0769795 .3681303 .6745161 var(_cons) | 15.59704 1.908355 12.27141 19.82393 cov(agec18,_cons) | 1.799114 .32767 1.156892 2.441335 -----------------------------+------------------------------------------------ var(Residual) | 7.331196 .3278895 6.715906 8.002856 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 635.17 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3715.401 14 7458.801 7504.978 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. estimates store FitUWPasfixed,

. . display as result "Ch 9 Eq 9.6: Predicting Risky Behavior" Ch 9 Eq 9.6: Predicting Risky Behavior

. display as result "from Monitoring Random Effects and Residuals" from Monitoring Random Effects and Residuals

. display as result "Adding Random Effect of WP Monitoring Residual" Adding Random Effect of WP Monitoring Residual

. mixed risky c.agec18 c.agec18#c.agec18 c.att4 c.agec18#c.att4 /// > c.monUint c.monUint#c.agec18 c.monUage c.monUage#c.agec18 c.monEres, /// > || personid: agec18 monEres, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3712.9942 Iteration 1: log likelihood = -3710.6298 Iteration 2: log likelihood = -3710.4508 Iteration 3: log likelihood = -3710.4025 Iteration 4: log likelihood = -3710.3879 Iteration 5: log likelihood = -3710.3854 Iteration 6: log likelihood = -3710.3853

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(9) = 589.48 Log likelihood = -3710.3853 Prob > chi2 = 0.0000

------------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------------+---------------------------------------------------------------- agec18 | 2.009853 .1378964 14.58 0.000 1.739581 2.280125 | c.agec18#c.agec18 | .146499 .0204683 7.16 0.000 .1063819 .1866162 | att4 | -3.205897 .5052471 -6.35 0.000 -4.196163 -2.215631 | c.agec18#c.att4 | -.5261396 .1029355 -5.11 0.000 -.7278895 -.3243897 | monUint | -4.391419 .7537818 -5.83 0.000 -5.868804 -2.914033 | c.monUint#c.agec18 | -.5520106 .1533508 -3.60 0.000 -.8525727 -.2514485 | monUage | 3.619208 3.373788 1.07 0.283 -2.993296 10.23171 | c.monUage#c.agec18 | -1.754342 .6874393 -2.55 0.011 -3.101698 -.4069858 | monEres | 3.517566 .3083171 11.41 0.000 2.913276 4.121857 _cons | 23.60472 .3280723 71.95 0.000 22.96171 24.24773 ------------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .5046969 . . . var(monEres) | 1.030301 . . . var(_cons) | 15.5873 . . . cov(agec18,monEres) | .0368036 . . . cov(agec18,_cons) | 1.803278 . . . cov(monEres,_cons) | 3.196908 . . . -----------------------------+------------------------------------------------ var(Residual) | 7.240263 . . . ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(6) = 645.20 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3710.385 10 7440.771 7473.754 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. estimates store FitUWPasrandom,

. lrtest FitUWPasrandom FitUWPasfixed, force

Likelihood-ratio test LR chi2(4) = -10.03 (Assumption: FitUWPasrandom nested in FitUWPasfixed) Prob > chi2 = 1.0000

. . display as result "Ch 9 Eq 9.6: Predicting Risky Behavior" Ch 9 Eq 9.6: Predicting Risky Behavior

. display as result "from Monitoring Random Effects and Residuals" from Monitoring Random Effects and Residuals

. display as result "Adding WP Monitoring by Age" Adding WP Monitoring by Age

. mixed risky c.agec18 c.agec18#c.agec18 c.att4 c.agec18#c.att4 /// > c.monUint c.monUint#c.agec18 c.monUage c.monUage#c.agec18 /// > c.monEres c.agec18#c.monEres, /// > || personid: agec18, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -3710.5794 Iteration 1: log likelihood = -3710.5794

Computing standard errors:

Mixed-effects ML regression Number of obs = 1400 Group variable: personid Number of groups = 200

Obs per group: min = 7 avg = 7.0 max = 7



Wald chi2(10) = 614.32 Log likelihood = -3710.5794 Prob > chi2 = 0.0000

------------------------------------------------------------------------------------ risky | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------------+---------------------------------------------------------------- agec18 | 2.006329 .1378934 14.55 0.000 1.736063 2.276595 | c.agec18#c.agec18 | .1452149 .0204877 7.09 0.000 .1050599 .18537 | att4 | -3.306071 .5137122 -6.44 0.000 -4.312929 -2.299214 | c.agec18#c.att4 | -.520759 .1027575 -5.07 0.000 -.72216 -.319358 | monUint | -4.615041 .7695191 -6.00 0.000 -6.123271 -3.106812 | c.monUint#c.agec18 | -.6000601 .1539402 -3.90 0.000 -.9017773 -.2983428 | monUage | 3.060632 3.419524 0.90 0.371 -3.641513 9.762776 | c.monUage#c.agec18 | -1.778625 .685806 -2.59 0.010 -3.12278 -.4344703 | monEres | 5.201006 .6070731 8.57 0.000 4.011164 6.390847 | c.agec18#c.monEres | .5444871 .1749224 3.11 0.002 .2016455 .8873287 | _cons | 23.61048 .3293018 71.70 0.000 22.96506 24.2559 ------------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(agec18) | .5006706 .0769436 .3704576 .6766524 var(_cons) | 15.62195 1.907302 12.29734 19.84538 cov(agec18,_cons) | 1.805091 .3274413 1.163318 2.446864 -----------------------------+------------------------------------------------ var(Residual) | 7.26096 .3247509 6.65156 7.926191 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 640.97 Prob > chi2 = 0.0000

Note: LR test is conservative and provided only for reference.

. estat ic, n(200),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 200 . -3710.579 15 7451.159 7500.634 ----------------------------------------------------------------------------- Note: N=200 used in calculating BIC

. . ****** END CHAPTER 9 MODELS ****** . . * Close log . log close STATA_Chapter9 name: STATA_Chapter9 log: C:\Dropbox\PilesOfVariance\Chapter9\STATA\STATA_Chapter9_Output.smcl log type: smcl closed on: 20 Jan 2015, 16:07:57 ------------------------------------------------------------------------------------------------------------------------------------------------------