Determinants of cigarette demand for the 48 continental US States in 1995 and compared between 1995 and 1985.
data("CigaretteDemand", package = "ivreg")
A data frame with 48 rows and 10 columns.
Number of cigarette packs per capita sold in 1995.
Real price in 1995 (including sales tax).
Real per capita income in 1995.
Sales tax in 1995.
Cigarette-specific taxes (federal and average local excise taxes) in 1995.
Difference in log(packs)
(between 1995 and 1985).
Difference in log(rprice)
(between 1995 and 1985).
Difference in log(rincome)
(between 1995 and 1985).
Difference in salestax
(between 1995 and 1985).
Difference in cigtax
(between 1995 and 1985).
Online complements to Stock and Watson (2007).
The data are taken from the online complements to Stock and Watson (2007) and
had been prepared as panel data (in long form) in CigarettesSW
from the AER package (Kleiber and Zeileis 2008). Here, the data are provided by
state (in wide form), readily preprocessed to contain all variables needed for
illustrations of OLS and IV regressions. More related examples from Stock and
Watson (2007) are provided in the AER package in StockWatson2007
.
A detailed discussion of the various cigarette demand examples with R code
is provided by Hanck et al. (2020, Chapter 12).
Hanck, C., Arnold, M., Gerber, A., and Schmelzer, M. (2020). Introduction to Econometrics with R. https://www.econometrics-with-r.org/
Kleiber, C. and Zeileis, A. (2008). Applied Econometrics with R. Springer-Verlag
Stock, J.H. and Watson, M.W. (2007). Introduction to Econometrics, 2nd ed., Addison Wesley.
## load data
data("CigaretteDemand", package = "ivreg")
## basic price elasticity: OLS vs. IV
cig_ols <- lm(log(packs) ~ log(rprice), data = CigaretteDemand)
cig_iv <- ivreg(log(packs) ~ log(rprice) | salestax, data = CigaretteDemand)
cbind(OLS = coef(cig_ols), IV = coef(cig_iv))
#> OLS IV
#> (Intercept) 10.338924 9.719877
#> log(rprice) -1.213057 -1.083587
## adjusting for income differences (exogenous)
cig_iv2 <- ivreg(log(packs) ~ log(rprice) + log(rincome) | salestax + log(rincome),
data = CigaretteDemand)
## adding a second instrument for log(rprice)
cig_iv3 <- update(cig_iv2, . ~ . | . + cigtax)
## comparison using heteroscedasticity-consistent standard errors
library("lmtest")
#> Loading required package: zoo
#>
#> Attaching package: ‘zoo’
#> The following objects are masked from ‘package:base’:
#>
#> as.Date, as.Date.numeric
library("sandwich")
coeftest(cig_iv2, vcov = vcovHC, type = "HC1")
#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 9.43066 1.25939 7.4883 1.935e-09 ***
#> log(rprice) -1.14338 0.37230 -3.0711 0.003611 **
#> log(rincome) 0.21452 0.31175 0.6881 0.494917
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
coeftest(cig_iv3, vcov = vcovHC, type = "HC1")
#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) 9.89496 0.95922 10.3157 1.947e-13 ***
#> log(rprice) -1.27742 0.24961 -5.1177 6.211e-06 ***
#> log(rincome) 0.28040 0.25389 1.1044 0.2753
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
## long-run price elasticity using differences between 1995 and 1985
cig_ivdiff1 <- ivreg(packsdiff ~ pricediff + incomediff | incomediff + salestaxdiff,
data = CigaretteDemand)
cig_ivdiff2 <- update(cig_ivdiff1, . ~ . | . - salestaxdiff + cigtaxdiff)
cig_ivdiff3 <- update(cig_ivdiff1, . ~ . | . + cigtaxdiff)
coeftest(cig_ivdiff1, vcov = vcovHC, type = "HC1")
#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) -0.117962 0.068217 -1.7292 0.09062 .
#> pricediff -0.938014 0.207502 -4.5205 4.454e-05 ***
#> incomediff 0.525970 0.339494 1.5493 0.12832
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
coeftest(cig_ivdiff2, vcov = vcovHC, type = "HC1")
#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) -0.017049 0.067217 -0.2536 0.8009
#> pricediff -1.342515 0.228661 -5.8712 4.848e-07 ***
#> incomediff 0.428146 0.298718 1.4333 0.1587
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
coeftest(cig_ivdiff3, vcov = vcovHC, type = "HC1")
#>
#> t test of coefficients:
#>
#> Estimate Std. Error t value Pr(>|t|)
#> (Intercept) -0.052003 0.062488 -0.8322 0.4097
#> pricediff -1.202403 0.196943 -6.1053 2.178e-07 ***
#> incomediff 0.462030 0.309341 1.4936 0.1423
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>