Getting p-values and z-ratios after MCMC

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
AnjaScheiwe
Posts: 9
Joined: Wed Mar 21, 2012 10:01 pm

Getting p-values and z-ratios after MCMC

Post by AnjaScheiwe »

Hi,

I am running cross-classified models using the MCMC option. The output shows the z values and ESS. The runmlwin help file says it is possible to get p-values with the option zratio, but when I try I get this error message:

'option zratio not allowed'

This is how I specified the option:

Code: Select all

runmlwin read cons , level3 (dlsoa:cons) level2(schoolid: cons) level1(mcsid: cons) mcmc (cc  ) initsb (b) zratio nopause
And I noticed that the column header for what I think must be standard errors says "Std. Dev."?

Many thanks for your help!
Anja
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Getting p-values and z-ratios after MCMC

Post by GeorgeLeckie »

Hi Anja,

This works for me (see below). Perhaps you do not have the latest version of runmlwin? You can make sure you have the latest version by reinstalling the command

. ssc install runmlwin, replace


You have fitted the model by MCMC. The reported parameter estimate and standard error are the mean and standard deviation of each parmater chain. This is why the column header says Std. Dev. rather than Std. Err. For more details, see ...

Code: Select all

. help runmlwin##MCMC

The following cross-classified MCMC model where I specify the zratio option works for me...

Code: Select all

use http://www.bristol.ac.uk/cmm/media/runmlwin/xc, clear

rename sex female

matrix b = (0,0,0,.33,.33,.33)

runmlwin attain cons vrq female, ///
	level3(sid: cons) ///
	level2(pid: cons) ///
	level1(pupil: cons) ///
	mcmc(cc) initsb(b) ///
	nopause

runmlwin, zratio
where the associated output is ...

Code: Select all

.  use http://www.bristol.ac.uk/cmm/media/runmlwin/xc, clear

. 
. rename sex female

. 
. matrix b = (0,0,0,.33,.33,.33)

. 
. runmlwin attain cons vrq female, ///
>         level3(sid: cons) ///
>         level2(pid: cons) ///
>         level1(pupil: cons) ///
>         mcmc(cc) initsb(b) ///
>         nopause
 
MLwiN 2.25 multilevel model                     Number of obs      =      3435
Normal response model
Estimation algorithm: MCMC

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
            sid |       19         92      180.8        290
            pid |      148          1       23.2         72
-----------------------------------------------------------

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       9.61
Deviance (dbar)            =   14722.51
Deviance (thetabar)        =   14640.15
Effective no. of pars (pd) =      82.36
Bayesian DIC               =   14804.87
------------------------------------------------------------------------------
      attain |      Mean    Std. Dev.     ESS     P       [95% Cred. Interval]
-------------+----------------------------------------------------------------
        cons |  -10.03677   .2782066     3395   0.000    -10.58556   -9.488309
         vrq |   .1595779     .00278     4032   0.000     .1542097    .1650367
      female |   .1153955   .0707506     4990   0.050    -.0219772    .2540834
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 3: sid                 |
                   var(cons) |  .0186722  .0226424    341   .0006828  .0824305
-----------------------------+------------------------------------------------
Level 2: pid                 |
                   var(cons) |  .2793266  .0634311    756   .1687999   .419538
-----------------------------+------------------------------------------------
Level 1: pupil               |
                   var(cons) |  4.257366   .105822   4027   4.056459  4.472385
------------------------------------------------------------------------------

. 
. runmlwin, zratio
 
MLwiN 2.25 multilevel model                     Number of obs      =      3435
Normal response model
Estimation algorithm: MCMC

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
            sid |       19         92      180.8        290
            pid |      148          1       23.2         72
-----------------------------------------------------------

Burnin                     =        500
Chain                      =       5000
Thinning                   =          1
Run time (seconds)         =       9.61
Deviance (dbar)            =   14722.51
Deviance (thetabar)        =   14640.15
Effective no. of pars (pd) =      82.36
Bayesian DIC               =   14804.87
------------------------------------------------------------------------------
      attain |      Mean    Std. Dev.      z    P>|z|     [95% Cred. Interval]
