se {IVDML}R Documentation

Compute Standard Error for the Treatment Effect Estimate in an IVDML Object

Description

This function calculates the standard error of the estimated (potentially heterogeneous) treatment effect from a fitted IVDML object (output of fit_IVDML()).

Usage

se(object, iv_method, a = NULL, A = NULL, kernel_name = NULL, bandwidth = NULL)

Arguments

object

An object of class IVDML, produced by the fit_IVDML() function.

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 at which to evaluate the standard error of the heterogeneous treatment effect. If NULL, the function returns the standard error of the homogeneous treatment effect.

A

Numeric vector (optional). The variable with respect to which treatment effect heterogeneity is considered. If NULL, the function assumes the A used in model fitting.

kernel_name

Character (optional). The name of the kernel function to use for smoothing (if a heterogeneous treatment effect is estimated). Must be one of "boxcar", "gaussian", "epanechnikov", or "tricube".

bandwidth

Numeric (optional). The bandwidth for the kernel smoothing (if a heterogeneous treatment effect is estimated).

Value

A numeric value representing the estimated standard error of the treatment effect estimate. If a is not specified, the function returns the standard error of the homogeneous treatment effect. If a is specified, it returns the standard error of the heterogeneous treatment effect estimate at A = a.

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")
se(fit, iv_method = "mlIV")
se(fit, iv_method = "mlIV", a = 0, A = A, kernel_name = "boxcar", bandwidth = 0.2)


[Package IVDML version 1.0.0 Index]