ivmodel-package {ivmodel} | R Documentation |
Statistical Inference and Sensitivity Analysis for Instrumental Variables Model
Description
The package fits an instrumental variables (IV) model of the following type. Let Y
, D
, X
, and Z
represent the outcome, endogenous variable, p dimensional exogenous covariates, and L dimensional instruments, respectively; note that the intercept can be considered as a vector of ones and a part of the exogenous covariates X
.The package assumes the following IV model
Y = X \alpha + D \beta + \epsilon, E(\epsilon | X, Z) = 0
It carries out several IV regressions, diagnostics, and tests associated with the parameter \beta
in the IV model. Also, if there is only one instrument, the package runs a sensitivity analysis discussed in Jiang et al. (2015).
The package is robust to most data formats, including factor and character data, and can handle very large IV models efficiently using a sparse QR decomposition.
Details
Supply the outcome Y
, the endogenous variable D
, and a data frame and/or matrix of instruments Z
, and a data frame and/or matrix of exogenous covariates X
(optional) and run ivmodel
. Alternatively, one can supply a formula. ivmodel
will generate all the relevant statistics for the parameter \beta
.
The DESCRIPTION file:
Package: | ivmodel |
Type: | Package |
Title: | Statistical Inference and Sensitivity Analysis for Instrumental Variables Model |
Version: | 1.9.1 |
Date: | 2023-04-08 |
Author: | Hyunseung Kang, Yang Jiang, Qingyuan Zhao, and Dylan Small |
Maintainer: | Hyunseung Kang <hyunseung@stat.wisc.edu> |
Description: | Carries out instrumental variable estimation of causal effects, including power analysis, sensitivity analysis, and diagnostics. See Kang, Jiang, Zhao, and Small (2020) <http://pages.cs.wisc.edu/~hyunseung/> for details. |
Imports: | stats,Matrix,Formula,reshape2,ggplot2 |
License: | GPL-2 | file LICENSE |
LazyData: | true |
RoxygenNote: | 7.2.3 |
NeedsCompilation: | no |
Repository: | CRAN |
Suggests: | testthat |
Index of help topics:
AR.power Power of the Anderson-Rubin (1949) Test AR.size Sample Size Calculator for the Power of the Anderson-Rubin (1949) Test AR.test Anderson-Rubin (1949) Test ARsens.power Power of the Anderson-Rubin (1949) Test with Sensitivity Analysis ARsens.size Sample Size Calculator for the Power of the Anderson-Rubin (1949) Test with Sensitivity Analysis ARsens.test Sensitivity Analysis for the Anderson-Rubin (1949) Test CLR Conditional Likelihood Ratio Test Fuller Fuller-k Estimator IVpower Power calculation for IV models IVsize Calculating minimum sample size for achieving a certain power KClass k-Class Estimator LIML Limited Information Maximum Likelihood Ratio (LIML) Estimator TSLS.power Power of TSLS Estimator TSLS.size Sample Size Calculator for the Power of Asymptotic T-test balanceLovePlot Create Love plot of standardized covariate mean differences biasLovePlot Create Love plot of treatment bias and instrument bias card.data Card (1995) Data coef.ivmodel Coefficients of the Fitted Model in the 'ivmodel' Object coefOther Exogenous Coefficients of the Fitted Model in the 'ivmodel' Object confint.ivmodel Confidence Intervals for the Fitted Model in 'ivmodel' Object distributionBalancePlot Plot randomization distributions of the Mahalanobis distance fitted.ivmodel Extract Model Fitted values in the 'ivmodel' Object getCovMeanDiffs Get Covariate Mean Differences getMD Get Mahalanobis Distance getStandardizedCovMeanDiffs Get Standardized Covariate Mean Differences icu.data Pseudo-data based on Branson and Keele (2020) iv.diagnosis Diagnostics of instrumental variable analysis ivmodel Fitting Instrumental Variables (IV) Models ivmodel-package Statistical Inference and Sensitivity Analysis for Instrumental Variables Model ivmodelFormula Fitting Instrumental Variables (IV) Models model.matrix.ivmodel Extract Design Matrix for 'ivmodel' Object para Parameter Estimation from Ivmodel permTest.absBias Perform a permutation test using the sum of absolute biases permTest.md Perform a permutation test using the Mahalanobis distance residuals.ivmodel Residuals from the Fitted Model in the 'ivmodel' Object vcov.ivmodel Calculate Variance-Covariance Matrix (i.e. Standard Error) for k-Class Estimators in the 'ivmodel' Object vcovOther Variance of Exogenous Coefficients of the Fitted Model in the 'ivmodel' Object
Author(s)
Hyunseung Kang, Yang Jiang, Qingyuan Zhao, and Dylan Small
Maintainer: Hyunseung Kang <hyunseung@stat.wisc.edu>
References
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.
Andrews, D. W. K., Moreira, M. J., and Stock, J. H. (2006). Optimal two-side invariant similar tests for instrumental variables regression. Econometrica 74, 715-752.
Card, D. Using Geographic Variation in College Proximity to Estimate the Return to Schooling. In Aspects of Labor Market Behavior: Essays in Honor of John Vanderkamp, eds. L.N. Christophides, E.K. Grant and R. Swidinsky. 201-222. National Longitudinal Survey of Young Men: https://www.nlsinfo.org/investigator/pages/login.jsp
Fuller, W. (1977). Some properties of a modification of the limited information estimator. Econometrica, 45, 939-953.
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.
Examples
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