Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: problems with xtrchh


From   "FEIVESON, ALAN H. (AL) (JSC-SD) (NASA)" <[email protected]>
To   "'statalist'" <[email protected]>
Subject   st: problems with xtrchh
Date   Tue, 14 Jan 2003 16:23:35 -0600

Hello - I've tried using -xtrchh- to estimate the parameters of a simple
random slopes model using data that I randomly generated to fit the model.
Despite having 500 clusters and 5 obs/cluster, the results were not very
good. By contrast, MLWIN estimates were right on. Here's the model I used:

   y = (mu + ai) + (be + bi)*xij + eij
   mu, be are constants

   (ai,bi)' ~ N(0,Sig) where SIG=(siga^2, r*siga*sigb \ r*siga*sigb, sigb^2)
    
   eij~N(0,sig^2)
*/


and here's the .do file that generated the data. "zor" just generates a
standard N(0,1) variate.

NS = 500
n = 5
siga=1.0
sigb=0.20
 r = -0.50
sig = 0.5
seed=7777

args NS n siga sigb r sig be seed

local c=`r'*`siga'*`sigb'
scalar sig2a=`siga'^2
scalar sig2b=`sigb'^2
scalar c=`c'
scalar sig2=`sig'^2


cap set seed `seed'
drop _all
set obs `NS'
gen jsub=_n
zor z1
zor z2
gen ai=`siga'*z1
gen bi=`c'*z1/`siga'+sqrt(`sigb'*`sigb'-(`c'/`siga')^2)*z2
expand `n'
sort jsub
zor z3
gen x=10*uniform()
gen y=ai+(`be'+bi)*x+`sig'*z3
exit

Results from xtrchh:
. xtrchh y x

Hildreth-Houck random-coefficients regression   Number of obs      =
2500
Group variable (i) : jsub                       Number of groups   =
500

                                                Obs per group: min =
5
                                                               avg =
5.0
                                                               max =
5

                                                Wald chi2(1)       =
8360.15
                                                Prob > chi2        =
0.0000

----------------------------------------------------------------------------
--
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf.
Interval]
-------------+--------------------------------------------------------------
--
           x |   .9969157   .0109031    91.43   0.000     .9755459
1.018285
       _cons |   .0548312   .0573487     0.96   0.339    -.0575703
.1672327
----------------------------------------------------------------------------
--
Test of parameter constancy:    chi2(998) = 41582.65      Prob > chi2 =
0.0000

Note: The estimates of the fixed parameters are good (should be 1.0 and 0.0)

. matrix SIG=e(Sigma)
. matrix R=corr(SIG)

Here's

symmetric SIG[2,2]
                x       _cons
    x   .05110038
_cons  -.15280976   1.3870031


The covariance matrix SIG with x-component first, should be (0.04, -0.1 \
-0.1, 1.00). For this many clusters (500), the estimate doesn't appear to be
very good. Especially poor on the estimate of siga^2.

On the other hand, here's the results from MLWIN:
->rand
LEV.  PARAMETER       (NCONV)    ESTIMATE    S. ERROR(U)  PREV. ESTIM
CORR.
----------------------------------------------------------------------------
---
 2    cons     /cons     ( 1)       1.006        0.08091        1.004
1
 2    x        /cons     ( 1)    -0.09593        0.01288     -0.09581
-0.476
 2    x        /x        ( 1)     0.04036       0.003127       0.0404
1
----------------------------------------------------------------------------
---
 1    cons     /cons     ( 1)       0.244       0.008859       0.2441 
->fixe

Note the estimates of SIG are very good: (1.006 for 1.000. -0.09593 for
-0.10, 0.04036 for 0.04)


  PARAMETER            ESTIMATE     S. ERROR(U)   PREV. ESTIMATE
cons                    0.04481      0.05079            0.04481 
x                        0.9986     0.009953             0.9986

The estimates of the fixed parmaeters are about as accurate as in xtrchh.


So my question is what's going on?

AL Feiveson
*
*   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