# RE: st: RE: Re: RE: RE: RE: time random effects

 From "ALICE DOBSON" To statalist@hsphsun2.harvard.edu Subject RE: st: RE: Re: RE: RE: RE: time random effects Date Thu, 30 Jun 2005 15:30:50 -0400

```Hi Giovanni,
thanks a lot. That was very enlightening.
Best,
Alice.

```
From: Giovanni Bruno <giovanni.bruno@uni-bocconi.it>
To: statalist@hsphsun2.harvard.edu
Subject: st: RE: Re: RE: RE: RE: time random effects
Date: Thu, 30 Jun 2005 18:57:26 +0200

ALICE DOBSON <alice_dobson@hotmail.com>:

> Hi Giovanni & other statalisters,
> this might not be exactly a stata issue and has already been discussed many
> times. But, it gets more confusing each time. For instance, below you
> explain that xtreg, re estimates a random effect model with cross-section
> heterogeneity?

I guess the confusion is partly due to the terminology, which
seems to be discipline-specific at times.

-xtreg,re- estimates either

1) y(i,t)=Beta*x(i,t)+ u(i) + e(i,t)

or

2) y(i,t)=Beta*x(i,t)+ w(t) + e(i,t)

The above in econometrics are referred to as one-way random effect models.
In both models you have fixed slopes, Beta, and a white-noise
disturbance e(i,t). In model 1) there is also an unobserved individual
specific random effect (intercept) u(i), which by assumption is
not correlated with the regressors x(i,t). In model 2) there is also an
unobserved time specific random effect (intercept) w(t), which by
assumption is not correlated with the regressors x(i,t). A GLS estimator
(or ML assuming normality) is adopted to deal with the particular forms of
correlation induced by the random effects (intercepts) in the two models.

-xtreg,re- cannot estimate what is known (in econometrics) as the two-way
random-effect model:

y(i,t)=Beta*x(i,t)+ u(i) + w(t)+ e(i,t).

This can be done by -xtmixed- as explained in my previous post.

Fixed effect models basically have the same structure as the
random effect models with the important difference that the
correlation between x(i,t) and u(i) and w(t) is left unrestricted.
Estimation is simpler in this case, and the same estimator can
be implemented in a number of different ways. E.g. you obtain
the same two-way fixed effect estimator via, say,

. regress y x time_dummies ind_dummies

or

. xtreg y x time_dummies, fe i(ind)

or

. xtreg y x ind_dummies, fe i(time)

In all foregoing models slopes are fixed across individuals
and over time. I guess -xtmixed- can allow you more flexibility
on this, but have a look at the manuals, which I find
a very good source.

I would also suggest [GREENE, W.H. (2003) Econometric Analysis,
Upper Saddle River: Prentice-Hall] and for a more advanced,
up-to-date reference [Baltagi (2005), Econometric Analysis of Panel
Data, New York: Wiley & Sons.]

I hope this clarifies things a little
Giovanni

> >From: Giovanni Bruno <giovanni.bruno@uni-bocconi.it>
> >To: statalist@hsphsun2.harvard.edu
> >Subject: st: Re: RE: RE: RE: time random effects
> >Date: Thu, 23 Jun 2005 16:24:31 +0200
> >
> >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 <zhaowl@temple.edu>:
> >
> > > Thank you, Scott. Without disrespect, I am still a little bit unsure
> > > 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: owner-statalist@hsphsun2.harvard.edu
> > > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Scott
> >Merryman
> > > Sent: Wednesday, June 22, 2005 8:38 PM
> > > To: statalist@hsphsun2.harvard.edu
> > > 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> > > > statalist@hsphsun2.harvard.edu] On Behalf Of Wanli Zhao
> > > > Sent: Wednesday, June 22, 2005 3:52 PM
> > > > To: statalist@hsphsun2.harvard.edu
> > > > 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/
>
> _________________________________________________________________
> Don’t just search. Find. Check out the new MSN Search!
> http://search.msn.click-url.com/go/onm00200636ave/direct/01/
>
> *
> * 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 S.F. Bruno
http://ideas.repec.org/e/pbr136.html
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/
_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/

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