-------------+----------------------------------------------------------------
        cons |  -10.03677   .2782066   -36.08   0.000    -10.58556   -9.488309
         vrq |   .1595779     .00278    57.40   0.000     .1542097    .1650367
      female |   .1153955   .0707506     1.63   0.103    -.0219772    .2540834
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |     Mean   Std. Dev.   ESS     [95% Cred. Int]
-----------------------------+------------------------------------------------
Level 3: sid                 |
                   var(cons) |  .0186722  .0226424    341   .0006828  .0824305
-----------------------------+------------------------------------------------
Level 2: pid                 |
                   var(cons) |  .2793266  .0634311    756   .1687999   .419538
-----------------------------+------------------------------------------------
Level 1: pupil               |
                   var(cons) |  4.257366   .105822   4027   4.056459  4.472385
------------------------------------------------------------------------------

Best wishes

George
AnjaScheiwe
Posts: 9
Joined: Wed Mar 21, 2012 10:01 pm

Re: Getting p-values and z-ratios after MCMC

Post by AnjaScheiwe »

Dear George,

many thanks for the quick reply and the explanation re standard error/standard deviation.

I do have version 2.25 installed but the "runmlwin, zratio" command still doesn't return p values for me. I pasted my output and code below:

Code: Select all

. runmlwin maths7sas cons , level3 (dlsoa:cons) level2(s4schoolid: cons) level1(mcsid: cons) mcmc (cc  ) 
> initsb (b)  nopause

MLwiN 2.25 multilevel model              Number of obs      =      8974
Normal response model
Estimation algorithm: MCMC

No. of       Observations per Group
Level Variable    Groups    Minimum    Average    Maximum

dlsoa             4296          1        2.1         30
s4schoolid        3705          1        2.4         23
  


maths7sas       Mean     Std. Dev.      z      ESS     [95% Cred. Interval]

cons          99.35482   .1970295   504.26    1899     98.97349    99.75081



Random-effects Parameters      Mean    Std. Dev.   ESS     [95% Cred. Int]

Level 3: dlsoa               
var(cons)                    19.45014  3.053055     45   13.86732   25.9982

Level 2: s4schoolid          
var(cons)                    27.89111  3.278613     70   21.74235  34.28221

Level 1: mcsid               
var(cons)                    185.9832  3.752668    523   178.8243  193.2765


. runmlwin, zratio
 
MLwiN 2.25 multilevel model                   Number of obs      =      8974
Normal response model
Estimation algorithm: MCMC


No. of  Observations per Group
Level Variable       Groups    Minimum    Average    Maximum

dlsoa                 4296          1        2.1         30
s4schoolid            3705          1        2.4         23



maths7sas         Mean    Std. Dev.      z      ESS     [95% Cred. Interval]

cons           99.35482   .1970295   504.26    1899     98.97349    99.75081



Random-effects Parameters      Mean    Std. Dev.   ESS     [95% Cred. Int]
 
Level 3: dlsoa               
var(cons)                    19.45014  3.053055     45   13.86732   25.9982

Level 2: s4schoolid          
var(cons)                    27.89111  3.278613     70   21.74235  34.28221

Level 1: mcsid               
var(cons)                    185.9832  3.752668    523   178.8243  193.2765



Did I miss something?

Many thanks!
Anja
GeorgeLeckie
Site Admin
Posts: 432
Joined: Fri Apr 01, 2011 2:14 pm

Re: Getting p-values and z-ratios after MCMC

Post by GeorgeLeckie »

Hi Anja,

I see that you are using MLwiN 2.25, but are you sure that you are using the latest version of runmlwin? The runmlwin output still looks like an old version of runmlwin.

Please reinstall runmlwin by typing the following from within Stata...

Code: Select all

. ssc install runmlwin, replace
Once you have done this, please check that the latest version of runmlwin has installed properly by typing...

Code: Select all

. which runmlwin
You should get output similar to the following...

Code: Select all

. which runmlwin
Q:\C-Modelling\runmlwin\development version\runmlwin\runmlwin.ado
*! runmlwin.ado, George Leckie and Chris Charlton, 01Apr2012
Importantly, you should see the date 01Apr2012 in this output.

Best wishes

George
AnjaScheiwe
Posts: 9
Joined: Wed Mar 21, 2012 10:01 pm

Re: Getting p-values and z-ratios after MCMC

Post by AnjaScheiwe »

Dear George,

you are right of course - all is working now. :oops:

Many thanks and best wishes
Anja
Post Reply