Reputation: 111
I have a model and I suspect endogeneity. I want to test whether this is the case with a Wu hausman test, though I can't find anywhere how to do this.
The following regression have been performed:
library(AER)
ivreg1 <-
ivreg(budget~ policyfactor+ control1 + control 2 | IV + control1 + control2, data=df)
df <- data.frame(
budget = c(10, 8, -7, 8, 3, 2, 0.5, 1.5, -2, -15, 30, -0.5, 12, 18),
policyfactor = c(1L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 0L, 1L, 1L),
IV = c(17L,46L,18L,23L,35L,10L,0L,19L,
15L,12L,21L,6L,27L,10L),
control1 = c(29.4,27.4,33.2,27.1,27.4,34.2,
26.8,32.9,26,26.3,27.3,33.4,23.5,31.3),
control2 = c(1.3,20,-0.2,3,3.4,0.3,-1.1,1.9,
-2,-1.6,2.8,1.9,2,1.8)
)
Created on 2020-06-20 by the reprex package (v0.3.0)
Upvotes: 2
Views: 10376
Reputation: 73417
The Hausman test is available in the summary
method using diagnostics=TRUE
option.
summary(ivreg1, diagnostics=TRUE)
# Call:
# AER::ivreg(formula = budget ~ policyfactor + control1 + control2 |
# IV + control1 + control2, data = df)
#
# Residuals:
# Min 1Q Median 3Q Max
# -18.292 -4.920 -1.719 4.057 23.612
#
# Coefficients:
# Estimate Std. Error t value Pr(>|t|)
# (Intercept) 14.4933 31.2550 0.464 0.653
# policyfactor 1.2168 15.1335 0.080 0.938
# control1 -0.3945 0.9835 -0.401 0.697
# control2 0.5168 0.7209 0.717 0.490
#
# Diagnostic tests:
# df1 df2 statistic p-value
# Weak instruments 1 10 2.211 0.168
# Wu-Hausman 1 9 0.944 0.357 <--- THERE IT IS!
# Sargan 0 NA NA NA
#
# Residual standard error: 11.46 on 10 degrees of freedom
# Multiple R-Squared: 0.1545, Adjusted R-squared: -0.09916
# Wald test: 0.381 on 3 and 10 DF, p-value: 0.769
Upvotes: 3