ivmodel
fits an instrumental variables (IV) model with one endogenous variable and a continuous outcome. It carries out several IV regressions, diagnostics, and tests associated this IV model. It is robust to most data formats, including factor and character data, and can handle very large IV models efficiently.
ivmodel(Y, D, Z, X, intercept = TRUE,
beta0 = 0, alpha = 0.05, k = c(0, 1),
manyweakSE = FALSE, heteroSE = FALSE, clusterID = NULL,
deltarange = NULL, na.action = na.omit)
ivmodel
returns an object of class "ivmodel".
An object class "ivmodel" is a list containing the following components
Sample size.
Number of instruments.
Number of exogenous covariates (including intercept).
Outcome, cleaned for use in future methods.
Treatment, cleaned for use in future methods.
Instrument(s), cleaned for use in future methods.
Exogenous covariates (if provided), cleaned for use in future methods.
Adjusted outcome, projecting out X.
Adjusted treatment, projecting out X.
Adjusted instrument(s), projecting out X.
QR decomposition for adjusted instrument(s).
QR decomposition for concatenated matrix of Z and X.
Significance level for the hypothesis tests.
Null value of the hypothesis tests.
A list from KClass
function.
A list from LIML
function.
A list from Fuller
function.
A list from AR.test
.
A list from CLR
.
In addition, if there is only one instrument, ivreg
will generate an "ARsens" list within "ivmodel" object.
A numeric vector of outcomes.
A vector of endogenous variables.
A matrix or data frame of instruments.
A matrix or data frame of (exogenous) covariates.
Should the intercept be included? Default is TRUE and if so, you do not need to add a column of 1s in X.
Null value \(\beta_0\) for testing null hypothesis \(H_0: \beta = \beta_0\) in ivmodel
. Default is $0$.
The significance level for hypothesis testing. Default is 0.05.
A numeric vector of k values for k-class estimation. Default is 0 (OLS) and 1 (TSLS).
Should many weak instrument (and heteroscedastic-robust) asymptotics in Hansen, Hausman and Newey (2008) be used to compute standard errors? (Not supported for k ==0)
Should heteroscedastic-robust standard errors be used? Default is FALSE.
If cluster-robust standard errors are desired, provide a vector of length that's identical to the sample size. For example, if n = 6 and clusterID = c(1,1,1,2,2,2), there would be two clusters where the first cluster is formed by the first three observations and the second cluster is formed by the last three observations. clusterID can be numeric, character, or factor.
Range of \(\delta\) for sensitivity analysis with the Anderson-Rubin (1949) test.
NA handling. There are na.fail
, na.omit
, na.exclude
, na.pass
available. Default is na.omit.
Yang Jiang, Hyunseung Kang, and Dylan Small
Let \(Y\), \(D\), \(X\), and \(Z\) represent the outcome, endogenous variable, p dimensional exogenous covariates, and L dimensional instruments, respectively. Note that the intercept is a type of exogenous covariate and can be added to \(X\) by specifying intercept
as TRUE (the default behavior); the user does not have to manually add an intercept column in \(X\). ivmodel
assumes the following IV model
$$ Y = X \alpha + D \beta + \epsilon, E(\epsilon | X, Z) = 0$$
and produces statistics for \(\beta\). In particular, ivmodel
computes the OLS, TSLS, k-class, limited information maximum likelihood (LIML), and Fuller-k (Fuller 1977) estimates of \(\beta\) using KClass
, LIML
, and codeFuller. Also, ivmodel
computes confidence intervals and hypothesis tests of the type \(H_0: \beta = \beta_0\) versus \(H_0: \beta \neq \beta_0\) for the said estimators as well as two weak-IV confidence intervals, Anderson and Rubin (Anderson and Rubin 1949) confidence interval (Anderson and Rubin 1949) and the conditional likelihood ratio confidence interval (Moreira 2003). Finally, the code also conducts a sensitivity analysis if \(Z\) is one-dimensional (i.e. there is only one instrument) using the method in Jiang et al. (2015).
Some procedures (e.g. conditional likelihood ratio test, sensitivity analysis with Anderson-Rubin) assume an additional linear model $$D = Z \gamma + X \kappa + \xi, E(\xi | X, Z) = 0$$
Anderson, T. W. and Rubin, H. (1949). Estimation of the parameters of a single equation in a complete system of stochastic equations. Annals of Mathematical Statistics 20, 46-63.
Freeman G., Cowling B. J., Schooling C. M. (2013). Power and Sample Size Calculations for Mendelian Randomization Studies Using One Genetic Instrument. International Journal of Epidemiology 42(4), 1157-1163.
Fuller, W. (1977). Some properties of a modification of the limited information estimator. Econometrica, 45, 939-953.
Hansen, C., Hausman, J., and Newey, W. (2008) Estimation with many instrumental variables. Journal of Business and Economic Statistics 26(4), 398-422.
Moreira, M. J. (2003). A conditional likelihood ratio test for structural models. Econometrica 71, 1027-1048.
Sargan, J. D. (1958). The estimation of economic relationships using instrumental variables. Econometrica , 393-415.
Wang, X., Jiang, Y., Small, D. and Zhang, N. (2017), Sensitivity analysis and power for instrumental variable studies. Biometrics 74(4), 1150-1160.
See also KClass
, LIML
, Fuller
, AR.test
, and CLR
for individual methods associated with ivmodel
. For extracting the estimated effect of the exogenous covariates on the outcome, see coefOther
. For sensitivity analysis with the AR test,
see ARsens.test
. ivmodel
has vcov.ivmodel
,model.matrix.ivmodel
,summary.ivmodel
, confint.ivmodel
, fitted.ivmodel
,
residuals.ivmodel
and coef.ivmodel
methods associated with it.
data(card.data)
# One instrument #
Y=card.data[,"lwage"]
D=card.data[,"educ"]
Z=card.data[,"nearc4"]
Xname=c("exper", "expersq", "black", "south", "smsa", "reg661",
"reg662", "reg663", "reg664", "reg665", "reg666", "reg667",
"reg668", "smsa66")
X=card.data[,Xname]
card.model1IV = ivmodel(Y=Y,D=D,Z=Z,X=X)
card.model1IV
# Multiple instruments
Z = card.data[,c("nearc4","nearc2")]
card.model2IV = ivmodel(Y=Y,D=D,Z=Z,X=X)
card.model2IV
Run the code above in your browser using DataLab