Paneldata
隨機效應和固定效應之間的年份效應不一致
我正在執行面板數據估計,其中包括年份影響。我的目標是在控制其他因素後查看數據是否存在時間趨勢。
使用隨機效應,我發現趨勢是向上傾斜的。使用固定效應,我發現趨勢是向下傾斜的。
這是一個糟糕的結果嗎?Hausman 檢驗拒絕 p 值為 0.000 的 RE。這是否意味著來自 RE 的趨勢值可能不一致?**還是 FE 捕捉到的東西與 RE 模型不同?**差異中的差異?
這是一個有趣的結果,而不是一個糟糕的結果。如果除了時間虛擬變數之外沒有回歸變數,那麼我認為 OLS = RE = FE。(我用
reg y i.year
、xtreg y i.year, fe
和做了一些實驗xtreg y i.year, re
,但我沒有證明。)如果 $ X_{it} $ 有趨勢並與固定效應相關,任何事情都可能發生。例如,執行以下 Stata 腳本(複製和粘貼):
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
您會看到 FE 給出了負趨勢,RE 給出了正趨勢,並且 Hausman 檢驗非常顯著。(為了簡單起見,上面我包括了一個線性趨勢。當
i.year
使用它時,結果是相似的。)我認為這是 X 的趨勢和固定效應的存在。. 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
因此,如果您看到隨機效應和固定效應之間的主要差異,僅此一項就應該表明 FE 控制的時間不變變化很重要。你的豪斯曼證實了這一點。
FE 確實捕捉到了一些不同的東西,因為 FE 去除了所有時不變的變化並且只使用了組內變化,而隨機效應同時使用了組內和組間,所以它實際上是在捕捉不同的變化。例如,如果您嘗試估計性別隨時間推移對工資的影響,您不能使用固定效應來做到這一點,因為性別會退出,但您可以使用隨機效應來做到這一點。