Skip to contents

Fits a logistic-regression propensity model on covariates, clips propensities to \([\varepsilon, 1-\varepsilon]\), and computes the Hajek-normalised difference of weighted means. SE follows the Lunceford-Davidian (2004) sandwich influence-function form.

Usage

morie_otis_ipw_ate(df, treatment, outcome, covariates, eps = 0.02)

Arguments

df

A data frame containing treatment, outcome, and all covariates (rows with NAs in these columns are dropped).

treatment

Name of the binary treatment column. Strings "Yes"/"No" (case-insensitive) are auto-binarised; numeric columns are coerced with NA -> 0.

outcome

Name of the (numeric) outcome column.

covariates

Character vector of covariate names. Character / factor columns are converted to drop-first dummies.

eps

Numeric in \((0, 0.5)\); propensity clip bound (default 0.02).

Value

A morie_causal_estimate list with estimator, ate, ate_se, ate_pval, ate_ci95, n, n_treated, p_treat, notes.

References

Lunceford, J. K. & Davidian, M. (2004). Statistics in Medicine 23(19), 2937-2960.

Examples

set.seed(1)
n <- 300L
x <- rnorm(n)
d <- rbinom(n, 1, plogis(0.4 * x))
y <- 0.5 * d + x + rnorm(n)
df <- data.frame(d = d, y = y, x = x)
morie_otis_ipw_ate(df, treatment = "d", outcome = "y",
                   covariates = "x")
#> $estimator
#> [1] "IPW"
#> 
#> $ate
#> [1] 0.4945119
#> 
#> $ate_se
#> [1] 0.1830629
#> 
#> $ate_pval
#> [1] 0.006906438
#> 
#> $ate_ci95
#> [1] 0.1357086 0.8533153
#> 
#> $n
#> [1] 300
#> 
#> $n_treated
#> [1] 144
#> 
#> $p_treat
#> [1] 0.48
#> 
#> $notes
#> $notes[[1]]
#> [1] "calibration=none"
#> 
#> $notes[[2]]
#> [1] "Brier=0.236"
#> 
#> 
#> attr(,"class")
#> [1] "morie_causal_estimate" "list"