Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: nlcom and xtmixed


From   [email protected] (Roberto G. Gutierrez, StataCorp)
To   [email protected]
Subject   Re: st: nlcom and xtmixed
Date   Tue, 18 Apr 2006 13:12:37 -0500

Lars Korsholm <[email protected]> asks:

> how do I use nlcon on the estimated random efects after xtmixed?

> say
> xtmixed score || _all: R.varA || _all: R.varB

The key lies in looking at the output of 

. mat list e(b)

to see how variance components are labeled, and also in realizing that
these variance components are parameterized as logs of standard deviations
and hyperbolic arctangents of correlations (should there be any).  For some
insight on why it is done this way, see the Methods and Formulas section of 
[XT] xtmixed.  In short, you want a natural metric that permits the entire
real line.

A model similar to Lars fit on the famous pig data of [XT] xtmixed is obtained
as

. webuse pig
. xtmixed weight || _all:R.id || _all:R.week

for which I won't include the output.  However proceeding with the analysis
we get 

    . mat list e(b)

e(b)[1,4]
       weight:  lns1_1_1:  lns1_2_1:   lnsig_e:
        _cons      _cons      _cons      _cons
y1  50.405093  1.3590895  2.8337452  .72895655

which shows the variance component due to -id- is labeled as "[lns_1_1]_cons"
and that for -week- is labled as "[lns1_2_1]_cons", and that the values 
shown correspond to the logs of the estimated standard deviation of the 
appropriate random effects.

As such, if we wanted a ratio of the standard deviations (that for -id-
to that for -week-), we would do

. nlcom ratio: exp([lns1_1_1]_cons - [lns1_2_1]_cons)

       ratio:  exp([lns1_1_1]_cons - [lns1_2_1]_cons)

------------------------------------------------------------------------------
      weight |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
       ratio |   .2288575   .0621967     3.68   0.000     .1069542    .3507608
------------------------------------------------------------------------------

Similarly, if we wanted the ratio of the variances instead, you would multiply
the part inside exp() by 2 first, etc.

--Bobby
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index