pretest {controlfunctionIV} | R Documentation |
Prestest estimator
Description
This function implements the pretest estimator by comparing the control function and the TSLS estimators.
Usage
pretest(formula, alpha = 0.05)
Arguments
formula |
A formula describing the model to be fitted. |
alpha |
The significant level. (default = |
Details
For example, the formula Y ~ D + I(D^2)+X|Z+I(Z^2)+X
describes the models
Y = \alpha_0 + D\beta_1 + D^2\beta_2 + X\phi + u
and
D = \gamma_0 + Z\gamma_1 + Z^2\gamma_2 + X\psi + v
.
Here, the outcome is Y
, the endogenous variables is D
, the baseline covariates are X
, and the instrument variables are Z
. The formula environment follows
that in the ivreg function in the AER package. The endogenous variable D
must be in the first term of the formula for the outcome model.
Value
pretest
returns an object of class "pretest", which is a list containing the following components:
coefficients |
The estimate of the coefficients in the outcome model. |
vcov |
The estimated covariance matrix of coefficients. |
Hausman.stat |
The Hausman test statistic used to test the validity of the extra IV generated by the control function. |
p.value |
The p-value of the Hausman test. |
cf.check |
The indicator that the extra IV generated by the control function is valid. |
References
Guo, Z. and D. S. Small (2016), Control function instrumental variable estimation of nonlinear causal effect models, The Journal of Machine Learning Research 17(1), 3448–3482.
Examples
data("nonlineardata")
Y <- log(nonlineardata[,"insulin"])
D <- nonlineardata[,"bmi"]
Z <- as.matrix(nonlineardata[,c("Z.1","Z.2","Z.3","Z.4")])
X <- as.matrix(nonlineardata[,c("age","sex")])
pretest.model <- pretest(Y~D+I(D^2)+X|Z+I(Z^2)+X)
summary(pretest.model)