-------------------------------------------------------------------------------
      name:  <unnamed>
       log:  Q:\C-modelling\runmlwin\website\logfiles\2024-10-11\18\13_Ordered_
> Categorical_Responses.smcl
  log type:  smcl
 opened on:  11 Oct 2024, 17:27:26

. ****************************************************************************
. *     MLwiN MCMC Manual 
. *
. * 13  Ordered Categorical Responses . . . . . . . . . . . . . . . . . . .181
. *
. *     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
. *     https://www.bristol.ac.uk/cmm/software/runmlwin/
. ****************************************************************************
. 
. * 13.1 A level chemistry dataset . . . . . . . . . . . . . . . . . . . . 181
. 
. use "https://www.bristol.ac.uk/cmm/media/runmlwin/alevchem.dta", clear

. 
. describe

Contains data from https://www.bristol.ac.uk/cmm/media/runmlwin/alevchem.dta
 Observations:         2,166                  
    Variables:             8                  21 Oct 2011 12:19
-------------------------------------------------------------------------------
Variable      Storage   Display    Value
    name         type    format    label      Variable label
-------------------------------------------------------------------------------
lea             int     %9.0g                 LEA ID
estab           int     %9.0g                 Establishment ID
pupil           float   %9.0g                 Pupil ID
a_point         byte    %9.0g      a_point    A-level point score
gcse_tot        byte    %9.0g                 Total GCSE point score
gcse_no         byte    %9.0g                 Number of GCSEs taken
cons            byte    %9.0g                 Constant
gender          byte    %9.0g      gender     Gender
-------------------------------------------------------------------------------
Sorted by: 

. 
. generate gcseav = gcse_tot/gcse_no

. 
. histogram gcseav
(bin=33, start=3.1428571, width=.14718615)

. 
. replace gcseav = gcseav - 6
(2,166 real changes made)

. 
. generate gcseav2 = gcseav^2

. 
. generate gcseav3 = gcseav^3

. 
. 
. 
. * 13.2 Normal response models . . . . . . . . . . . . . . . . . . . . . .184
. 
. quietly runmlwin a_point cons, ///
>         level1(pupil: cons) ///
>         nopause

. 
. runmlwin a_point cons, ///
>         level1(pupil: cons) ///
>         mcmc(on) initsprevious nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Normal response model (hierarchical)
Estimation algorithm: MCMC

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       6.83
Deviance (dbar)            =    8589.84
Deviance (thetabar)        =    8587.81
Effective no. of pars (pd) =       2.03
Bayesian DIC               =    8591.86
------------------------------------------------------------------------------
     a_point |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
        cons |   3.518598   .0376554     5419   0.000     3.443225     3.59127
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 1: pupil               |
                   var(cons) |  3.089023  .0954792   4888   2.911594  3.281004
------------------------------------------------------------------------------

. 
. rename gender female

. 
. runmlwin a_point cons gcseav gcseav2 gcseav3 female, ///
>         level1(pupil: cons)  nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Normal response model (hierarchical)
Estimation algorithm: IGLS

Run time (seconds)   =       2.71
Number of iterations =          2
Log likelihood       = -3485.9223
Deviance             =  6971.8447
------------------------------------------------------------------------------
     a_point |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        cons |   3.320883   .0406532   81.69    0.000     3.241204    3.400562
      gcseav |    1.56154   .0515331   30.30    0.000     1.460537    1.662543
     gcseav2 |   .1931122    .026556    7.27    0.000     .1410633     .245161
     gcseav3 |  -.0732638   .0189904   -3.86    0.000    -.1104843   -.0360433
      female |  -.4823484   .0532934   -9.05    0.000    -.5868015   -.3778954
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 1: pupil               |
                   var(cons) |   1.463583   .0444737      1.376417     1.55075
------------------------------------------------------------------------------

. 
. runmlwin a_point cons gcseav gcseav2 gcseav3 female, ///
>         level1(pupil: cons)  ///
>         mcmc(on) initsprevious nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Normal response model (hierarchical)
Estimation algorithm: MCMC

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       7.94
Deviance (dbar)            =    6977.81
Deviance (thetabar)        =    6971.85
Effective no. of pars (pd) =       5.96
Bayesian DIC               =    6983.77
------------------------------------------------------------------------------
     a_point |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
        cons |    3.31939   .0404338     5247   0.000     3.239266    3.397279
      gcseav |   1.560796   .0514493     4660   0.000      1.45944    1.662025
     gcseav2 |   .1937537   .0263828     4971   0.000     .1428038    .2451032
     gcseav3 |  -.0729788   .0192314     4955   0.000    -.1110337   -.0349861
      female |  -.4805784   .0521615     5066   0.000    -.5827646   -.3789485
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 1: pupil               |
                   var(cons) |  1.467329  .0442554   5000   1.384112   1.55798
