Learn R Programming

AER (version 0.2-2)

ivreg: Instrumental-Variable Regression

Description

Fit instrumental-variable regression by two-stage least squares. This is equivalent to direct instrumental-variables estimation when the number of instruments is equal to the number of predictors.

Usage

ivreg(formula, instruments, data, subset, na.action, weights, offset,
  contrasts = NULL, model = TRUE, y = TRUE, x = FALSE, ...)

Arguments

formula, instruments
formula specification(s) of the regression relationship and the instruments. Either instruments is missing and formula has three parts as in y ~ x1 + x2 | z1 + z2 + z3 (recommended) or formula
data
an optional data frame containing the variables in the model. By default the variables are taken from the environment from which ivreg is called.
subset
an optional vector specifying a subset of observations to be used in fitting the model.
na.action
a function that indicates what should happen when the data contain NAs. The default is set by the na.action option.
weights
an optional vector of weights to be used in the fitting process.
offset
an optional offset that can be used to specify an a priori known component to be included during fitting.
contrasts
an optional list. See the contrasts.arg of model.matrix.default.
model, x, y
logicals. If TRUE the corresponding components of the fit (the model frame, the model matrices , the response) are returned.
...
further arguments passed to ivreg.fit.

Value

  • ivreg returns an object of class "ivreg", with the following components:
  • coefficientsparameter estimates.
  • residualsa vector of residuals.
  • fitted.valuesa vector of predicted means.
  • weightseither the vector of weights used (if any) or NULL (if none).
  • offseteither the offset used (if any) or NULL (if none).
  • nnumber of observations.
  • rankthe numeric rank of the fitted linear model.
  • df.residualresidual degrees of freedom for fitted model.
  • cov.unscaledunscaled covariance matrix for the coefficients.
  • sigmaresidual standard error.
  • hatvaluesregression hat values.
  • callthe original function call.
  • formulathe model formula.
  • termsa list with elements "regressors" and "instruments" containing the terms objects for the respective components.
  • levelslevels of the categorical regressors.
  • contraststhe contrasts used for categorical regressors.
  • modelthe full model frame (if model = TRUE).
  • ythe response vector (if y = TRUE).
  • xa list with elements "regressors", "instruments", "projected", containing the model matrices from the respective components (if x = TRUE). "projected" is the matrix of regressors projected on the image of the instruments.

Details

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

References

Greene, W. H. (1993) Econometric Analysis, 2nd ed., Macmillan.

See Also

ivreg.fit, lm, lm.fit

Examples

Run this code
## 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)

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

Run the code above in your browser using DataLab