------------------------------------------------------------------------------- name: log: Q:\C-modelling\runmlwin\website\logfiles\2020-03-27\16\14_Multivar > iate_Response_Models.smcl log type: smcl opened on: 27 Mar 2020, 17:42:56 . ***************************************************************************** > *** . * MLwiN User Manual . * . * 14 Multivariate Response Models > 211 . * . * Rasbash, J., Steele, F., Browne, W. J. and Goldstein, H. (2012). A User > 's . * Guide to MLwiN, v2.26. Centre for Multilevel Modelling, University of . * Bristol. . ***************************************************************************** > *** . * Stata do-file to replicate all analyses using runmlwin . * . * George Leckie and Chris Charlton, . * Centre for Multilevel Modelling, 2012 . * http://www.bristol.ac.uk/cmm/software/runmlwin/ . ***************************************************************************** > *** . . * 14.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . > 211 . . use "http://www.bristol.ac.uk/cmm/media/runmlwin/gcsemv1.dta", clear . . describe Contains data from http://www.bristol.ac.uk/cmm/media/runmlwin/gcsemv1.dta obs: 1,905 vars: 7 21 Oct 2011 12:19 ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- school float %9.0g student int %9.0g female byte %9.0g agemths int %9.0g written float %9.0g csework float %9.0g cons byte %9.0g ------------------------------------------------------------------------------- Sorted by: . . . . * 14.2 Specifying a multivariate model . . . . . . . . . . . . . . . . . . . > 212 . . . . * 14.3 Setting up the basic model . . . . . . . . . . . . . . . . . . . . . . > 214 . . runmlwin (written cons, eq(1)) (csework cons, eq(2)), /// > level1(student: (cons, eq(1)) (cons, eq(2))) nosort nopause MLwiN 3.05 multilevel model Number of obs = 1905 Multivariate response model (hierarchical) Estimation algorithm: IGLS Run time (seconds) = 0.77 Number of iterations = 3 Log likelihood = -13903.93 Deviance = 27807.859 ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- written | cons_1 | 46.80278 .3201668 146.18 0.000 46.17527 47.4303 -------------+---------------------------------------------------------------- csework | cons_2 | 73.364 .3882084 188.98 0.000 72.60313 74.12488 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ Level 1: student | var(cons_1) | 178.7101 6.10784 166.7389 190.6812 cov(cons_1,cons_2) | 102.3114 5.917505 90.71329 113.9095 var(cons_2) | 265.4484 9.016686 247.776 283.1208 ------------------------------------------------------------------------------ . . runmlwin (written cons female, eq(1)) (csework cons female, eq(2)), /// > level2(school: (cons, eq(1)) (cons, eq(2))) /// > level1(student: (cons, eq(1)) (cons, eq(2))) nopause MLwiN 3.05 multilevel model Number of obs = 1905 Multivariate response model (hierarchical) Estimation algorithm: IGLS ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ school | 73 2 26.1 104 ----------------------------------------------------------- Run time (seconds) = 0.89 Number of iterations = 4 Log likelihood = -13400.244 Deviance = 26800.489 ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- written | cons_1 | 49.45213 .9338433 52.96 0.000 47.62183 51.28243 female_1 | -2.50295 .5607219 -4.46 0.000 -3.601945 -1.403955 -------------+---------------------------------------------------------------- csework | cons_2 | 69.67166 1.171786 59.46 0.000 67.375 71.96831 female_2 | 6.751393 .6706493 10.07 0.000 5.436944 8.065841 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ Level 2: school | var(cons_1) | 46.81298 9.18733 28.80615 64.81982 cov(cons_1,cons_2) | 24.87783 8.880358 7.47265 42.28301 var(cons_2) | 75.16623 14.56485 46.61965 103.7128 -----------------------------+------------------------------------------------ Level 1: student | var(cons_1) | 124.6343 4.349834 116.1088 133.1598 cov(cons_1,cons_2) | 73.00323 4.17829 64.81393 81.19252 var(cons_2) | 180.0982 6.245801 167.8566 192.3397 ------------------------------------------------------------------------------ . . display [RP2]cov(cons_1\cons_2)/sqrt([RP2]var(cons_1)*[RP2]var(cons_2)) .41938991 . . display [RP1]cov(cons_1\cons_2)/sqrt([RP1]var(cons_1)*[RP1]var(cons_2)) .48726879 . . . . * 14.4 A more elaborate model . . . . . . . . . . . . . . . . . . . . . . . . > 219 . runmlwin (written cons female, eq(1)) (csework cons female, eq(2)), /// > level2(school: (cons female, eq(1)) (cons female, eq(2))) /// > level1(student: (cons, eq(1)) (cons, eq(2))) nopause MLwiN 3.05 multilevel model Number of obs = 1905 Multivariate response model (hierarchical) Estimation algorithm: IGLS ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ school | 73 2 26.1 104 ----------------------------------------------------------- Run time (seconds) = 1.39 Number of iterations = 7 Log likelihood = -13378.069 Deviance = 26756.139 ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- written | cons_1 | 49.40112 .9959368 49.60 0.000 47.44912 51.35312 female_1 | -2.471078 .6439406 -3.84 0.000 -3.733179 -1.208978 -------------+---------------------------------------------------------------- csework | cons_2 | 69.30076 1.356779 51.08 0.000 66.64152 71.96 female_2 | 7.156713 1.1353 6.30 0.000 4.931565 9.381861 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ Level 2: school | var(cons_1) | 54.54177 11.77079 31.47144 77.61209 cov(cons_1,female_1) | -7.449334 5.683746 -18.58927 3.690603 var(female_1) | 5.282196 4.238827 -3.025753 13.59014 cov(cons_1,cons_2) | 38.89313 12.68564 14.02974 63.75653 cov(female_1,cons_2) | -6.974819 7.295272 -21.27329 7.323651 var(cons_2) | 104.6957 21.82904 61.91162 147.4799 cov(cons_1,female_2) | -21.10519 9.965611 -40.63742 -1.572949 cov(female_1,female_2) | 11.00389 6.296341 -1.336708 23.3445 cov(cons_2,female_2) | -39.67547 14.69664 -68.48035 -10.87059 var(female_2) | 49.90979 14.60603 21.28249 78.53709 -----------------------------+------------------------------------------------ Level 1: student | var(cons_1) | 123.4099 4.371037 114.8428 131.977 cov(cons_1,cons_2) | 70.55722 4.105485 62.51061 78.60382 var(cons_2) | 169.8045 5.999766 158.0451 181.5638 ------------------------------------------------------------------------------ . // Note: The parameter estimates are correct, but note that variables in the . // random part are presented in a different order to that in the manual. . . runmlwin (written cons female, eq(1)) (csework cons female, eq(2)), /// > level2(school: (cons, eq(1)) (cons female, eq(2)), residuals(u)) /// > level1(student: (cons, eq(1)) (cons, eq(2))) nopause MLwiN 3.05 multilevel model Number of obs = 1905 Multivariate response model (hierarchical) Estimation algorithm: IGLS ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ school | 73 2 26.1 104 ----------------------------------------------------------- Run time (seconds) = 1.18 Number of iterations = 5 Log likelihood = -13380.189 Deviance = 26760.377 ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- written | cons_1 | 49.42993 .9361233 52.80 0.000 47.59516 51.2647 female_1 | -2.492371 .5604518 -4.45 0.000 -3.590837 -1.393906 -------------+---------------------------------------------------------------- csework | cons_2 | 69.2648 1.334986 51.88 0.000 66.64828 71.88133 female_2 | 7.212555 1.063411 6.78 0.000 5.128308 9.296802 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ Level 2: school | var(cons_1) | 47.14341 9.234378 29.04437 65.24246 cov(cons_1,cons_2) | 32.98425 10.77136 11.87278 54.09572 var(cons_2) | 101.1635 20.80882 60.37891 141.948 cov(cons_1,female_2) | -11.67732 7.61623 -26.60485 3.250219 cov(cons_2,female_2) | -33.98797 12.78244 -59.04109 -8.934851 var(female_2) | 40.44287 11.8183 17.27943 63.6063 -----------------------------+------------------------------------------------ Level 1: student | var(cons_1) | 124.5662 4.347568 116.0452 133.0873 cov(cons_1,cons_2) | 71.78998 4.104454 63.7454 79.83456 var(cons_2) | 170.7584 6.014908 158.9694 182.5474 ------------------------------------------------------------------------------ . . display [RP2]cov(cons_1\cons_2)/sqrt([RP2]var(cons_1)*[RP2]var(cons_2)) .47762191 . . display [RP2]cov(cons_1\female_2)/sqrt([RP2]var(cons_1)*[RP2]var(female_2)) -.2674309 . . display [RP2]cov(cons_2\female_2)/sqrt([RP2]var(cons_2)*[RP2]var(female_2)) -.53136439 . . graph matrix u0 u1 u2, half . . . . * 14.5 Multivariate models for discrete responses . . . . . . . . . . . . . . > 222 . . use "http://www.bristol.ac.uk/cmm/media/runmlwin/tutorial.dta", clear . . generate binexam = (normexam>0) . . generate binlrt = (standlrt>0) . . runmlwin (binexam cons, eq(1)) (binlrt cons, eq(2)), /// > level1(student:) /// > discrete(distribution(binomial binomial) denominator(cons cons)) /// > nosort nopause MLwiN 3.05 multilevel model Number of obs = 4059 Multivariate response model (hierarchical) Estimation algorithm: IGLS, MQL1 Run time (seconds) = 1.14 Number of iterations = 4 ------------------------------------------------------------------------------ | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- binexam | cons_1 | .0487902 .0314014 1.55 0.120 -.0127555 .1103359 -------------+---------------------------------------------------------------- binlrt | cons_2 | .0606246 .0314065 1.93 0.054 -.000931 .1221803 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ Level 1: student | var(bcons_1) | 1 4.86e-18 1 1 cov(bcons_1,bcons_2) | .4191395 .0119303 .3957565 .4425225 var(bcons_2) | 1 4.93e-18 1 1 ------------------------------------------------------------------------------ . . . . * Chapter learning outcomes . . . . . . . . . . . . . . . . . . . . . . . . . > 224 . . . . ***************************************************************************** > *** . exit end of do-file