------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  STATA_Chapter7a
       log:  C:\Dropbox\PilesOfVariance\Chapter7a\STATA\STATA_Chapter7a_Output.smcl
  log type:  smcl
 opened on:  12 Jan 2015, 10:30:51


. . display as result "Chapter 7a: Descriptive Statistics for Time-Invariant Variables" Chapter 7a: Descriptive Statistics for Time-Invariant Variables

. preserve

. collapse women baseage, by(personid)

. summarize women baseage

Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- women | 105 .7333333 .4443376 0 1 baseage | 105 80.12967 6.105009 69.70294 95.30732

. restore

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

. summarize symptoms

Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- symptoms | 509 1.273084 1.324394 0 5

. . display as result "Eq 7a.3: Empty Means, Random Intercept Model" Eq 7a.3: Empty Means, Random Intercept Model

. mixed symptoms , /// > || 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 = -721.48286 Iteration 1: log likelihood = -721.48286

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



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

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- _cons | 1.293954 .1120371 11.55 0.000 1.074365 1.513542 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | 1.189301 .183946 .8782918 1.610441 -----------------------------+------------------------------------------------ var(Residual) | .616175 .0434617 .5366175 .7075274 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 286.52 Prob >= chibar2 = 0.0000

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -721.4829 3 1448.966 1456.928 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. estat icc,

Intraclass correlation

------------------------------------------------------------------------------ Level | ICC Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid | .6587189 .0390572 .5786112 .7306859 ------------------------------------------------------------------------------

. estat wcorrelation, covariance,

Covariances for personid = 102:

obs | 1 2 3 4 5 -------------+---------------------------------------- 1 | 1.805 2 | 1.189 1.805 3 | 1.189 1.189 1.805 4 | 1.189 1.189 1.189 1.805 5 | 1.189 1.189 1.189 1.189 1.805

. estat wcorrelation,

Standard deviations and correlations for personid = 102:

Standard deviations:

obs | 1 2 3 4 5 -------------+---------------------------------------- sd | 1.344 1.344 1.344 1.344 1.344

Correlations:

obs | 1 2 3 4 5 -------------+---------------------------------------- 1 | 1.000 2 | 0.659 1.000 3 | 0.659 0.659 1.000 4 | 0.659 0.659 0.659 1.000 5 | 0.659 0.659 0.659 0.659 1.000

. estimates store FitEmpty,

. . display as result "Ch 7a: Testing Saturated Means by Day of Study" Ch 7a: Testing Saturated Means by Day of Study

. display as result "Random Intercept Only" Random Intercept Only

. mixed symptoms i.studyday, /// > || 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 = -717.4961 Iteration 1: log likelihood = -717.4961

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



Wald chi2(13) = 8.04 Log likelihood = -717.4961 Prob > chi2 = 0.8410

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- studyday | 2 | .0649345 .1313665 0.49 0.621 -.1925392 .3224082 3 | -.0642588 .1687662 -0.38 0.703 -.3950344 .2665168 4 | .1880234 .1956424 0.96 0.337 -.1954287 .5714755 5 | .0412025 .1860802 0.22 0.825 -.3235079 .405913 6 | .1177615 .1494617 0.79 0.431 -.1751781 .410701 7 | .0546413 .1334038 0.41 0.682 -.2068253 .3161079 8 | -.0233639 .1268237 -0.18 0.854 -.2719337 .2252059 9 | -.1800966 .1620194 -1.11 0.266 -.4976487 .1374555 10 | .191898 .1923642 1.00 0.318 -.1851288 .5689248 11 | -.305342 .281032 -1.09 0.277 -.8561546 .2454706 12 | -.0357739 .2491565 -0.14 0.886 -.5241116 .4525638 13 | -.0908273 .2491046 -0.36 0.715 -.5790633 .3974088 14 | -.2593001 .2445764 -1.06 0.289 -.7386611 .2200609 | _cons | 1.286923 .1307181 9.85 0.000 1.03072 1.543126 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | 1.181286 .182952 .8720167 1.60024 -----------------------------+------------------------------------------------ var(Residual) | .6053631 .0427253 .5271569 .6951716 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 284.02 Prob >= chibar2 = 0.0000

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -717.4961 16 1466.992 1509.456 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. contrast i.studyday,

