------------------------------------------------------------------------------- name: log: Q:\C-modelling\runmlwin\website\logfiles\2020-03-27\16\11_Poisson_ > Response_Modelling.smcl log type: smcl opened on: 27 Mar 2020, 17:52:01 . **************************************************************************** . * MLwiN MCMC Manual . * . * 11 Poisson Response Modelling . . . . . . . . . . . . . . . . . . . . 153 . * . * Browne, W. J. (2009). MCMC Estimation in 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/ . **************************************************************************** . . use "http://www.bristol.ac.uk/cmm/media/runmlwin/mmmec1.dta", clear . . describe Contains data from http://www.bristol.ac.uk/cmm/media/runmlwin/mmmec1.dta obs: 354 vars: 8 21 Oct 2011 12:19 ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- nation byte %9.0g nation region byte %9.0g county int %9.0g obs int %9.0g exp float %9.0g cons byte %9.0g uvbi float %9.0g pcons byte %9.0g ------------------------------------------------------------------------------- Sorted by: . . generate logexp = ln(exp) . . . . * 11.1 Simple Poisson regression model . . . . . . . . . . . . . . . . . 155 . . quietly runmlwin obs cons uvbi, /// > level3(nation:) /// > level2(region:) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) nopause . . runmlwin obs cons uvbi, /// > level3(nation:) /// > level2(region:) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) /// > mcmc(chain(50000) refresh(500)) initsprevious nopause MLwiN 3.05 multilevel model Number of obs = 354 Poisson response model (hierarchical) Estimation algorithm: MCMC ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ nation | 9 3 39.3 95 region | 78 1 4.5 13 ----------------------------------------------------------- Burnin = 500 Chain = 50000 Thinning = 1 Run time (seconds) = 4.45 Deviance (dbar) = 3449.53 Deviance (thetabar) = 3447.55 Effective no. of pars (pd) = 1.98 Bayesian DIC = 3451.51 ------------------------------------------------------------------------------ obs | Mean Std. Dev. ESS P [95% Cred. Interval] -------------+---------------------------------------------------------------- cons | -.0702949 .0110378 9042 0.000 -.0919045 -.0487234 uvbi | -.0572782 .0026597 8847 0.000 -.0625682 -.0521541 ------------------------------------------------------------------------------ . . mcmcsum [FP1]uvbi, detail [FP1]uvbi ------------------------------------------------------------------------------ Percentiles Mean -.0572782 0.5% -.0642551 Thinned Chain Length 50000 MCSE of Mean .0000284 2.5% -.0625682 Effective Sample Size 8847 Std. Dev. .0026597 5% -.0617024 Raftery Lewis (2.5%) 14347 Mode -.0572027 25% -.0590637 Raftery Lewis (97.5%) 13253 P(mean) 0.000 Brooks Draper (mean) 619 P(mode) 0.000 50% -.0572499 P(median) 0.000 75% -.0554795 95% -.052926 97.5% -.0521541 99.5% -.0504964 ------------------------------------------------------------------------------ . . mcmcsum [FP1]uvbi, fiveway . . . . . * 11.2 Adding in region level random effects . . . . . . . . . . . . . . 157 . . quietly runmlwin obs cons uvbi, /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) nopause . . runmlwin obs cons uvbi, /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) /// > mcmc(chain(50000)) initsprevious nopause MLwiN 3.05 multilevel model Number of obs = 354 Poisson response model (hierarchical) Estimation algorithm: MCMC ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ region | 78 1 4.5 13 ----------------------------------------------------------- Burnin = 500 Chain = 50000 Thinning = 1 Run time (seconds) = 7.67 Deviance (dbar) = 2041.16 Deviance (thetabar) = 1970.69 Effective no. of pars (pd) = 70.47 Bayesian DIC = 2111.64 ------------------------------------------------------------------------------ obs | Mean Std. Dev. ESS P [95% Cred. Interval] -------------+---------------------------------------------------------------- cons | -.1417152 .0498678 294 0.001 -.2381636 -.0443247 uvbi | -.0340505 .0105985 321 0.001 -.054799 -.0133338 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Mean Std. Dev. ESS [95% Cred. Int] -----------------------------+------------------------------------------------ Level 2: region | var(cons) | .1805027 .0344024 15908 .124399 .2587509 ------------------------------------------------------------------------------ . . mcmcsum [FP1]uvbi, detail [FP1]uvbi ------------------------------------------------------------------------------ Percentiles Mean -.0340505 0.5% -.060848 Thinned Chain Length 50000 MCSE of Mean .0004888 2.5% -.054799 Effective Sample Size 321 Std. Dev. .0105985 5% -.0515406 Raftery Lewis (2.5%) 51634 Mode -.0342684 25% -.0411758 Raftery Lewis (97.5%) 60155 P(mean) 0.001 Brooks Draper (mean) 183570 P(mode) 0.001 50% -.0341391 P(median) 0.001 75% -.026813 95% -.0166213 97.5% -.0133338 99.5% -.0073429 ------------------------------------------------------------------------------ . . mcmcsum [FP1]uvbi, fiveway . . . . * 11.3 Including nation effects in the model . . . . . . . . . . . . . . 159 . . quietly runmlwin obs cons uvbi, /// > level3(nation: cons) /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) nopause . . runmlwin obs cons uvbi, /// > level3(nation: cons) /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) /// > mcmc(chain(50000)) initsprevious nopause MLwiN 3.05 multilevel model Number of obs = 354 Poisson response model (hierarchical) Estimation algorithm: MCMC ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ nation | 9 3 39.3 95 region | 78 1 4.5 13 ----------------------------------------------------------- Burnin = 500 Chain = 50000 Thinning = 1 Run time (seconds) = 9.63 Deviance (dbar) = 2040.45 Deviance (thetabar) = 1979.25 Effective no. of pars (pd) = 61.20 Bayesian DIC = 2101.64 ------------------------------------------------------------------------------ obs | Mean Std. Dev. ESS P [95% Cred. Interval] -------------+---------------------------------------------------------------- cons | -.1270336 .1822526 37 0.233 -.5042819 .2394809 uvbi | -.0291518 .0109121 306 0.006 -.049802 -.0070511 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Mean Std. Dev. ESS [95% Cred. Int] -----------------------------+------------------------------------------------ Level 3: nation | var(cons) | .2245879 .1700022 592 .062867 .663199 -----------------------------+------------------------------------------------ Level 2: region | var(cons) | .0506131 .0116454 5442 .0316445 .0771522 ------------------------------------------------------------------------------ . . tabulate nation nation | Freq. Percent Cum. ------------+----------------------------------- 1 | 11 3.11 3.11 2 | 30 8.47 11.58 3 | 14 3.95 15.54 4 | 94 26.55 42.09 5 | 70 19.77 61.86 6 | 95 26.84 88.70 7 | 26 7.34 96.05 8 | 3 0.85 96.89 9 | 11 3.11 100.00 ------------+----------------------------------- Total | 354 100.00 . . generate belgium = (nation==1) . . generate wgermany = (nation==2) . . generate denmark = (nation==3) . . generate france = (nation==4) . . generate uk = (nation==5) . . generate italy = (nation==6) . . generate ireland = (nation==7) . . generate luxembourg = (nation==8) . . generate netherlands = (nation==9) . . quietly runmlwin obs uvbi belgium-netherlands, /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) nopause . . runmlwin obs uvbi belgium-netherlands, /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) /// > mcmc(chain(50000)) initsprevious nopause MLwiN 3.05 multilevel model Number of obs = 354 Poisson response model (hierarchical) Estimation algorithm: MCMC ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ region | 78 1 4.5 13 ----------------------------------------------------------- Burnin = 500 Chain = 50000 Thinning = 1 Run time (seconds) = 16.8 Deviance (dbar) = 2039.32 Deviance (thetabar) = 1977.76 Effective no. of pars (pd) = 61.56 Bayesian DIC = 2100.88 ------------------------------------------------------------------------------ obs | Mean Std. Dev. ESS P [95% Cred. Interval] -------------+---------------------------------------------------------------- uvbi | -.0246666 .0124906 215 0.028 -.0482138 .0007516 belgium | -.1448352 .146569 570 0.164 -.4332714 .1452215 wgermany | .4471666 .0806086 284 0.000 .2950033 .6065294 denmark | .6500426 .1602866 369 0.000 .348332 .9789517 france | -.5533764 .0584111 1217 0.000 -.6691086 -.441531 uk | -.1658915 .0931592 344 0.041 -.3439749 .0209304 italy | -.0805433 .0986388 260 0.202 -.2783997 .1149857 ireland | -.6540695 .186046 2997 0.000 -1.022491 -.2867783 luxembourg | -.0532279 .316143 3772 0.438 -.6770702 .5663515 netherlands | .0170209 .1361036 497 0.447 -.252528 .2859675 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Mean Std. Dev. ESS [95% Cred. Int] -----------------------------+------------------------------------------------ Level 2: region | var(cons) | .0518363 .012244 3822 .0323844 .079948 ------------------------------------------------------------------------------ . . . . * 11.4 Interaction with UV exposure . . . . . . . . . . . . . . . . . . .161 . . foreach var of varlist belgium-netherlands { 2. . generate `var'Xuvbi = `var'*uvbi 3. . } . . quietly runmlwin obs belgium-netherlands belgiumXuvbi-netherlandsXuvbi, /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) nopause . . matrix b = e(b) . . matrix V = e(V) . . runmlwin obs belgium-netherlands belgiumXuvbi-netherlandsXuvbi, /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) /// > mcmc(chain(50000)) initsb(b) initsv(V) nopause MLwiN 3.05 multilevel model Number of obs = 354 Poisson response model (hierarchical) Estimation algorithm: MCMC ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ region | 78 1 4.5 13 ----------------------------------------------------------- Burnin = 500 Chain = 50000 Thinning = 1 Run time (seconds) = 24.9 Deviance (dbar) = 2026.97 Deviance (thetabar) = 1965.01 Effective no. of pars (pd) = 61.95 Bayesian DIC = 2088.92 ------------------------------------------------------------------------------ obs | Mean Std. Dev. ESS P [95% Cred. Interval] -------------+---------------------------------------------------------------- belgium | .8578639 .6401522 41 0.061 -.3351097 2.160622 wgermany | .4751676 .1148532 194 0.000 .2525713 .7008874 denmark | .4522425 .7633578 30 0.301 -.896336 1.867101 france | -.59289 .0553293 1477 0.000 -.7027236 -.4848803 uk | .5990007 .1803375 93 0.001 .2192649 .9270838 italy | .2812826 .1115665 379 0.002 .0766469 .5109113 ireland | -.531236 1.195825 67 0.342 -2.825914 1.756896 luxembourg | 6.085308 8.872184 26 0.265 -11.51869 20.57583 netherlands | -.5110252 1.008254 30 0.266 -2.617993 1.671373 belgiumXuvbi | .3166227 .2171381 41 0.049 -.0852628 .7625054 wgermanyXu~i | -.0140824 .0314208 219 0.326 -.0758529 .0479817 denmarkXuvbi | -.0580177 .1347134 30 0.363 -.2963691 .1941858 franceXuvbi | .0127516 .0178822 1753 0.235 -.0221759 .0486347 ukXuvbi | .1384196 .0372984 94 0.000 .0597328 .2060151 italyXuvbi | -.0870577 .0169275 413 0.000 -.1226269 -.0550112 irelandXuvbi | .000161 .2403333 67 0.489 -.4541734 .4650083 luxembourg~i | 2.650788 3.862278 26 0.267 -4.975717 8.972584 netherland~i | -.1517474 .2406202 30 0.229 -.6578035 .3664549 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Mean Std. Dev. ESS [95% Cred. Int] -----------------------------+------------------------------------------------ Level 2: region | var(cons) | .0370898 .0090859 4112 .0225153 .0579267 ------------------------------------------------------------------------------ . . . . * 11.5 Problems with univariate updating Metropolis procedures . . . . . 163 . . mcmcsum [FP1]belgium, detail [FP1]belgium ------------------------------------------------------------------------------ Percentiles Mean .8578639 0.5% -.7158128 Thinned Chain Length 50000 MCSE of Mean .0899193 2.5% -.3351097 Effective Sample Size 41 Std. Dev. .6401522 5% -.0606993 Raftery Lewis (2.5%) 334698 Mode .6586438 25% .405001 Raftery Lewis (97.5%) 219131 P(mean) 0.061 Brooks Draper (mean) 6.21e+07 P(mode) 0.061 50% .8046708 P(median) 0.061 75% 1.278879 95% 1.894291 97.5% 2.160622 99.5% 2.988487 ------------------------------------------------------------------------------ . . mcmcsum [FP1]belgium, fiveway . // Note: The ACF appears to decay far less rapidly than in the manual. This . // is simply because the y-axis min in the manual is not zero. . . . runmlwin obs belgium-netherlands belgiumXuvbi-netherlandsXuvbi, /// > level2(region: cons) /// > level1(county:) /// > discrete(distribution(poisson) offset(logexp)) /// > mcmc(chain(500000) refresh(5000) thin(10)) initsb(b) initsv(V) nopaus > e MLwiN 3.05 multilevel model Number of obs = 354 Poisson response model (hierarchical) Estimation algorithm: MCMC ----------------------------------------------------------- | No. of Observations per Group Level Variable | Groups Minimum Average Maximum ----------------+------------------------------------------ region | 78 1 4.5 13 ----------------------------------------------------------- Burnin = 500 Chain = 500000 Thinning = 10 Run time (seconds) = 83.7 Deviance (dbar) = 2027.74 Deviance (thetabar) = 1964.72 Effective no. of pars (pd) = 63.02 Bayesian DIC = 2090.76 ------------------------------------------------------------------------------ obs | Mean Std. Dev. ESS P [95% Cred. Interval] -------------+---------------------------------------------------------------- belgium | .7707885 .7588583 250 0.146 -.6376544 2.315168 wgermany | .4779363 .1211763 1737 0.000 .2431207 .7157115 denmark | .3194772 .8632719 115 0.353 -1.414622 1.924098 france | -.593911 .0554771 13375 0.000 -.7033642 -.4852809 uk | .60329 .2002747 757 0.002 .2109056 .9973101 italy | .28387 .1053505 4193 0.004 .0766133 .4882318 ireland | -.5057696 1.282862 622 0.353 -3.053353 1.922467 luxembourg | 11.86214 13.19029 34 0.202 -14.64652 35.60062 netherlands | -.3817197 .9731309 110 0.320 -2.055653 1.785649 belgiumXuvbi | .2882826 .2562311 250 0.119 -.1828226 .8126168 wgermanyXu~i | -.0134098 .0327738 1917 0.337 -.0770468 .0514705 denmarkXuvbi | -.081988 .152394 114 0.307 -.3888821 .2029759 franceXuvbi | .0130508 .0181562 15069 0.232 -.0223601 .0490385 ukXuvbi | .1394967 .0409904 779 0.000 .0592857 .220074 italyXuvbi | -.0875917 .0158838 4530 0.000 -.1188226 -.0562009 irelandXuvbi | .0054146 .2584456 622 0.487 -.5046844 .4994981 luxembourg~i | 5.173478 5.750236 34 0.202 -6.352049 15.53132 netherland~i | -.12124 .2334498 110 0.281 -.5247816 .4022533 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Random-effects Parameters | Mean Std. Dev. ESS [95% Cred. Int] -----------------------------+------------------------------------------------ Level 2: region | var(cons) | .0371232 .0092258 22312 .0224 .058408 ------------------------------------------------------------------------------ . . mcmcsum [FP1]belgium, detail [FP1]belgium ------------------------------------------------------------------------------ Percentiles Mean .770707 0.5% -1.27343 Thinned Chain Length 50000 MCSE of Mean .0142295 2.5% -.6376544 Effective Sample Size 250 Std. Dev. .7589864 5% -.4029895 Raftery Lewis (2.5%) 624700 Mode .694071 25% .2625261 Raftery Lewis (97.5%) 567690 P(mean) 0.146 Brooks Draper (mean) 1.56e+07 P(mode) 0.146 50% .7431573 P(median) 0.146 75% 1.25471 95% 2.057445 97.5% 2.315168 99.5% 2.91081 ------------------------------------------------------------------------------ . . mcmcsum [FP1]belgium, fiveway . // Note: The ACF appears to decay far less rapidly than in the manual. This . // is simply because the y-axis min in the manual is not zero. . . . . * Chapter learning outcomes . . . . . . . . . . . . . . . . . . . . . . .166 . . . . . . **************************************************************************** . exit end of do-file