
Estimate ATE via Double Machine Learning (Partially Linear Regression)
Source:R/causal.R
morie_estimate_double_ml.RdNative rmorie implementation of Chernozhukov et al. (2018)
double/debiased machine learning for the partially linear model:
\(Y\) and \(D\) are residualised on \(X\) via K-fold
cross-fit GCV-tuned ridge regressions, the target parameter comes
from the Neyman-orthogonal score, and n_rep repetitions are
aggregated by DoubleML's median rule. Deterministic given
random_state; no DoubleML/mlr3/ranger at runtime
(cross-validated against DoubleML in the package's cross tests).
Usage
morie_estimate_double_ml(
data,
outcome,
treatment,
covariates,
n_folds = 5L,
n_rep = 1L,
random_state = 42L
)Arguments
- data
A data frame with treatment, outcome, and covariate columns.
- outcome
Name of the continuous outcome column.
- treatment
Name of the (binary) treatment column.
- covariates
Character vector of covariate column names.
- n_folds
Number of cross-fitting folds (default 5).
- n_rep
Number of repeated cross-fitting repetitions, aggregated by the median rule. Default 1.
- random_state
Integer seed for cross-fit folds and learners (default 42).
References
Chernozhukov, V., Chetverikov, D., Demirer, M., Duflo, E., Hansen, C., Newey, W., & Robins, J. (2018). Double/debiased machine learning for treatment and structural parameters. The Econometrics Journal, 21(1), C1–C68.
Examples
set.seed(1)
n <- 200
X <- matrix(rnorm(n * 3), n, 3)
d <- rbinom(n, 1, plogis(X[, 1]))
y <- 0.5 * d + X[, 1] + rnorm(n)
df <- data.frame(y = y, d = d, x1 = X[, 1], x2 = X[, 2], x3 = X[, 3])
morie_estimate_double_ml(df, "y", "d", c("x1", "x2", "x3"))
#> $ate
#> [1] 0.550251
#>
#> $se
#> [1] 0.176558
#>
#> $ci_lower
#> [1] 0.2042036
#>
#> $ci_upper
#> [1] 0.8962983
#>
#> $n
#> [1] 200
#>
#> $method
#> [1] "PLR (rmorie native)"
#>