Contrasts of marginal linear predictions

Margins : asbalanced

------------------------------------------------ | df chi2 P>chi2 -------------+---------------------------------- symptoms | studyday | 13 8.04 0.8410 ------------------------------------------------

. margins i.studyday,

Adjusted predictions Number of obs = 509

Expression : Linear prediction, fixed portion, predict()

------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- studyday | 1 | 1.286923 .1307181 9.85 0.000 1.03072 1.543126 2 | 1.351858 .1506917 8.97 0.000 1.056508 1.647208 3 | 1.222664 .1842287 6.64 0.000 .8615829 1.583746 4 | 1.474947 .2090974 7.05 0.000 1.065123 1.88477 5 | 1.328126 .1997736 6.65 0.000 .9365768 1.719675 6 | 1.404685 .1664002 8.44 0.000 1.078546 1.730823 7 | 1.341565 .1522341 8.81 0.000 1.043191 1.639938 8 | 1.263559 .1467232 8.61 0.000 .9759871 1.551132 9 | 1.106827 .1780593 6.22 0.000 .7578368 1.455817 10 | 1.478821 .2060714 7.18 0.000 1.074929 1.882714 11 | .9815813 .2905867 3.38 0.001 .4120419 1.551121 12 | 1.251149 .2598247 4.82 0.000 .7419024 1.760396 13 | 1.196096 .2598201 4.60 0.000 .686858 1.705334 14 | 1.027623 .2554936 4.02 0.000 .5268648 1.528381 ------------------------------------------------------------------------------

. margins i.studyday, pwcompare(pveffects)

Pairwise comparisons of adjusted predictions

Expression : Linear prediction, fixed portion, predict()

