gpt4 book ai didi

r - Wu Hausman 检验来检验内生性

转载 作者:行者123 更新时间:2023-12-04 09:37:39 24 4
gpt4 key购买 nike

我有一个模型,我怀疑内生性。我想通过 Wu hausman 测试来测试是否是这种情况,尽管我找不到任何方法来执行此操作。
已执行以下回归:

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)
)
创建于 2020-06-20 由 reprex package (v0.3.0)

最佳答案

Hausman 检验在 summary 中可用使用方法 diagnostics=TRUE选项。

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

关于r - Wu Hausman 检验来检验内生性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62485993/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com