2-level empty ordinal model

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
Post Reply
vivian1234
Posts: 30
Joined: Tue Apr 12, 2016 10:54 am

2-level empty ordinal model

Post by vivian1234 »

Hi,

I am new to runmlwin and I have a problem in running a 2-level empty model for my ordinal outcome variable.

This is my code:

Code: Select all

runmlwin outcome cons, ///
	level2(hh: (cons))	///
	level1(id:)	///
	discrete(distribution(multinomial) link(ologit) denominator(cons) basecategory(4) pql2) nopause

Code: Select all

runmlwin outcome cons, ///
	level2(hh: (cons))	///
	level1(id:)	///
	discrete(distribution(multinomial) link(ologit) denominator(cons) basecategory(4))  ///
	mcmc(on) initsprevious nopause

However, the result looks strange. rather than giving me the value for var(cons_123), it gives me 6 random effect parameters.

Thank you very much!

Vivian
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: 2-level empty ordinal model

Post by ChrisCharlton »

Is the following more like what you are after?

Code: Select all

use http://www.bristol.ac.uk/cmm/media/runmlwin/alevchem, clear
egen school = group(lea estab)

Code: Select all

runmlwin a_point cons, level2(school: (cons, contrast(1/5))) level1(pupil: ) discrete(distribution(multinomial) link(ologit) denom(cons) base(6) pql2) nopause

MLwiN 2.36 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model
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)   =       4.84
Number of iterations =          8
------------------------------------------------------------------------------
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.372275   .1031697   -13.30   0.000    -1.574484   -1.170066
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |  -.4809893   .0982812    -4.89   0.000    -.6736169   -.2883616
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .2940195   .0976683     3.01   0.003     .1025931    .4854459
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.171295   .1001301    11.70   0.000     .9750433    1.367546
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   2.391542   .1099275    21.76   0.000     2.176088    2.606996
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: school              |
             var(cons_12345) |   1.329894   .1784171      .9802029    1.679585
------------------------------------------------------------------------------

Code: Select all

runmlwin a_point cons, level2(school: (cons, contrast(1/5))) level1(pupil: ) discrete(distribution(multinomial) link(ologit) denom(cons) base(6)) mcmc(on) initsprevious nopause


MLwiN 2.36 multilevel model                     Number of obs      =      2166
Ordered multinomial logit response model
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)         =       46.6
Deviance (dbar)            =    7046.19
Deviance (thetabar)        =    6891.03
Effective no. of pars (pd) =     155.16
Bayesian DIC               =    7201.36
------------------------------------------------------------------------------
             |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
Contrast 1   |
      cons_1 |  -1.324595    .103499       40   0.000    -1.506988   -1.094635
-------------+----------------------------------------------------------------
Contrast 2   |
      cons_2 |   -.462988    .098712       36   0.000    -.6341004   -.2398282
-------------+----------------------------------------------------------------
Contrast 3   |
      cons_3 |   .2886934   .1000466       35   0.000     .1082631    .5150148
-------------+----------------------------------------------------------------
Contrast 4   |
      cons_4 |   1.142674   .1030695       38   0.000     .9477457    1.380694
-------------+----------------------------------------------------------------
Contrast 5   |
      cons_5 |   2.339768    .113265       47   0.000      2.12508    2.583499
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 2: school              |
             var(cons_12345) |  1.271291  .1928117    469   .9335589  1.688362
------------------------------------------------------------------------------
vivian1234
Posts: 30
Joined: Tue Apr 12, 2016 10:54 am

Re: 2-level empty ordinal model

Post by vivian1234 »

So I have to specify contrast(1/3) in the 2nd level random part? Is it because the var(cons.123) is the only random part?

Thank you so much!


Vivian
ChrisCharlton
Posts: 1384
Joined: Mon Oct 19, 2009 10:34 am

Re: 2-level empty ordinal model

Post by ChrisCharlton »

The contrast option is used where you want a parameter to be common across more than one of the response categories (as in your case), otherwise the default is to have a separate parameter for each of the response categories.
Post Reply