| pretest | R Documentation |
This function implements the pretest estimator by comparing the control function and the TSLS estimators.
pretest(formula, alpha = 0.05)
formula |
A formula describing the model to be fitted. |
alpha |
The significant level. (default = |
For example, the formula Y ~ D + I(D^2)+X|Z+I(Z^2)+X describes the models
Y = α_0 + Dβ_1 + D^2β_2 + Xφ + u
and
D = γ_0 + Zγ_1 + Z^2γ_2 + Xψ + 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.
pretest returns an object of class "pretest", which is a list containing the following components:
|
The estimate of the coefficients in the outcome model. |
|
The estimated covariance matrix of coefficients. |
|
The Hausman test statistic used to test the validity of the extra IV generated by the control function. |
|
The p-value of the Hausman test. |
|
The indicator that the extra IV generated by the control function is valid. |
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.