Last data update: 2014.03.03

R: Methods for Instrumental-Variable Regression
summary.ivregR Documentation

Methods for Instrumental-Variable Regression

Description

Methods to standard generics for instrumental-variable regressions fitted by ivreg.

Usage

## S3 method for class 'ivreg'
summary(object, vcov. = NULL, df = NULL, diagnostics = FALSE, ...)
## S3 method for class 'ivreg'
anova(object, object2, test = "F", vcov = NULL, ...)

## S3 method for class 'ivreg'
terms(x, component = c("regressors", "instruments"), ...)
## S3 method for class 'ivreg'
model.matrix(object, component = c("projected", "regressors", "instruments"), ...)

Arguments

object, object2, x

an object of class "ivreg" as fitted by ivreg.

vcov., vcov

a specification of the covariance matrix of the estimated coefficients. This can be specified as a matrix or as a function yielding a matrix when applied to the fitted model. If it is a function it is also employed in the two diagnostic F tests (if diagnostics = TRUE in the summary() method).

df

the degrees of freedom to be used. By default this is set to residual degrees of freedom for which a t or F test is computed. Alternatively, it can be set to Inf (or equivalently 0) for which a z or Chi-squared test is computed.

diagnostics

logical. Should diagnostic tests for the instrumental-variable regression be carried out? These encompass an F test of the first stage regression for weak instruments, a Wu-Hausman test for endogeneity, and a Sargan test of overidentifying restrictions (only if there are more instruments than regressors).

test

character specifying whether to compute the large sample Chi-squared statistic (with asymptotic Chi-squared distribution) or the finite sample F statistic (with approximate F distribution).

component

character specifying for which component of the terms or model matrix should be extracted. "projected" gives the matrix of regressors projected on the image of the instruments.

...

currently not used.

Details

ivreg is the high-level interface to the work-horse function ivreg.fit, a set of standard methods (including summary, vcov, anova, hatvalues, predict, terms, model.matrix, bread, estfun) is available.

See Also

ivreg, lm.fit

Examples

## data
data("CigarettesSW")
CigarettesSW$rprice <- with(CigarettesSW, price/cpi)
CigarettesSW$rincome <- with(CigarettesSW, income/population/cpi)
CigarettesSW$tdiff <- with(CigarettesSW, (taxs - tax)/cpi)

## model 
fm <- ivreg(log(packs) ~ log(rprice) + log(rincome) | log(rincome) + tdiff + I(tax/cpi),
  data = CigarettesSW, subset = year == "1995")
summary(fm)
summary(fm, vcov = sandwich, df = Inf, diagnostics = TRUE)

## ANOVA
fm2 <- ivreg(log(packs) ~ log(rprice) | tdiff, data = CigarettesSW, subset = year == "1995")
anova(fm, fm2, vcov = sandwich, test = "Chisq")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(AER)
Loading required package: car
Loading required package: lmtest
Loading required package: zoo

Attaching package: 'zoo'

The following objects are masked from 'package:base':

    as.Date, as.Date.numeric

Loading required package: sandwich
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/AER/summary.ivreg.Rd_%03d_medium.png", width=480, height=480)
> ### Name: summary.ivreg
> ### Title: Methods for Instrumental-Variable Regression
> ### Aliases: summary.ivreg print.summary.ivreg vcov.ivreg bread.ivreg
> ###   estfun.ivreg anova.ivreg hatvalues.ivreg predict.ivreg terms.ivreg
> ###   model.matrix.ivreg
> ### Keywords: regression
> 
> ### ** Examples
> 
> ## data
> data("CigarettesSW")
> CigarettesSW$rprice <- with(CigarettesSW, price/cpi)
> CigarettesSW$rincome <- with(CigarettesSW, income/population/cpi)
> CigarettesSW$tdiff <- with(CigarettesSW, (taxs - tax)/cpi)
> 
> ## model 
> fm <- ivreg(log(packs) ~ log(rprice) + log(rincome) | log(rincome) + tdiff + I(tax/cpi),
+   data = CigarettesSW, subset = year == "1995")
> summary(fm)

Call:
ivreg(formula = log(packs) ~ log(rprice) + log(rincome) | log(rincome) + 
    tdiff + I(tax/cpi), data = CigarettesSW, subset = year == 
    "1995")

Residuals:
       Min         1Q     Median         3Q        Max 
-0.6006931 -0.0862222 -0.0009999  0.1164699  0.3734227 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept)    9.8950     1.0586   9.348 4.12e-12 ***
log(rprice)   -1.2774     0.2632  -4.853 1.50e-05 ***
log(rincome)   0.2804     0.2386   1.175    0.246    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.1879 on 45 degrees of freedom
Multiple R-Squared: 0.4294,	Adjusted R-squared: 0.4041 
Wald test: 13.28 on 2 and 45 DF,  p-value: 2.931e-05 

> summary(fm, vcov = sandwich, df = Inf, diagnostics = TRUE)

Call:
ivreg(formula = log(packs) ~ log(rprice) + log(rincome) | log(rincome) + 
    tdiff + I(tax/cpi), data = CigarettesSW, subset = year == 
    "1995")

Residuals:
       Min         1Q     Median         3Q        Max 
-0.6006931 -0.0862222 -0.0009999  0.1164699  0.3734227 

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
(Intercept)    9.8950     0.9288  10.654  < 2e-16 ***
log(rprice)   -1.2774     0.2417  -5.286 1.25e-07 ***
log(rincome)   0.2804     0.2458   1.141    0.254    

Diagnostic tests:
                 df1 df2 statistic p-value    
Weak instruments   2  44   228.738  <2e-16 ***
Wu-Hausman         1  44     3.823  0.0569 .  
Sargan             1  NA     0.333  0.5641    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.1879 on Inf degrees of freedom
Multiple R-Squared: 0.4294,	Adjusted R-squared: 0.4041 
Wald test: 34.51 on 2 DF,  p-value: 3.214e-08 

> 
> ## ANOVA
> fm2 <- ivreg(log(packs) ~ log(rprice) | tdiff, data = CigarettesSW, subset = year == "1995")
> anova(fm, fm2, vcov = sandwich, test = "Chisq")
Wald test

Model 1: log(packs) ~ log(rprice) + log(rincome) | log(rincome) + tdiff + 
    I(tax/cpi)
Model 2: log(packs) ~ log(rprice) | tdiff
  Res.Df Df  Chisq Pr(>Chisq)
1     45                     
2     46 -1 1.3011      0.254
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>