----------------------------------------------------- | Delta-method Unadjusted | Contrast Std. Err. z P>|z| -------------+--------------------------------------- studyday | 2 vs 1 | .0649345 .1313665 0.49 0.621 3 vs 1 | -.0642588 .1687662 -0.38 0.703 4 vs 1 | .1880234 .1956424 0.96 0.337 5 vs 1 | .0412025 .1860802 0.22 0.825 6 vs 1 | .1177615 .1494617 0.79 0.431 7 vs 1 | .0546413 .1334038 0.41 0.682 8 vs 1 | -.0233639 .1268237 -0.18 0.854 9 vs 1 | -.1800966 .1620194 -1.11 0.266 10 vs 1 | .191898 .1923642 1.00 0.318 11 vs 1 | -.305342 .281032 -1.09 0.277 12 vs 1 | -.0357739 .2491565 -0.14 0.886 13 vs 1 | -.0908273 .2491046 -0.36 0.715 14 vs 1 | -.2593001 .2445764 -1.06 0.289 3 vs 2 | -.1291933 .1833364 -0.70 0.481 4 vs 2 | .1230888 .2083223 0.59 0.555 5 vs 2 | -.023732 .204183 -0.12 0.907 6 vs 2 | .0528269 .1682802 0.31 0.754 7 vs 2 | -.0102932 .153328 -0.07 0.946 8 vs 2 | -.0882985 .1472839 -0.60 0.549 9 vs 2 | -.2450311 .177889 -1.38 0.168 10 vs 2 | .1269635 .2073994 0.61 0.540 11 vs 2 | -.3702765 .2919777 -1.27 0.205 12 vs 2 | -.1007084 .2636231 -0.38 0.702 13 vs 2 | -.1557618 .2618625 -0.59 0.552 14 vs 2 | -.3242347 .2577307 -1.26 0.208 4 vs 3 | .2522822 .2309504 1.09 0.275 5 vs 3 | .1054613 .2306733 0.46 0.648 6 vs 3 | .1820203 .2039437 0.89 0.372 7 vs 3 | .1189001 .1873571 0.63 0.526 8 vs 3 | .0408949 .1830826 0.22 0.823 9 vs 3 | -.1158378 .2066114 -0.56 0.575 10 vs 3 | .2561568 .2316284 1.11 0.269 11 vs 3 | -.2410832 .3057441 -0.79 0.430 12 vs 3 | .0284849 .2853531 0.10 0.920 13 vs 3 | -.0265685 .2847462 -0.09 0.926 14 vs 3 | -.1950413 .2781578 -0.70 0.483 5 vs 4 | -.1468208 .2431978 -0.60 0.546 6 vs 4 | -.0702619 .2238191 -0.31 0.754 7 vs 4 | -.1333821 .2132498 -0.63 0.532 8 vs 4 | -.2113873 .2088075 -1.01 0.311 9 vs 4 | -.36812 .2332127 -1.58 0.114 10 vs 4 | .0038746 .2532711 0.02 0.988 11 vs 4 | -.4933653 .32041 -1.54 0.124 12 vs 4 | -.2237973 .3025634 -0.74 0.459 13 vs 4 | -.2788506 .3014346 -0.93 0.355 14 vs 4 | -.4473235 .2994554 -1.49 0.135 6 vs 5 | .0765589 .2088338 0.37 0.714 7 vs 5 | .0134388 .2011133 0.07 0.947 8 vs 5 | -.0645665 .1985366 -0.33 0.745 9 vs 5 | -.2212991 .2252692 -0.98 0.326 10 vs 5 | .1506955 .2503606 0.60 0.547 11 vs 5 | -.3465445 .322005 -1.08 0.282 12 vs 5 | -.0769764 .2824081 -0.27 0.785 13 vs 5 | -.1320298 .2951325 -0.45 0.655 14 vs 5 | -.3005027 .2917648 -1.03 0.303 7 vs 6 | -.0631201 .1676589 -0.38 0.707 8 vs 6 | -.1411254 .1616283 -0.87 0.383 9 vs 6 | -.2978581 .1952228 -1.53 0.127 10 vs 6 | .0741365 .2219176 0.33 0.738 11 vs 6 | -.4231034 .3023503 -1.40 0.162 12 vs 6 | -.1535354 .2679717 -0.57 0.567 13 vs 6 | -.2085887 .2690775 -0.78 0.438 14 vs 6 | -.3770616 .2709644 -1.39 0.164 8 vs 7 | -.0780052 .1474815 -0.53 0.597 9 vs 7 | -.2347379 .1820014 -1.29 0.197 10 vs 7 | .1372567 .2115156 0.65 0.516 11 vs 7 | -.3599833 .295901 -1.22 0.224 12 vs 7 | -.0904152 .2621495 -0.34 0.730 13 vs 7 | -.1454686 .2633286 -0.55 0.581 14 vs 7 | -.3139414 .2565165 -1.22 0.221 9 vs 8 | -.1567327 .1765997 -0.89 0.375 10 vs 8 | .2152619 .2054159 1.05 0.295 11 vs 8 | -.281978 .292143 -0.97 0.334 12 vs 8 | -.01241 .2583705 -0.05 0.962 13 vs 8 | -.0674633 .2612481 -0.26 0.796 14 vs 8 | -.2359362 .2568273 -0.92 0.358 10 vs 9 | .3719946 .2255788 1.65 0.099 11 vs 9 | -.1252454 .3045753 -0.41 0.681 12 vs 9 | .1443227 .2787547 0.52 0.605 13 vs 9 | .0892693 .2769179 0.32 0.747 14 vs 9 | -.0792035 .2728678 -0.29 0.772 11 vs 10 | -.49724 .3205613 -1.55 0.121 12 vs 10 | -.2276719 .3013952 -0.76 0.450 13 vs 10 | -.2827253 .2935172 -0.96 0.335 14 vs 10 | -.4511981 .2917033 -1.55 0.122 12 vs 11 | .2695681 .3611986 0.75 0.455 13 vs 11 | .2145147 .3604393 0.60 0.552 14 vs 11 | .0460419 .3576197 0.13 0.898 13 vs 12 | -.0550534 .3370198 -0.16 0.870 14 vs 12 | -.2235262 .3316323 -0.67 0.500 14 vs 13 | -.1684729 .3170431 -0.53 0.595 -----------------------------------------------------

. . display as result "Ch 7a: Testing Fixed Linear Effect of Day of Study" Ch 7a: Testing Fixed Linear Effect of Day of Study

. display as result "Random Intercept Only" Random Intercept Only

. mixed symptoms c.studyday1, /// > || 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 = -721.07808 Iteration 1: log likelihood = -721.07808

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



