
Estimate a causal effect through the full MRM pipeline
Source:R/mrm_flagship.R
morie_mrm_estimate_causal_effect.RdThe estimation step of the MRM: runs the requested native estimators (nearest-neighbour matching, IPW/design-based ATE, AIPW, DML) on the same specification, applies a multiple-testing correction across them, and bundles estimates, corrected p-values, confidence intervals, per-method diagnostics, and a citation block into one results object.
Usage
morie_mrm_estimate_causal_effect(
data,
treatment,
outcome,
covariates,
methods = c("matching", "ate", "aipw", "dml"),
correction = "holm",
seed = 42L
)Arguments
- data
Data frame (or
morie_mrm_dataset/morie_mrm_reconciliation, whose matched rows are used).- treatment, outcome
Column names (binary 0/1 treatment).
- covariates
Character vector of adjustment covariates.
- methods
Subset of
c("matching", "ate", "aipw", "dml")(default all four).- correction
Multiple-testing correction passed to
stats::p.adjust(default"holm").- seed
RNG seed forwarded to the stochastic estimators.
Value
An object of class morie_mrm_effect: list with
results (data frame: method, estimate, std_error,
ci_lower, ci_upper, p_value, p_adjusted), consensus
(inverse-variance pooled estimate), correction,
spec, citation.
Examples
set.seed(1)
n <- 400
x <- rnorm(n)
t <- rbinom(n, 1, plogis(0.5 * x))
y <- 1 + 0.8 * t + 0.5 * x + rnorm(n)
df <- data.frame(y = y, t = t, x = x)
eff <- morie_mrm_estimate_causal_effect(df, "t", "y", "x",
methods = c("ate", "aipw"))
#> Warning: categorical coding hazards in covariates [x] - run morie_audit_categories(data) and fix before trusting these estimates.
eff$results$estimate
#> [1] 0.8535978 0.8591922