------------------------------------------------------------------------------

. 
. gen pred = [FP1]cons + [FP1]gcseav*gcseav + [FP1]gcseav2*gcseav2 ///
>         + [FP1]gcseav3*gcseav3 + [FP1]female*female

. 
. twoway ///
>         (line pred gcseav if female==0, sort) ///
>         (line pred gcseav if female==1, sort)

. 
. 
. 
. 
. * 13.3 Ordered multinomial modelling . . . . . . . . . . . . . . . . . . 186
. 
. runmlwin a_point cons, ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: IGLS, MQL1

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Run time (seconds)   =       3.77
Number of iterations =          4
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.398436   .0537743  -26.01    0.000    -1.503831    -1.29304
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |   -.701469   .0456439  -15.37    0.000    -.7909294   -.6120086
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |  -.0998058    .043027   -2.32    0.020    -.1841371   -.0154744
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   .5949758   .0448891   13.25    0.000     .5069947    .6829568
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   1.602796   .0574293   27.91    0.000     1.490236    1.715355
------------------------------------------------------------------------------


. 
. runmlwin a_point cons, ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) ///
>         mcmc(on) initsprevious nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: MCMC

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       26.4
Deviance (dbar)            =    7726.43
Deviance (thetabar)        =    7721.41
Effective no. of pars (pd) =       5.02
Bayesian DIC               =    7731.46
------------------------------------------------------------------------------
             |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.404388   .0539265      241   0.000    -1.510123   -1.299689
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.7062973   .0465722      186   0.000    -.8008548    -.618658
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |  -.1033712   .0436276      186   0.009    -.1893483   -.0176887
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   .5926903   .0455491      220   0.000      .503162    .6778752
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   1.602202    .057449      428   0.000     1.489708     1.71914
------------------------------------------------------------------------------


. 
.         
. 
. * 13.4 Adding predictor variables . . . . . . . . . . . . . . . . . . . .191
. 
. runmlwin a_point cons (gcseav gcseav2 gcseav3 female, contrast(1/5)), ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: IGLS, MQL1

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Run time (seconds)   =       4.02
Number of iterations =          6
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.868101    .083689  -22.32    0.000    -2.032128   -1.704074
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.8270784   .0719785  -11.49    0.000    -.9681536   -.6860032
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .1383848   .0689091    2.01    0.045     .0033255    .2734442
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.304845   .0759066   17.19    0.000     1.156071     1.45362
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   2.995239   .1032021   29.02    0.000     2.792967    3.197512
-------------+----------------------------------------------------------------
gcseav_12345 |  -2.077311   .0947173  -21.93    0.000    -2.262953   -1.891669
gcseav~12345 |  -.4622603   .0521833   -8.86    0.000    -.5645377   -.3599829
gcseav~12345 |  -.0481332   .0365272   -1.32    0.188    -.1197251    .0234588
female_12345 |   .7544017   .0839844    8.98    0.000     .5897952    .9190081
------------------------------------------------------------------------------


. 
. runmlwin a_point cons (gcseav gcseav2 gcseav3 female, contrast(1/5)), ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) ///
>         mcmc(on) initsprevious nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: MCMC

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       34.4
Deviance (dbar)            =    6099.86
Deviance (thetabar)        =    6090.96
Effective no. of pars (pd) =       8.90
Bayesian DIC               =    6108.76
------------------------------------------------------------------------------
             |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.883893   .0818101      170   0.000    -2.042458   -1.724321
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.8386675   .0719557      144   0.000     -.980139   -.7002914
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .1281623    .067356      157   0.028    -.0029563    .2610732
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.296688   .0730275      187   0.000     1.155459    1.438708
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   2.987038   .1013874      294   0.000     2.788264    3.182985
-------------+----------------------------------------------------------------
gcseav_12345 |  -2.079406   .0986176      220   0.000    -2.276322    -1.88424
gcseav~12345 |  -.4542245   .0507463      265   0.000    -.5512939   -.3553254
gcseav~12345 |  -.0498362   .0391458      209   0.088     -.128801    .0267007
female_12345 |   .7573509   .0824371      271   0.000     .5999215    .9225242
------------------------------------------------------------------------------


. 
. 
. 
. * 13.5 Multilevel ordered response modelling . . . . . . . . . . . . . . 192
. 
. egen school = group(lea estab)

. // Note: Establishment codes on their own do not uniquely identify schools.
. // Schools are instead uniquely identified by LEA code, establishment ID 
. // combination. Thus, here we generated a unique school ID.
. 
. runmlwin a_point cons (gcseav gcseav2 female, contrast(1/5)), ///
>         level2(school: (cons, contrast(1/5))) ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6) pql2) nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: IGLS, PQL2

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
         school |      220          1        9.8         94
