# Re: st: RE: fixed, random effects

 From Raphael Schoenle To statalist@hsphsun2.harvard.edu Subject Re: st: RE: fixed, random effects Date Mon, 28 Nov 2005 15:52:09 -0500

great, I am so happy that it runs -

one last thing - I try to store the estimates to run a hausman test (the goal of this exercise) but I get this:

. rfregk invest mvalue [aw = kstock]
Random-effects GLS regression
sd(u_company) = 86.28686 Number of obs = 200
sd(e_company_t) = 120.1563 n = 10
sd(e_company_t + u_company) = 147.9289 T = 20

corr(u_company, X) = 0 (assumed) R-sq within = 0.6344
between = 0.9001
overall = 0.8283

chi2( 1) = 378.90
(theta = 0.7027) Prob > chi2 = 0.0000

------------------------------------------------------------------------ ------
invest | Coef. Std. Err. z P>|z| [95% Conf. Interval]
------------- +----------------------------------------------------------------
mvalue | .2393068 .012294 19.47 0.000 .2152111 .2634026
_cons | -123.7867 37.4564 -3.30 0.001 -197.1999 -50.37351
------------------------------------------------------------------------ ------

. est store RE
r(301);

is there a way to extract the var-cov as well as coefficient matrix for the hausman test?

many thanks,

-Raphael

On Nov 28, 2005, at 11:05 AM, Scott Merryman wrote:

The problem is a few of lines in -rfregk- are wrapped.

if "`weight'"!="" {
by `ivar': replace ``i'' = /*
*/
cond(`dup',sum(`w'[_n-1]*``i''[_n-1])/s
um(`w'[_n-1]),``i'')
}
else {
by `ivar': replace ``i'' = /*
*/
cond(`dup',sum(``i''[_n-1])/(_n-1),``i'
')
}

Either replace the -by `ivar' ...- lines so that the entire statement is on
one line or use /// to connect the lines:

if "`weight'"!="" {
by `ivar': replace ``i'' = ///
cond(`dup',sum(`w'[_n-1]*``i''[_n-1]) ///
/sum(`w'[_n-1]),``i'')
}
else {
by `ivar': replace ``i'' = ///
cond(`dup',sum(``i''[_n-1])/(_n-1),``i'')
}

Save the file, -discard-, and try again.

Scott

```-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
statalist@hsphsun2.harvard.edu] On Behalf Of Raphael Schoenle
Sent: Monday, November 28, 2005 9:33 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: RE: fixed, random effects

Hi Scott,

I just tried to run the example you sent me- does it work on your
computer? (i have stata se/8.2) I get an error message as below.
Thank you very much for the valuable hint!

Best,

Raphael

```
```
*
*   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/
```
```*
*   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/
```