Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: st: AW: Question on xtreg and the FE option

From   Christopher Baum <>
To   "" <>
Subject   Re: Re: st: AW: Question on xtreg and the FE option
Date   Fri, 9 Nov 2012 11:52:47 +0000

On Nov 9, 2012, at 2:33 AM, Justina wrote:

> it depends also on the Staa version you use
> In my case -xtreg- requires -xtset-, and -xtset- requires both unit and time to be set

These assertions about -xtreg- are false and misleading. -xtset- is a more recent addition to Stata, and if you look at the code, all it does 
is call -tsset-!  You never have to use -xtset-, as -tsset- will achieve the same goal. In the days of the printed manuals, it was viewed as a disadvantage that -tsset- was in [TS], and -xtreg- in [XT], and someone might not own both manuals: hence -xtset-, which lives in the [XT] manual. These days that is quite irrelevant, as all users have the complete doc set. 

But -xtreg-, and a number of other xt-commands, have ALWAYS allowed the specification 'on the fly' of the panel dimension with i(),
where the other dimension can be viewed as hierarchically nested (i.e. people within families, firms within industries, repeated measures data on hospital patients with no evenly spaced timing, etc.)  Indeed, Stata had an -xtset- command (which was why a colleague of mine first introduced me to Stata: version 5 or 6!) long before it had any notion of time series data, time series calendar, -tis-, -tsset-, etc.

We normally consider xt-data to refer to i and t, with t a proper time series, but Stata emphatically does NOT require that to be the case. For instance, using auto:

. xtreg price mpg weight turn, fe i(rep78)

Fixed-effects (within) regression               Number of obs      =        69
Group variable: rep78                           Number of groups   =         5

R-sq:  within  = 0.4125                         Obs per group: min =         2
       between = 0.0228                                        avg =      13.8
       overall = 0.3756                                        max =        30

                                                F(3,61)            =     14.27
corr(u_i, Xb)  = -0.3480                        Prob > F           =    0.0000

       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
         mpg |  -86.24749   84.98694    -1.01   0.314    -256.1894    83.69441
      weight |    3.39851   .8279604     4.10   0.000     1.742901     5.05412
        turn |  -321.7209   136.6736    -2.35   0.022    -595.0167   -48.42515
       _cons |   10481.42     5252.1     2.00   0.050    -20.80438    20983.64
     sigma_u |  1014.0163
     sigma_e |   2339.882
         rho |  .15810936   (fraction of variance due to u_i)
F test that all u_i=0:     F(4, 61) =     1.04               Prob > F = 0.3961

The Statalist FAQ exhorts those posting to RTFM first, for good reason.


Kit Baum   |   Boston College Economics & DIW Berlin   |
                             An Introduction to Stata Programming  |
  An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index