Skip to contents

The Hajek estimator uses stabilised IPW weights: $$\widehat{ATE} = \bar{y}_1^{w} - \bar{y}_0^{w}$$ where \(\bar{y}_t^{w} = \sum_{T_i=t} w_i Y_i / \sum_{T_i=t} w_i\) and \(w_i = T_i/\hat{e}(X_i) + (1-T_i)/(1-\hat{e}(X_i))\).

Usage

morie_estimate_ate(data, treatment, outcome, covariates, propensity_col = NULL)

Arguments

data

A data frame.

treatment

Name of the binary treatment column.

outcome

Name of the outcome column.

covariates

Character vector of covariate names.

propensity_col

Optional: name of a pre-computed propensity score column.

Value

Named list: ate, se, ci_lower, ci_upper, n, ess.

Details

When WeightIt is installed the propensity step delegates to WeightIt::weightit(); otherwise the inline logistic regression is used. The Hajek difference and influence-function SE below are evaluated inline either way so the result list shape and the closed-form variance preserved.

Examples

set.seed(1)
df <- data.frame(
  t = rbinom(200, 1, 0.4),
  y = rnorm(200),
  x = rnorm(200)
)
morie_estimate_ate(df, "t", "y", "x")
#> $ate
#> [1] -0.05436274
#> 
#> $se
#> [1] 0.1416003
#> 
#> $ci_lower
#> [1] -0.3318993
#> 
#> $ci_upper
#> [1] 0.2231738
#> 
#> $n
#> [1] 200
#> 
#> $ess
#> [1] 193.729
#>