-----------------------------------------------------------

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Run time (seconds)   =       5.63
Number of iterations =         10
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |   -1.96551   .1092139  -18.00    0.000    -2.179565   -1.751454
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.7743616   .0992623   -7.80    0.000    -.9689122    -.579811
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .3175344   .0975968    3.25    0.001     .1262482    .5088205
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.602257   .1044415   15.34    0.000     1.397556    1.806959
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   3.431818   .1287165   26.66    0.000     3.179539    3.684098
-------------+----------------------------------------------------------------
gcseav_12345 |  -2.295235   .0711587  -32.26    0.000    -2.434703   -2.155766
gcseav~12345 |  -.4650907   .0467127   -9.96    0.000     -.556646   -.3735355
female_12345 |   .7484153   .0938655    7.97    0.000     .5644424    .9323882
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: school              |
             var(cons_12345) |   .6596637   .1107802      .4425385    .8767888
------------------------------------------------------------------------------

. 
. runmlwin a_point cons (gcseav gcseav2 female, contrast(1/5)), ///
>         level2(school: (cons, contrast(1/5))) ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) ///
>         mcmc(on) initsprevious nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: MCMC

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
         school |      220          1        9.8         94
-----------------------------------------------------------

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       42.5
Deviance (dbar)            =    5814.59
Deviance (thetabar)        =    5692.04
Effective no. of pars (pd) =     122.55
Bayesian DIC               =    5937.14
------------------------------------------------------------------------------
             |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.923212   .1229307       63   0.000    -2.152823   -1.671016
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |   -.767638   .1160738       48   0.000    -.9890748   -.5330881
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |    .300251   .1138173       48   0.003     .0875123    .5349658
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |    1.56449   .1215162       55   0.000     1.346591     1.81906
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   3.363311    .140462       73   0.000     3.099479    3.653081
-------------+----------------------------------------------------------------
gcseav_12345 |  -2.263649   .0684852      337   0.000    -2.405055   -2.122373
gcseav~12345 |  -.4578595   .0504218      218   0.000    -.5584839   -.3565204
female_12345 |   .7412699   .0985752      210   0.000     .5442226    .9299094
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 2: school              |
             var(cons_12345) |  .6442749  .1402424    208   .3916605  .9493606
------------------------------------------------------------------------------

. 
. runmlwin a_point cons (gcseav gcseav2 female, contrast(1/5)), ///
>         level2(school: (cons gcseav, contrast(1/5))) ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: IGLS, MQL1

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
         school |      220          1        9.8         94
-----------------------------------------------------------

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Run time (seconds)   =       4.13
Number of iterations =          8
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.779416    .097665  -18.22    0.000    -1.970836   -1.587996
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.7340901   .0891126   -8.24    0.000    -.9087475   -.5594327
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .2367004   .0876772    2.70    0.007     .0648562    .4085446
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.406258   .0940467   14.95    0.000      1.22193    1.590586
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   3.080954   .1169318   26.35    0.000     2.851772    3.310136
-------------+----------------------------------------------------------------
gcseav_12345 |  -2.106252   .0699045  -30.13    0.000    -2.243263   -1.969242
gcseav~12345 |  -.4236112   .0464491   -9.12    0.000    -.5146498   -.3325727
female_12345 |   .6798565   .0909794    7.47    0.000     .5015402    .8581727
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: school              |
           var(gcseav_12345) |   .0570307   .0506351     -.0422122    .1562736
cov(gcseav_12345,cons_12345) |  -.0288127   .0448175     -.1166534    .0590279
             var(cons_12345) |    .390208   .0811649      .2311277    .5492883
------------------------------------------------------------------------------

. 
. matrix b = e(b)

. 
. matrix V = e(V)

. 
. runmlwin a_point cons (gcseav gcseav2 female, contrast(1/5)), ///
>         level2(school: (cons gcseav, contrast(1/5))) ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) ///
>         mcmc(on) initsb(b) initsv(V) nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: MCMC

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
         school |      220          1        9.8         94
-----------------------------------------------------------

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       54.7
Deviance (dbar)            =    5773.70
Deviance (thetabar)        =    5621.36
Effective no. of pars (pd) =     152.34
Bayesian DIC               =    5926.04
------------------------------------------------------------------------------
             |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.932868   .1140593       68   0.000     -2.15146   -1.710196
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.7558737   .1032155       57   0.000     -.952064   -.5492296
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .3251431   .1025718       55   0.000     .1404013    .5399959
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.595631   .1103621       58   0.000     1.394653    1.829386
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   3.412361   .1345968       72   0.000     3.143861     3.68627
-------------+----------------------------------------------------------------
gcseav_12345 |  -2.314011    .081088      265   0.000    -2.470335    -2.15774
gcseav~12345 |  -.4434276   .0492435      326   0.000    -.5405809   -.3456572
female_12345 |   .7354497   .0951585      154   0.000     .5607752    .9216768
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 2: school              |
           var(gcseav_12345) |  .1566335  .0678255     57   .0541734  .3156172
