2
$\begingroup$

I am running a panel data estimation, where I am including year effects. My goal is to see if there is a time trend in the data, after controlling for other factors.

Using random effects, I find the trend is upward sloping. Using fixed effects, I find the trend is downward sloping.

Is this a bad result? A Hausman test rejects the RE with p-value of 0.000. Does it mean that the trend values from the RE can be inconsistent? Or is the FE capturing something different than the RE model? Differences in differences perhaps?

$\endgroup$
1
$\begingroup$

This is an interesting result, not a bad result. If there are no regressors other than time dummies, then I think OLS = RE = FE. (I've done a few experiments with reg y i.year, xtreg y i.year, fe, and xtreg y i.year, re, but I have not proved.)

If $X_{it}$ have trends and are correlated with fixed effects, anything can happen. For example, run the following Stata script (copy & paste):

set more off
clear all
local n 100
local T 5
set seed 1
set obs `=`n'*`T''
gen id = floor((_n-1)/`T')+1
by id, sort: gen year = _n
xtset id year
tempvar a0
gen `a0' = rnormal() if year==1
by id: egen a = mean(`a0')
gen x = a-year+rnormal()
gen y = a+x-0.2*year+rnormal()
drop a
* So far x and y have been generated.
xtreg y x year, fe
est store fe
xtreg y x year, re
hausman fe ., sigma
set more on

You will see that FE gives a negative trend, RE gives a positive trend, and the Hausman test is very significant. (Above I included a linear trend for simplicity. The results are similar when i.year is used instead.) I think it is trends in X and the presence of fixed effects.

. set more off

. clear all

. local n 100

. local T 5

. set seed 1

. set obs `=`n'*`T''
number of observations (_N) was 0, now 500

. gen id = floor((_n-1)/`T')+1

. by id, sort: gen year = _n

. xtset id year
       panel variable:  id (strongly balanced)
        time variable:  year, 1 to 5
                delta:  1 unit

. tempvar a0

. gen `a0' = rnormal() if year==1
(400 missing values generated)

. by id: egen a = mean(`a0')

. gen x = a-year+rnormal()

. gen y = a+x-0.2*year+rnormal()

. drop a

. * So far x and y have been generated.

. xtreg y x year, fe

Fixed-effects (within) regression               Number of obs     =        500
Group variable: id                              Number of groups  =        100

R-sq:                                           Obs per group:
     within  = 0.8276                                         min =          5
     between = 0.9353                                         avg =        5.0
     overall = 0.8066                                         max =          5

                                                F(2,398)          =     955.57
corr(u_i, Xb)  = 0.4473                         Prob > F          =     0.0000

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |   .9803594   .0483021    20.30   0.000     .8854004    1.075318
        year |  -.2207004   .0568937    -3.88   0.000    -.3325502   -.1088506
       _cons |   .1019471   .1021303     1.00   0.319    -.0988351    .3027294
-------------+----------------------------------------------------------------
     sigma_u |  1.1387103
     sigma_e |  .97339535
         rho |  .57779363   (fraction of variance due to u_i)
------------------------------------------------------------------------------
F test that all u_i=0: F(99, 398) = 3.61                     Prob > F = 0.0000

. est store fe

. xtreg y x year, re

Random-effects GLS regression                   Number of obs     =        500
Group variable: id                              Number of groups  =        100

R-sq:                                           Obs per group:
     within  = 0.8066                                         min =          5
     between = 0.9353                                         avg =        5.0
     overall = 0.8436                                         max =          5

                                                Wald chi2(2)      =    2432.08
corr(u_i, X)   = 0 (assumed)                    Prob > chi2       =     0.0000

------------------------------------------------------------------------------
           y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
           x |    1.40149   .0391177    35.83   0.000      1.32482    1.478159
        year |    .196468   .0523296     3.75   0.000     .0939039     .299032
       _cons |   .1267828    .123712     1.02   0.305    -.1156882    .3692539
-------------+----------------------------------------------------------------
     sigma_u |   .3602397
     sigma_e |  .97339535
         rho |  .12046423   (fraction of variance due to u_i)
------------------------------------------------------------------------------

. hausman fe ., sigma

Note: the rank of the differenced variance matrix (1) does not equal the number
        of coefficients being tested (2); be sure this is what you expect, or
        there may be problems computing the test.  Examine the output of your
        estimators for anything unexpected and possibly consider scaling your
        variables so that the coefficients are on a similar scale.

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |       fe           .          Difference          S.E.
-------------+----------------------------------------------------------------
           x |    .9803594      1.40149       -.4211302        .0389278
        year |   -.2207004      .196468       -.4171684        .0385616
------------------------------------------------------------------------------
                           b = consistent under Ho and Ha; obtained from xtreg
            B = inconsistent under Ha, efficient under Ho; obtained from xtreg

    Test:  Ho:  difference in coefficients not systematic

                  chi2(1) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =      117.03
                Prob>chi2 =      0.0000

. set more on
$\endgroup$
0
$\begingroup$

So if you see major differences between random effects and fixed effects, that alone should be an indicator that the time-invariant variation that FE controls for matters. Your Hausman confirms it.

FE does capture something different because FE removes all time-invariant variation and only uses the within variation, while random effects uses both within and between, so it is actually capturing different variation. For example, if you attempted to estimate the effect of gender on wages over time, you could not do this using fixed effects because gender would drop out, but you could do this using random effects.

$\endgroup$
  • $\begingroup$ Reg. point 1, I want to explicitly see the evolution over time. And evidence in both cases is that years are heterogeneous, so using a restrictive variable is not good. Reg. point 2, I don't really get your point. Why are between-effects uncorrelated with the idiosyncratic error? Well, I test and argue that there is no endogeneity wrt the id. error. Is that enough? $\endgroup$ – luchonacho Aug 19 '16 at 15:23
  • $\begingroup$ My point with 2 is that if you see large differences between RE and FE, it is better to trust FE as it actually controls for the potential bias while RE assumes it is orthogonal. The Hausman test is not that great because it's statistically difficult to test for endogeneity. $\endgroup$ – VCG Aug 19 '16 at 15:27
  • $\begingroup$ I don't see why an inconsistent RE makes Hausman invalid. The whole point of Hausman is to test the consistency of RE. It is like rejecting the null makes the test invalid. That does not make sense to me. But yes, I am trusting more the FE. I just wander why such radical difference between time trends. $\endgroup$ – luchonacho Aug 19 '16 at 15:57
  • $\begingroup$ Ya I removed what I said I got confused. I spent a little time reading and now reposted. $\endgroup$ – VCG Aug 19 '16 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.