Hausman specification test, "hausman", for panel data regression models FE vs RE produces a value of Chi-sq. statistic that is essentially different from that calculated directly using coefficient vectors e(b) and variance-covariance matrices e(V). (The values of chi-2 calculated directly here are the same to those calculated in R both directly and using "phtest" from "plm" ). The data are from https://research.stlouisfed.org/publ...t-cold-war-era . Stata 17 MP
The code is:
Results:
What might be a matter of such difference? Thanks.
The code is:
Code:
xtset countryid year xtreg raid gdpcap gdpcap2 infmort infmort2 rights goveff popmil pop2 y2 y3, fe est store fem matrix b=e(b) matrix Vb=e(V) xtreg raid gdpcap gdpcap2 infmort infmort2 rights goveff popmil pop2 y2 y3, re est store rem matrix B=e(b) matrix VB=e(V) *** Hausman test hausman fem rem hausman fem rem, sigmaless *** Manual calculations of Housman test Chi-sq matrix b_B= (b-B)' matrix Vdiff=Vb-VB ***constant term remove matrix b_B=b_B[1..10, 1] matrix Vdiff=Vdiff[1..10, 1..10] ***Chi-sq-calc matrix chi=b_B'*syminv(Vdiff)*b_B matrix list chi
Code:
Test of H0: Difference in coefficients not systematic
chi2(10) = (b-B)'[(V_b-V_B)^(-1)](b-B)
= 10.73
Prob > chi2 = 0.3790
. *** Manual calculations of Housman test Chi-sq
. matrix b_B= (b-B)'
. matrix Vdiff=Vb-VB
. ***constant term remove
. matrix b_B=b_B[1..10, 1]
. matrix Vdiff=Vdiff[1..10, 1..10]
. ***Chi-sq-calc
. matrix chi=b_B'*syminv(Vdiff)*b_B
. matrix list chi
symmetric chi[1,1]
y1
y1 23.531672

Comment