[R] Hausman Test
Ding, Jie Ding (NIH/NIA/ERP) [F]
jieding.ding at nih.gov
Mon Sep 12 23:14:39 CEST 2016
Dear Achim,
Sorry to have disturbed you. I have encountered a problem when computing Hausman test statistics (i.e. p values) in R to compare OLS and 2SLS models.
The problem is a discrepancy between the two p-value outputs from the "manual approach (by hand)" and the " diagnostics argument" in the "AER" library, respectively.
With respect to manual approach, I used the following codes:
cf_diff<-coef(ivreg)-coef(olsreg)
vc_diff<-vcov(ivreg)-vcov(olsreg)
x2_diff<-as.vector(t(cf_diff)%*% solve(vc_diff)%*%cf_diff)
pchisq(x2_diff,df=2,lower.tail=FALSE)
For diagnostic approach, I applied the following:
summary(ivreg, vcov = sandwich, df = Inf, diagnostics = TRUE)
However, p-value from the manual approach is always much larger than the diagnostic approach, e.g. 0.329 vs. 0.138
I would expect the values should be the same. Your advice would be highly appreciated.
With very best wishes,
Jennifer
[[alternative HTML version deleted]]
More information about the R-help
mailing list