As Scott Merryman clearly suggested, -xtreg- can only estimate one-way
*random* effect models, with either time or cross-section heterogeneity.
-xtmixed-, however, can easily estimate the two-way random effect
panel data model.
As explained in [Baltagi (2005), Econometric analysis of panel data, ch. 3]
there are various ways to estimate the two-way random effect model in
econometrics. Using the Grunfeld's data set
<http://www.wiley.com/legacy/wileychi/baltagi3e/data_sets.html>
the following -xtmixed- instruction produces estimates for parameters and
standard deviations that are identical to those reported in Baltagi's (2005)
Table 3.1 under the IMLE (iterated maximum likelihood estimator) method,
implemented by Baltagi using TSP (FN=firm index; YR=time index; I=investments;
F=value of the firm; K=capital stock):
. xtmixed I F K || _all: R.FN || _all: R.YR,mle
Performing EM optimization:
Performing gradient-based optimization:
Iteration 0: log likelihood = -1095.3809
Iteration 1: log likelihood = -1095.2502
Iteration 2: log likelihood = -1095.2485
Iteration 3: log likelihood = -1095.2485
Computing standard errors:
Mixed-effects ML regression Number of obs = 200
Group variable: _all Number of groups = 1
Obs per group: min = 200
avg = 200.0
max = 200
Wald chi2(2) = 661.07
Log likelihood = -1095.2485 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
I | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
F | .1099009 .0103779 10.59 0.000 .0895606 .1302413
K | .3092262 .0172179 17.96 0.000 .2754798 .3429726
_cons | -58.27126 27.76275 -2.10 0.036 -112.6853 -3.857264
------------------------------------------------------------------------------
------------------------------------------------------------------------------
Random-effects Parameters | Estimate Std. Err. [95% Conf. Interval]
-----------------------------+------------------------------------------------
_all: Identity |
sd(R.FN) | 80.41164 18.42471 51.3196 125.9954
-----------------------------+------------------------------------------------
_all: Identity |
sd(R.YR) | 3.860627 15.29474 .0016384 9096.692
-----------------------------+------------------------------------------------
sd(Residual) | 52.34756 2.904361 46.9537 58.36104
------------------------------------------------------------------------------
LR test vs. linear regression: chi2(2) = 193.11 Prob > chi2 = 0.0000
Note: LR test is conservative and provided only for reference
Giovanni
Scrive Wanli Zhao <[email protected]>:
> Thank you, Scott. Without disrespect, I am still a little bit unsure about
> this. Several small points raise my concern. On the -help xtreg- page in
> Stata, on the bottom are some command examples and none of them show time
> random effects explicitly. Also, on the -findit xtreg- page, there is an
> example for chapter 14 of Greene's book. I checked it, the original text
> book chapter has two way effects in the table. On the Stata webpage for
> this, seems that it stops on the time random effects part. In addition,
> seems that when you do not specify i() in xtreg (but you specify panel tis
> beforehand) and estimate random effects, it means only the cross-section
> random effects, not both. I hope you could enlighten me. Just say you tried
> this before. :-)
>
> Wanli
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Scott Merryman
> Sent: Wednesday, June 22, 2005 8:38 PM
> To: [email protected]
> Subject: st: RE: RE: time random effects
>
> If you want random time effects without cross section effects you can use
> -xtreg-. Simply specify the "i(varname)" option with the time variable
> (i.e. -xtreg depvar indepvar, i(time)-)
>
> For two-way random effects take a look at -xtmixed- or -gllamm-
>
> Scott
>
>
> > -----Original Message-----
> > From: [email protected] [mailto:owner-
> > [email protected]] On Behalf Of Wanli Zhao
> > Sent: Wednesday, June 22, 2005 3:52 PM
> > To: [email protected]
> > Subject: st: RE: time random effects
> >
> > I asked the same question before and stared at the list every day and
> > got no reply. I did some homework and found people say that Stata can
> > do the two-way effects panel model (error component model by another
> > name). I still cannot figure out how to do it in Stata. Adding time
> > dummies to do fixed effects is simple (with/without cross-section
> > effects). But how to do time random effects, with/without
> > cross-section effects? In the literature and text books, error
> > component model with time variation and cross-section variation is
> > just there. If you know how to do it in Stat, pls help.
> > Thanks
> > a lot.
> >
> > Wanli Zhao
> > Using Stata 9
> >
> >
> > *
> > * 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/
>
>
> *
> * 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/
>
--
Giovanni Bruno
Istituto di Economia Politica, Universit� Bocconi
Via U. Gobbi, 5, 20136 Milano
Italy
tel. + 02 5836 5411
fax. + 02 5836 5438
*
* 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/