ivmodelFormula: Fitting Instrumental Variables (IV) Models

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/ivmodelFormula.r

Description

ivmodelFormula 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.

Usage

1
2
3
4
5
ivmodelFormula(formula, data, subset,
        beta0=0,alpha=0.05,k=c(0,1), 
        heteroSE = FALSE, clusterID = NULL, 
        deltarange=NULL, na.action = na.omit)
 

Arguments

formula

a formula describing the model to be fitted. For example, the formula Y ~ D + X1 + X2 | Z1 + Z2 + X1 + X2 describes the mode where

Y = α_0 + D β + X_{1} α_1 + X_{2} α_2 + ε

and

D = γ_0 + Z_{1} γ_1 + Z_{2} γ2 + X_{1} κ_1 + X_{2} κ_2 + ξ

The outcome is Y, the endogenous variable is D. The exogenous covariates are X1 and X2. The instruments are Z1 and Z2. The formula environment follows the formula environment in the ivreg function in the AER package.

data

an optional data frame containing the variables in the model. By default the variables are taken from the environment which ivmodel is called from

subset

an index vector indicating which rows should be used.

beta0

Null value β_0 for testing null hypothesis H_0: β = β_0 in ivmodel. Default is $0$.

alpha

The significance level for hypothesis testing. Default is 0.05.

k

A numeric vector of k values for k-class estimation. Default is 0 (OLS) and 1 (TSLS).

heteroSE

Should heteroscedastic-robust standard errors be used? Default is FALSE.

clusterID

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.

deltarange

Range of δ for sensitivity analysis with the Anderson-Rubin (1949) test.

na.action

NA handling. There are na.fail, na.omit, na.exclude, na.pass available. Default is na.omit.

Details

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. ivmodel assumes the following IV model

Y = X α + D β + ε, E(ε | X, Z) = 0

and produces statistics for β. In particular, ivmodel computes the OLS, TSLS, k-class, limited information maximum likelihood (LIML), and Fuller-k (Fuller 1977) estimates of β using KClass, LIML, and codeFuller. Also, ivmodel computes confidence intervals and hypothesis tests of the type H_0: β = β_0 versus H_0: β \neq β_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 γ + X κ + ξ, E(ξ | X, Z) = 0

Value

ivmodel returns an object of class "ivmodel".

An object class "ivmodel" is a list containing the following components

alpha

Significance level for the hypothesis tests.

beta0

Null value of the hypothesis tests.

kClass

A list from KClass function.

LIML

A list from LIML function.

Fuller

A list from Fuller function.

AR

A list from AR.test.

CLR

A list from CLR.

In addition, if there is only one instrument, ivreg will generate an "ARsens" list within "ivmodel" object.

Author(s)

Yang Jiang, Hyunseung Kang, and Dylan Small

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.

Freeman G, Cowling BJ, Schooling CM (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.

Wang, X., Jiang, Y., Small, D. and Zhang, N (2017), Sensitivity analysis and power for instrumental variable studies, (under review of Biometrics).

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.

See Also

See also KClass, LIML, Fuller, AR.test, and CLR for individual methods associated with ivmodel. 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.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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 = ivmodelFormula(lwage ~ educ + exper + expersq + black + 
                                south + smsa + reg661 + 
                                reg662 + reg663 + reg664 + 
                                reg665 + reg666 + reg667 + 
                                reg668 + smsa66 | nearc4 + 
                                exper + expersq + black + 
                                south + smsa + reg661 + 
                                reg662 + reg663 + reg664 + 
                                reg665 + reg666 + reg667 + 
                                reg668 + smsa66,data=card.data)
card.model1IV

# Multiple instruments
Z = card.data[,c("nearc4","nearc2")]
card.model2IV = ivmodelFormula(lwage ~ educ + exper + expersq + black + 
                                south + smsa + reg661 + 
                                reg662 + reg663 + reg664 + 
                                reg665 + reg666 + reg667 + 
                                reg668 + smsa66 | nearc4 + nearc2 +
                                exper + expersq + black + 
                                south + smsa + reg661 + 
                                reg662 + reg663 + reg664 + 
                                reg665 + reg666 + reg667 + 
                                reg668 + smsa66,data=card.data)
card.model2IV

ivmodel documentation built on Feb. 21, 2020, 1:08 a.m.