Page 1 of 1

Extracting Standard Error Estimates

Posted: Wed Mar 21, 2012 9:38 am
by DewiOwen
Dear all,

I have been running a binomial multilevel model using runmlwin (the code is included at the end of the post) and was wondering if it was possible to extract the standard error estimates. I have been able to extract the parameter estimates from the e(b) matrix but cannot locate the standard errors.

Any help would be gratefully appreciated.

All the best,
Dewi Owen

runmlwin code

Code: Select all

runmlwin yhalfu0e0 constant, level3(LA:constant) level2(LSOA:constant) ///
level1(LSOA) discrete(distribution(binomial) link(logit) denominator(population)) ///
nopause batch

Re: Extracting Standard Error Estimates

Posted: Wed Mar 21, 2012 10:15 am
by ChrisCharlton
You should be able to calculate this from the variance matrix, e(V). The following is an example of how to do this is:

Code: Select all

matrix stderr = vecdiag(e(V))
forvalues i = 1/`=colsof(stderr)' {
    matrix stderr[1,`i'] = sqrt(stderr[1,`i'])
}
This should give you a matrix with the same dimensions as e(b), but where the values are the standard error instead of the estimates.

Re: Extracting Standard Error Estimates

Posted: Wed Mar 21, 2012 10:46 am
by DewiOwen
Hi Chris,

Worked perfectly. Great help. Thanks

All the best,
Dewi

Re: Extracting Standard Error Estimates

Posted: Wed Mar 21, 2012 11:02 am
by GeorgeLeckie
Hi Dewi

If all you want is to reference the standard error of a particular model parameter, then simply make use of _se[]

The following example should make things clear

Best wishes

George

Code: Select all

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

. 
. runmlwin normexam cons standlrt, level2(school: cons) level1(student: cons) nopause
 
MLwiN 2.25 multilevel model                     Number of obs      =      4059
Normal response model
Estimation algorithm: IGLS

-----------------------------------------------------------
                |   No. of       Observations per Group
 Level Variable |   Groups    Minimum    Average    Maximum
----------------+------------------------------------------
         school |       65          2       62.4        198
-----------------------------------------------------------

Run time (seconds)   =       1.58
Number of iterations =          4
Log likelihood       = -4678.6211
Deviance             =  9357.2422
------------------------------------------------------------------------------
    normexam |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        cons |   .0023908   .0400224     0.06   0.952    -.0760516    .0808332
    standlrt |   .5633712   .0124654    45.19   0.000     .5389394    .5878029
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: school              |
                   var(cons) |   .0921275   .0181475      .0565591     .127696
-----------------------------+------------------------------------------------
Level 1: student             |
                   var(cons) |    .565731   .0126585      .5409208    .5905412
------------------------------------------------------------------------------

. 
. display _se[FP1:cons]
.04002236

. 
. display _se[FP1:standlrt]
.0124654

. 
. display _se[RP2:var(cons)]
.01814751

. 
. display _se[RP1:var(cons)]
.01265848