cate: Conditional Average Treatment Effect estimation

View source: R/cate.R

cateR 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 = "dml1",
  ...
)

Arguments

treatment

formula specifying treatment and variables to condition on

response_model

SL object

propensity_model

SL object

contrast

treatment contrast (default 1 vs 0)

data

data.frame

nfolds

Number of folds

type

'dml1' or 'dml2'

...

additional arguments to SuperLearner

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)
if (require("SuperLearner",quietly=TRUE)) {
  e <- cate(a ~ z1+z2+z3, response=u~., data=d)
  e
}


targeted documentation built on Oct. 26, 2022, 1:09 a.m.