Page 1 of 1

Residual covariance estimate

Posted: Wed Nov 21, 2012 7:14 pm
by as3601
Hi,

I was wondering if it is possible to access the covariance between the random effect residuals after fitting a model.

runmlwin height con age , level1(age: cons ) level2(id : cons age, residuals(resid , var) )

I was almost hoping it might be something like this

runmlwin ..... .... , residuals(resid , covar)


Thanks Adrian

Re: Residual covariance estimate

Posted: Thu Nov 22, 2012 9:34 am
by GeorgeLeckie
Hi Adrian,

When you use the residuals() option, runmlwin returns the point estimate and standard error for each residual u0_j and u1_j. The standard errors are simply the square roots of the sampling variances for each residuals. Sounds like you additionally want to know what the sampling covariance is between each pair of residuals u0_j and u1_j for each group j.

You can retrieve the full sampling variance-covariance matrix for each pair of residuals u0_j and u1_j as follows.

Code: Select all

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

runmlwin normexam cons standlrt, ///
    level2 (school: cons standlrt, residuals(u, sampling)) ///
    level1 (student: cons) ///
    nopause

MLwiN 2.26 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)   =       2.45
Number of iterations =          4
Log likelihood       = -4658.4351
Deviance             =  9316.8701
------------------------------------------------------------------------------
    normexam |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        cons |  -.0115052    .039783    -0.29   0.772    -.0894784     .066468
    standlrt |   .5567305    .019937    27.92   0.000     .5176548    .5958063
------------------------------------------------------------------------------

------------------------------------------------------------------------------
   Random-effects Parameters |   Estimate   Std. Err.     [95% Conf. Interval]
-----------------------------+------------------------------------------------
Level 2: school              |
                   var(cons) |   .0904446    .017924      .0553143    .1255749
          cov(cons,standlrt) |   .0180414   .0067229      .0048649     .031218
               var(standlrt) |   .0145361   .0044139      .0058851    .0231872
-----------------------------+------------------------------------------------
Level 1: student             |
                   var(cons) |   .5536575   .0124818      .5291936    .5781214
------------------------------------------------------------------------------

. describe u0* u1*

              storage  display     value
variable name   type   format      label      variable label
------------------------------------------------------------------------------
u0              float  %9.0g                  u0 residual estimate
u0se            float  %9.0g                  u0se residual standard error
u0var           float  %9.0g                  u0var sampling variance
u0u1cov         float  %9.0g                  u0u1cov sampling covariance
u1              float  %9.0g                  u1 residual estimate
u1se            float  %9.0g                  u1se residual standard error
u1var           float  %9.0g                  u1var sampling variance

Best wishes

George

Re: Residual covariance estimate

Posted: Thu Nov 22, 2012 9:54 am
by as3601
Many thanks George, thats perfect.

I should have read the help file more carefully.

bw
Adrian