我有两个密切相关的问题: 似乎ivreg和tsls / gmm产生了不同的参数估计值:
require(AER)
data("CigarettesSW", package = "AER")
CigarettesSW$rprice <- with(CigarettesSW, price/cpi)
CigarettesSW$rincome <- with(CigarettesSW, income/population/cpi)
CigarettesSW$tdiff <- with(CigarettesSW, (taxs - tax)/cpi)
## model
ivreg1 <- ivreg(log(packs) ~ log(rprice) + log(rincome)
| 1+ log(rincome) + tdiff + I(tax/cpi),
data = CigarettesSW)
require(gmm)
tsls1 <- tsls(log(packs) ~ log(rprice) + log(rincome),
~ 1+ log(rincome) + tdiff + I(tax/cpi),
data = CigarettesSW)
gmm1 <- gmm(log(packs) ~ log(rprice) + log(rincome),
~ 1+ log(rincome) + tdiff + I(tax/cpi),
data = CigarettesSW,vcov="iid", method="2step")
xHat <- lm(log(rprice) ~ log(rincome)+ tdiff + I(tax/cpi),
data = CigarettesSW)$fitted.values
manual2sls = lm(log(packs) ~ xHat + log(rincome) , data = CigarettesSW)
print("iid:")
print(summary(manual2sls)$coef[,1])
print(summary(ivreg1)$coef[,1:2])
print(summary(tsls1)$coef[,1:2])
print(summary(gmm1)$coef[,1:2])
ivreg和“手动”2阶段LS估计产生相同的参数估计(“ivreg1”和“manual2sls”), 但是tsls和gmm程序导致不同的结果(“tsls1”和“gmm1”)。为什么会这样? 你怎么能确保相同的结果?
您可以使用vcovHAC函数计算ivos和/或2sls / gmm的异方差和自相关一致标准误差吗?为什么在gmm内或之后使用HAC的估计标准误差存在差异?
gmmhac <- gmm(log(packs) ~ log(rprice) + log(rincome),
~ 1+ log(rincome) + tdiff + I(tax/cpi),
data = CigarettesSW,vcov="HAC", method="2step")
print("HAC:")
print(coeftest(ivreg1, vcovHAC(ivreg1))[,1:2])
print(coeftest(tsls1, vcovHAC(tsls1))[,1:2])
try(print(print(coeftest(gmm1, vcovHAC(gmm1))[,1:2])))
print(coeftest(gmmhac)[,1:2])
非常感谢提前。