cate {targeted} | R Documentation |
Conditional Average Treatment Effect estimation
Description
Conditional Average Treatment Effect estimation via Double Machine Learning
Usage
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(s)
Klaus Kähler Holst
Examples
sim1 <- function(n=1e4,
seed=NULL,
return_model=FALSE, ...) {
suppressPackageStartupMessages(require("lava"))
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
[Package targeted version 0.5 Index]