Skip to contents

Thin wrapper over a weighted stats::lm() plus HC3 robust SEs from sandwich + lmtest when installed. Note: this is the legacy shape used by older MRM pipelines; new code should prefer morie_estimate_ate() (in R/causal.R) for the richer morie_te_result return shape.

Usage

estimate_ate(data, outcome, treatment, weights_col)

Arguments

data

Data frame containing the analytical sample.

outcome

Name of the outcome column.

treatment

Name of the binary treatment column.

weights_col

Name of the weights column (e.g. IPTW).

Value

Named list with ate and se (native HC3-robust).

Examples

set.seed(1)
d <- data.frame(x = rnorm(60), tr = rbinom(60, 1, 0.5))
d$y <- 1 + 0.5 * d$tr + 0.3 * d$x + rnorm(60)
d$wt <- runif(60, 0.5, 1.5)
res <- estimate_ate(d, outcome = "y", treatment = "tr", weights_col = "wt")
res$ate
#> [1] 0.5312638