cf | R Documentation |
Implement the control function method for the inference of nonlinear treatment effects.
cf(formula, d1 = NULL, d2 = NULL)
formula |
A formula describing the model to be fitted. |
d1 |
The baseline treatment value. |
d2 |
The target treatment value. |
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.
If either one of d1
or d2
is missing or NULL
, CausalEffect
is calculated assuming that the baseline value d1
is the median of the treatment and the target value d2
is d1+1
.
cf
returns an object of class "cf", which is a list containing the following components:
|
The estimate of the coefficients in the outcome model. |
|
The estimated covariance matrix of coefficients. |
|
The causal effect when the treatment changes from |
|
The standard error of the causal effect estimator. |
|
The 95% confidence interval of the causal effect. |
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")]) cf.model <- cf(Y~D+I(D^2)+X|Z+I(Z^2)+X) summary(cf.model)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.