Wald chi2(1) = 0.81 Log likelihood = -721.07808 Prob > chi2 = 0.3680

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- studyday1 | -.00893 .0099197 -0.90 0.368 -.0283723 .0105122 _cons | 1.335096 .121011 11.03 0.000 1.097918 1.572273 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | 1.18996 .1839956 .8788544 1.611195 -----------------------------+------------------------------------------------ var(Residual) | .614894 .0433711 .5355023 .706056 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 287.13 Prob >= chibar2 = 0.0000

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -721.0781 4 1450.156 1460.772 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. estimates store FitFixDayofStudy,

. . display as result "Ch 7a: Testing Random Linear Effect of Day of Study" Ch 7a: Testing Random Linear Effect of Day of Study

. mixed symptoms c.studyday1, /// > || personid: studyday1, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -720.30648 Iteration 1: log likelihood = -720.08666 Iteration 2: log likelihood = -720.08637 Iteration 3: log likelihood = -720.08637

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



Wald chi2(1) = 0.60 Log likelihood = -720.08637 Prob > chi2 = 0.4386

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- studyday1 | -.0083746 .0108113 -0.77 0.439 -.0295643 .0128152 _cons | 1.333354 .1210305 11.02 0.000 1.096139 1.57057 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(studyd~1) | .0019996 .0016602 .0003928 .0101784 var(_cons) | 1.203731 .215703 .8472238 1.710255 cov(studyd~1,_cons) | -.0050188 .014841 -.0341067 .0240691 -----------------------------+------------------------------------------------ var(Residual) | .58349 .0464096 .4992643 .6819244 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 289.12 Prob > chi2 = 0.0000

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

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -720.0864 6 1452.173 1468.096 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. estimates store FitRandDayofStudy,

. lrtest FitRandDayofStudy FitFixDayofStudy,

Likelihood-ratio test LR chi2(2) = 1.98 (Assumption: FitFixDayofS~y nested in FitRandDayof~y) Prob > chi2 = 0.3709

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 7a: Testing Saturated Means by Day of Week" Ch 7a: Testing Saturated Means by Day of Week

. display as result "Random Intercept Only" Random Intercept Only

. mixed symptoms i.dayofweek, /// > || 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 = -721.14987 Iteration 1: log likelihood = -721.14987

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



Wald chi2(6) = 0.67 Log likelihood = -721.14987 Prob > chi2 = 0.9952

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dayofweek | 2 | -.0147541 .1886514 -0.08 0.938 -.384504 .3549959 3 | -.0428198 .1903809 -0.22 0.822 -.4159595 .3303199 4 | .0151205 .1678102 0.09 0.928 -.3137814 .3440225 5 | -.0517181 .1555261 -0.33 0.739 -.3565436 .2531074 6 | -.0624108 .1317641 -0.47 0.636 -.3206637 .1958421 7 | -.0721049 .1435154 -0.50 0.615 -.35339 .2091802 | _cons | 1.337115 .1572183 8.50 0.000 1.028973 1.645258 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | 1.189076 .1841042 .8778464 1.610649 -----------------------------+------------------------------------------------ var(Residual) | .6152118 .0434067 .5357565 .7064506 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 284.41 Prob >= chibar2 = 0.0000

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -721.1499 9 1460.3 1484.185 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. contrast i.dayofweek,

Contrasts of marginal linear predictions

Margins : asbalanced

------------------------------------------------ | df chi2 P>chi2 -------------+---------------------------------- symptoms | dayofweek | 6 0.67 0.9952 ------------------------------------------------

. margins i.dayofweek,

Adjusted predictions Number of obs = 509

Expression : Linear prediction, fixed portion, predict()

------------------------------------------------------------------------------ | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- dayofweek | 1 | 1.337115 .1572183 8.50 0.000 1.028973 1.645258 2 | 1.322361 .1863984 7.09 0.000 .9570271 1.687695 3 | 1.294296 .1781142 7.27 0.000 .9451981 1.643393 4 | 1.352236 .1558551 8.68 0.000 1.046765 1.657706 5 | 1.285397 .1458217 8.81 0.000 .999592 1.571203 6 | 1.274704 .1229243 10.37 0.000 1.033777 1.515632 7 | 1.26501 .1372873 9.21 0.000 .9959323 1.534088 ------------------------------------------------------------------------------

