Skip to contents

Wraps DoubleML (+ mlr3 / mlr3learners) when available. Without DoubleML, falls back to a hand-rolled cross-fitting estimator using ridge regression (glmnet) or, last-ditch, OLS partialling out.

Usage

estimate_plr(
  data,
  treatment,
  outcome,
  covariates,
  n_folds = 5L,
  random_state = 42L
)

Arguments

data

Data frame with all required columns.

treatment

Column name of the treatment variable.

outcome

Column name of the outcome variable.

covariates

Character vector of covariate column names.

n_folds

Cross-fitting folds. Default 5.

random_state

RNG seed. Default 42.

Value

Named list with ate, se, ci_lower, ci_upper, pval, n_obs, method.

Examples

# \donttest{
set.seed(1)
n <- 200
X <- matrix(rnorm(n * 2), n, 2)
tr <- rbinom(n, 1, plogis(X[, 1]))
y <- 2 * tr + X[, 1] + rnorm(n)
df <- data.frame(y = y, d = tr, x1 = X[, 1], x2 = X[, 2])
res <- suppressWarnings(estimate_plr(df, treatment = "d", outcome = "y",
                                     covariates = c("x1", "x2")))
res$ate
#> [1] 2.063619
# }