------------------------------------------------------------------------------- name: log: Q:\C-modelling\runmlwin\website\logfiles\2020-03-27\16\6.8.smcl log type: smcl opened on: 27 Mar 2020, 18:21:59 . **************************************************************************** . * Module 6: Regression Models for Binary Responses Stata Practicals . * . * P6.8: Modelling Proportions . * . * George Leckie . * Centre for Multilevel Modelling, 2010 . **************************************************************************** . * Stata do-file to replicate all analyses using runmlwin . * . * George Leckie . * Centre for Multilevel Modelling, 2013 . * http://www.bristol.ac.uk/cmm/software/runmlwin/ . **************************************************************************** . . use "http://www.bristol.ac.uk/cmm/media/runmlwin/6.8.dta", clear . . . . * P6.8.1 Creating a community-level dataset . . generate nwom = 1 . . collapse (sum) nwom (mean) antemed cons meduc3 urban wealth, by(comm) . . list in 1/10 +------------------------------------------------------------+ | comm nwom antemed cons meduc3 urban wealth | |------------------------------------------------------------| 1. | 1 14 .5 1 .5 0 2.857143 | 2. | 2 19 .368421 1 .315789 0 2.947368 | 3. | 3 21 .3809524 1 .428571 0 3.380952 | 4. | 4 18 .6666667 1 .277778 0 3.222222 | 5. | 5 22 .3181818 1 .318182 0 2.818182 | |------------------------------------------------------------| 6. | 6 20 .3 1 .6 0 3.1 | 7. | 7 21 .1428571 1 .380952 0 2.619048 | 8. | 8 19 .2631579 1 .157895 0 2.947368 | 9. | 9 12 .5 1 .416667 0 2.666667 | 10. | 10 23 .1304348 1 .173913 0 2.173913 | +------------------------------------------------------------+ . . . . * P6.8.2 Fitting a binomial logit model . . runmlwin antemed cons urban wealth meduc3, /// > level1(comm:) /// > discrete(distribution(binomial) link(logit) denominator(nwom)) /// > nopause MLwiN 3.05 multilevel model Number of obs = 361 Binomial logit response model (hierarchical) Estimation algorithm: IGLS, MQL1 Run time (seconds) = 0.53 Number of iterations = 4 ------------------------------------------------------------------------------ antemed | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- cons | -2.373551 .1121731 -21.16 0.000 -2.593406 -2.153696 urban | .4733457 .0777822 6.09 0.000 .3208954 .6257961 wealth | .6059295 .0466306 12.99 0.000 .5145351 .6973239 meduc3 | 1.439371 .1835553 7.84 0.000 1.079609 1.799133 ------------------------------------------------------------------------------ . . * P6.8.3 Extrabinomial variation . . runmlwin antemed cons urban wealth meduc3, /// > level1(comm:) /// > discrete(distribution(binomial) link(logit) denominator(nwom) extra) > /// > nopause MLwiN 3.05 multilevel model Number of obs = 361 Binomial logit response model (hierarchical) Estimation algorithm: IGLS, MQL1 Run time (seconds) = 0.52 Number of iterations = 5 ------------------------------------------------------------------------------ antemed | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- cons | -2.373559 .1647187 -14.41 0.000 -2.696402 -2.050716 urban | .4733479 .1141826 4.15 0.000 .2495542 .6971417 wealth | .6059315 .0684591 8.85 0.000 .4717541 .7401089 meduc3 | 1.439379 .2694996 5.34 0.000 .911169 1.967588 ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Overdispersion Parameters | Estimate Std. Err. [95% Conf. Interval] -----------------------------+------------------------------------------------ bcons_1 | 2.153307 .1601327 1.839453 2.467161 ------------------------------------------------------------------------------ . end of do-file