. margins i.dayofweek, pwcompare(pveffects)

Pairwise comparisons of adjusted predictions

Expression : Linear prediction, fixed portion, predict()

----------------------------------------------------- | Delta-method Unadjusted | Contrast Std. Err. z P>|z| -------------+--------------------------------------- dayofweek | 2 vs 1 | -.0147541 .1886514 -0.08 0.938 3 vs 1 | -.0428198 .1903809 -0.22 0.822 4 vs 1 | .0151205 .1678102 0.09 0.928 5 vs 1 | -.0517181 .1555261 -0.33 0.739 6 vs 1 | -.0624108 .1317641 -0.47 0.636 7 vs 1 | -.0721049 .1435154 -0.50 0.615 3 vs 2 | -.0280657 .2098616 -0.13 0.894 4 vs 2 | .0298746 .1944615 0.15 0.878 5 vs 2 | -.036964 .187232 -0.20 0.843 6 vs 2 | -.0476567 .1661742 -0.29 0.774 7 vs 2 | -.0573508 .1763767 -0.33 0.745 4 vs 3 | .0579403 .1809791 0.32 0.749 5 vs 3 | -.0088983 .17515 -0.05 0.959 6 vs 3 | -.0195911 .1562362 -0.13 0.900 7 vs 3 | -.0292852 .171795 -0.17 0.865 5 vs 4 | -.0668386 .1515546 -0.44 0.659 6 vs 4 | -.0775314 .1294294 -0.60 0.549 7 vs 4 | -.0872255 .1454729 -0.60 0.549 6 vs 5 | -.0106928 .117083 -0.09 0.927 7 vs 5 | -.0203869 .1336603 -0.15 0.879 7 vs 6 | -.0096941 .1064634 -0.09 0.927 -----------------------------------------------------

. . display as result "Ch 7a: Testing Fixed Effect of Weekend" Ch 7a: Testing Fixed Effect of Weekend

. display as result "Random Intercept Only" Random Intercept Only

. mixed symptoms c.weekend, /// > || 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 = -721.28173 Iteration 1: log likelihood = -721.28173

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



Wald chi2(1) = 0.40 Log likelihood = -721.28173 Prob > chi2 = 0.5257

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- weekend | -.0464164 .0731406 -0.63 0.526 -.1897694 .0969366 _cons | 1.317625 .1181543 11.15 0.000 1.086047 1.549204 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | 1.191385 .1842377 .879875 1.613182 -----------------------------+------------------------------------------------ var(Residual) | .6153304 .0434037 .5358793 .7065613 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 286.91 Prob >= chibar2 = 0.0000

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -721.2817 4 1450.563 1461.179 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. estimates store FitFixWeekend,

. . display as result "Ch 7a: Testing Random Effect of Weekend" Ch 7a: Testing Random Effect of Weekend

. mixed symptoms c.weekend, /// > || personid: weekend, variance mle covariance(unstructured),

Performing EM optimization:

Performing gradient-based optimization:

Iteration 0: log likelihood = -722.71893 Iteration 1: log likelihood = -721.1791 Iteration 2: log likelihood = -721.14497 Iteration 3: log likelihood = -721.14481 Iteration 4: log likelihood = -721.14481

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



Wald chi2(1) = 0.41 Log likelihood = -721.14481 Prob > chi2 = 0.5234

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- weekend | -.046703 .0731957 -0.64 0.523 -.190164 .0967579 _cons | 1.318414 .1200422 10.98 0.000 1.083136 1.553692 ------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Unstructured | var(weekend) | .0016219 .0010806 .0004395 .0059863 var(_cons) | 1.23837 .1877832 .9199758 1.666957 cov(weekend,_cons) | -.044817 .0152206 -.0746489 -.0149852 -----------------------------+------------------------------------------------ var(Residual) | .6146827 .0464119 .5301279 .7127238 ------------------------------------------------------------------------------ LR test vs. linear regression: chi2(3) = 287.18 Prob > chi2 = 0.0000

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

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -721.1448 6 1454.29 1470.213 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. estimates store FitRandWeekend,

. lrtest FitRandWeekend FitFixWeekend,

