coef.IVDML {IVDML} | R Documentation |
Extract Treatment Effect Estimate from an IVDML Object
Description
This function computes the estimated (potentially heterogeneous) treatment effect from a fitted IVDML
object (output of fit_IVDML()
).
Usage
## S3 method for class 'IVDML'
coef(
object,
iv_method,
a = NULL,
A = NULL,
kernel_name = NULL,
bandwidth = NULL,
...
)
Arguments
object |
An object of class |
iv_method |
Character. The instrumental variable estimation method to use. Must be one of the methods specified in the fitted object. |
a |
Numeric (optional). A specific value of |
A |
Numeric vector (optional). The variable with respect to which treatment effect heterogeneity is considered. If |
kernel_name |
Character (optional). The name of the kernel function to use for smoothing (if a heterogeneous treatment effect is estimated). Needs to be one of "boxcar", "gaussian", "epanechnikov" or "tricube". |
bandwidth |
Numeric (optional). The bandwidth for the kernel smoothing (if a heterogeneous treatment effect is estimated). |
... |
Further arguments passed to or from other methods. |
Value
If a
is not specified, the estimated homogeneous treatment effect is returned. If a
is specified, the heterogeneous treatment effect \beta(a)
at A = a
is returned.
Examples
set.seed(1)
Z <- rnorm(100)
X <- Z + rnorm(100)
H <- rnorm(100)
D <- Z^2 + sin(X) + H + rnorm(100)
A <- X
Y <- tanh(A) * D + cos(X) - H + rnorm(100)
fit <- fit_IVDML(Y = Y, D = D, Z = Z, X = X, ml_method = "gam")
coef(fit, iv_method = "mlIV")
coef(fit, iv_method = "mlIV", a = 0, A = A, kernel_name = "boxcar", bandwidth = 0.2)