y = a + b*x + e

x = α+β̄ *M + ε

M(工具變數12.1) 預測 x

>兩階段TSLS

x再去預測y


香菸消費量有可能透過大幅提高香菸稅來減少。問題是必須提高多少稅才能達到減少一定程度的香菸消費量。經濟學家使用彈性來回答此類問題。由於香菸需求的價格彈性未知,因此必須估計。由於需求與供給之間存在同時因果關係,因此無法使用對數價格的對數數量OLS迴歸來估計感興趣的效應。故使用工具變數的回歸處理。

log(Qcigarettes)=β0+β1log(Pcigarettes)+ui,

log(Qcigarettes)=β0+β1 * log(Pcigarettes)+ui,

CigarettesSW$rprice <- with(CigarettesSW, price / cpi)

CigarettesSW$salestax <- with(CigarettesSW, (taxs – tax) / cpi)

#扣除聯邦、州,賣出香菸本身的稅(不受數量影響)

cor(CigarettesSW$salestax, CigarettesSW$price)

0.6141228,工具變量與x有關。

c1995 <- subset(CigarettesSW, year == “1995”)

log(Pcigarettes)=π0+π1 * SalesTax+νi.

cig_s1 <- lm(log(rprice) ~ salestax, data = c1995)

summary(cig_s1 )

names(cig_s1)

為顯著,x和工具變量有關

R^2 解釋力 0.471

lcigp_pred <- cig_s1$fitted.values

cig_s2 <- lm(log(c1995$packs) ~ lcigp_pred)
coeftest(cig_s2, vcov = vcovHC)

t test of coefficients:

Estimate      Std. Error     t value    Pr(>|t|)
(Intercept)    9.71988          1.70304         5.7074     7.932e-07 ***
lcigp_pred    -1.08359         0.35563       -3.0469      0.003822 **

cig_ivreg <- ivreg(log(packs) ~ log(rprice) | salestax, data = c1995)

coeftest(cig_ivreg, vcov = vcovHC, type = “HC1”)

ivreg()   <工具變量回歸 (~內生變數| 外生/工具變數)

t test of coefficients:

Estimate    Std. Error     t value     Pr(>|t|)
(Intercept)   9.71988       1.52832       6.3598    8.346e-08 ***
log(rprice)   -1.08359     0.31892      -3.3977      0.001411 **

分段2次lm SE會比ivreg大


12.2

增加’所得’外生變數

Yi=β0+β1 * X1i+β2 * X2i+W1i+ui

y ~ x1 + x2 + w1 | w1 + z1 + z2 + z3 where w1 is “instrumenting itself

w1預測 w1 

z1 + z2 + z3  預測 x1 + x2

cig_ivreg2 <- ivreg(log(packs) ~ log(rprice) + log(rincome) | log(rincome) +salestax, data = c1995)

coeftest(cig_ivreg2, vcov = vcovHC, type = “HC1”)

ivreg(y ~ x1 內生 + x2內生 + w1 外生+ w2外生| w1外生 + w2外生 +z1 工具'本身就是外生'+ z2工具 )

cig_ivreg3 <- ivreg(log(packs) ~ log(rprice) + log(rincome) | log(rincome) + salestax + cigtax, data = c1995)

 

 

計量經濟學作業 U12 內生性