cov(gcseav_12345,cons_12345) | -.0249766  .0762324     51  -.1711138  .1210128
             var(cons_12345) |  .6226776  .1361175    207   .4007601  .9174535
------------------------------------------------------------------------------

. 
. mcmcsum [RP2]var(cons_12345), detail

                            [RP2]var(cons_12345)
------------------------------------------------------------------------------
                                Percentiles
Mean          .6226776     0.5%   .3554488     Thinned Chain Length       5000
MCSE of Mean  .0057074     2.5%   .4007601     Effective Sample Size       207
Std. Dev.     .1361175       5%   .4233403     Raftery Lewis (2.5%)      16040
Mode          .5916733      25%   .5221309     Raftery Lewis (97.5%)     17865
P(mean)      0.000                             Brooks Draper (mean)      25027
P(mode)      0.000          50%   .6114691     
P(median)    0.000
                            75%   .7088134     
                            95%   .8649659     
                          97.5%   .9174535     
                          99.5%   1.026945     
------------------------------------------------------------------------------

. 
. mcmcsum [RP2]var(cons_12345), fiveway

. 
. runmlwin a_point cons (gcseav gcseav2 female, contrast(1/5)), ///
>         level2(school: (cons gcseav, contrast(1/5))) ///
>         level1(pupil:) ///
>         discrete(distribution(multinomial) link(ologit) denominator(cons) bas
> ecategory(6)) ///
>         mcmc(chain(50000)) initsb(b) initsv(V) nopause
 
MLwiN 3.13 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model (hierarchical)
Estimation algorithm: MCMC

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
         school |      220          1        9.8         94
-----------------------------------------------------------

----------------------------------
    Contrast | Log-odds
-------------+--------------------
           1 | 1 vs. 2 3 4 5 6
           2 | 1 2 vs. 3 4 5 6
           3 | 1 2 3 vs. 4 5 6
           4 | 1 2 3 4 vs. 5 6
           5 | 1 2 3 4 5 vs. 6
----------------------------------

Burnin                     =        500
Chain                      =      50000
Thinning                   =          1
Run time (seconds)         =        363
Deviance (dbar)            =    5781.18
Deviance (thetabar)        =    5633.46
Effective no. of pars (pd) =     147.72
Bayesian DIC               =    5928.90
------------------------------------------------------------------------------
             |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.937736   .1090278     1061   0.000    -2.153318   -1.726042
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.7616613   .0990766      809   0.000    -.9560805   -.5663348
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .3143735   .0976817      720   0.000     .1272104    .5075435
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.581964   .1058022      773   0.000     1.379558    1.793592
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   3.393485   .1318771      943   0.000     3.142371    3.662788
-------------+----------------------------------------------------------------
gcseav_12345 |  -2.309124   .0807148     2488   0.000    -2.470854   -2.154511
gcseav~12345 |  -.4440399   .0505988     3228   0.000    -.5404284   -.3443306
female_12345 |   .7383702    .094705     2389   0.000     .5528581    .9244734
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 2: school              |
           var(gcseav_12345) |  .1308195  .0734776    203   .0233414  .3042243
cov(gcseav_12345,cons_12345) | -.0310316  .0687734    792  -.1680551   .106125
             var(cons_12345) |  .6130687  .1337439   1941   .3841597   .906824
------------------------------------------------------------------------------

. 
. mcmcsum [RP2]var(cons_12345), detail

                            [RP2]var(cons_12345)
------------------------------------------------------------------------------
                                Percentiles
Mean          .6130687     0.5%   .3282724     Thinned Chain Length      50000
MCSE of Mean  .0017781     2.5%   .3841597     Effective Sample Size      1941
Std. Dev.     .1337439       5%    .414058     Raftery Lewis (2.5%)      11118
Mode          .5884722      25%   .5185931     Raftery Lewis (97.5%)      8276
P(mean)      0.000                             Brooks Draper (mean)      24291
P(mode)      0.000          50%   .6015386     
P(median)    0.000
                            75%   .6961889     
                            95%   .8476434     
                          97.5%    .906824     
                          99.5%   1.024229     
------------------------------------------------------------------------------

. 
. mcmcsum [RP2]var(cons_12345), fiveway

. 
. 
. 
. * Chapter learning outcomes . . . . . . . . . . . . . . . . . . . . . . .196
. 
. 
. 
. 
. 
. ****************************************************************************
. exit

end of do-file