Likelihood-ratio test LR chi2(2) = 0.27 (Assumption: FitFixWeekend nested in FitRandWeekend) Prob > chi2 = 0.8720

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 "Eq 7a.4: Adding Sex and Age to the Model for the Means" Eq 7a.4: Adding Sex and Age to the Model for the Means

. mixed symptoms c.women c.age80 c.women#c.age80, /// > || 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 = -716.28897 Iteration 1: log likelihood = -716.28897

Computing standard errors:

Mixed-effects ML regression Number of obs = 509 Group variable: personid Number of groups = 105

Obs per group: min = 2 avg = 4.8 max = 5



Wald chi2(3) = 10.85 Log likelihood = -716.28897 Prob > chi2 = 0.0126

--------------------------------------------------------------------------------- symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] ----------------+---------------------------------------------------------------- women | -.5306419 .2451324 -2.16 0.030 -1.011093 -.0501912 age80 | .0999995 .0370575 2.70 0.007 .0273681 .1726309 | c.women#c.age80 | -.1104279 .0422013 -2.62 0.009 -.1931409 -.027715 | _cons | 1.712739 .2107731 8.13 0.000 1.299632 2.125847 ---------------------------------------------------------------------------------

------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ personid: Identity | var(_cons) | 1.072738 .1667213 .7910477 1.454737 -----------------------------+------------------------------------------------ var(Residual) | .6151891 .0433293 .5358663 .706254 ------------------------------------------------------------------------------ LR test vs. linear regression: chibar2(01) = 271.56 Prob >= chibar2 = 0.0000

. estat ic, n(105),

Akaike's information criterion and Bayesian information criterion

----------------------------------------------------------------------------- Model | Obs ll(null) ll(model) df AIC BIC -------------+--------------------------------------------------------------- . | 105 . -716.289 6 1444.578 1460.502 ----------------------------------------------------------------------------- Note: N=105 used in calculating BIC

. estat vce,

Covariance matrix of coefficients of mixed model

| symptoms | lns1_1_1 | lnsig_e | c.women# | | e(V) | women age80 c.age80 _cons | _cons | _cons -------------+------------------------------------------------+------------+------------ symptoms | | | women | .0600899 | | age80 | -.00131503 .00137326 | | c.women#| | | c.age80 | .00111354 -.00137326 .00178095 | | _cons | -.04442528 .00131503 -.00131503 .04442528 | | -------------+------------------------------------------------+------------+------------ lns1_1_1 | | | _cons | 0 0 0 0 | .00603859 | -------------+------------------------------------------------+------------+------------ lnsig_e | | | _cons | 0 0 0 0 | -.00015954 | .00124018

. * Multivariate Test of Fixed Effects . test (c.women=0) (c.age80=0) (c.women#c.age80=0)

( 1) [symptoms]women = 0 ( 2) [symptoms]age80 = 0 ( 3) [symptoms]c.women#c.age80 = 0

chi2( 3) = 10.85 Prob > chi2 = 0.0126

. * Age Slope for Men . lincom c.age80*1 + c.women#c.age80*0

( 1) [symptoms]age80 = 0

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | .0999995 .0370575 2.70 0.007 .0273681 .1726309 ------------------------------------------------------------------------------

. * Age Slope for Women . lincom c.age80*1 + c.women#c.age80*1

( 1) [symptoms]age80 + [symptoms]c.women#c.age80 = 0

------------------------------------------------------------------------------ symptoms | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- (1) | -.0104285 .0201913 -0.52 0.606 -.0500027 .0291457 ------------------------------------------------------------------------------

. estimates store FitSexAge,

. lrtest FitSexAge FitEmpty,

Likelihood-ratio test LR chi2(3) = 10.39 (Assumption: FitEmpty nested in FitSexAge) Prob > chi2 = 0.0155

. predict PredSexAge, xb,

. corr symptoms PredSexAge (obs=509)

| symptoms PredSe~e -------------+------------------ symptoms | 1.0000 PredSexAge | 0.2201 1.0000



. . ****** END CHAPTER 7a MODELS ****** . . * Close log . log close STATA_Chapter7a name: STATA_Chapter7a log: C:\Dropbox\PilesOfVariance\Chapter7a\STATA\STATA_Chapter7a_Output.smcl log type: smcl closed on: 12 Jan 2015, 10:30:57 ------------------------------------------------------------------------------------------------------------------------------------------------------