Conditional Average Treatment Effect estimation via Double Machine Learning

cate(
treatment,
response_model,
propensity_model,
contrast = c(1, 0),
data,
nfolds = 5,
type = "dml2",
silent = FALSE,
stratify = FALSE,
mc.cores,
...
)

## Arguments

treatment

formula specifying treatment and variables to condition on

response_model

formula or ml_model object (formula => glm)

propensity_model

formula or ml_model object (formula => glm)

contrast

treatment contrast (default 1 vs 0)

data

data.frame

nfolds

Number of folds

type

'dml1' or 'dml2'

silent

supress all messages and progressbars

stratify

If TRUE the response_model will be stratified by treatment

mc.cores

mc.cores Optional number of cores. parallel::mcmapply used instead of future

...

additional arguments to future.apply::future_mapply

## Value

cate.targeted object

## Author

Klaus Kähler Holst

## Examples

sim1 <- function(n=1e4,
seed=NULL,
return_model=FALSE, ...) {

if (!is.null(seed)) set.seed(seed)
m <- lava::lvm()
regression(m, ~a) <- function(z1,z2,z3,z4,z5)
cos(z1)+sin(z1*z2)+z3+z4+z5^2
regression(m, ~u) <- function(a,z1,z2,z3,z4,z5)
(z1+z2+z3)*a + z1+z2+z3 + a
distribution(m, ~a) <- binomial.lvm()
if (return_model) return(m)
lava::sim(m, n, p=par)
}

d <- sim1(200)
e <- cate(a ~ z1+z2+z3, response=u~., data=d)
e
#>             Estimate Std.Err    2.5%  97.5%   P-value
#> E[u(1)]       1.1020  0.2505  0.6110 1.5929 1.086e-05
#> E[u(0)]      -0.0897  0.2345 -0.5493 0.3699 7.021e-01
#> ───────────
#> (Intercept)   1.1865  0.1977  0.7989 1.5740 1.965e-09
#> z1            1.3537  0.3760  0.6166 2.0907 3.185e-04
#> z2            0.7588  0.2521  0.2647 1.2529 2.612e-03
#> z3            0.8032  0.1486  0.5120 1.0944 6.441e-08