Skip to contents

Estimates the ATE by: $$\widehat{ATE} = \frac{1}{n}\sum_i \bigl[\hat{\mu}_1(X_i) - \hat{\mu}_0(X_i)\bigr]$$

Usage

morie_estimate_g_computation(
  data,
  treatment,
  outcome,
  covariates,
  outcome_model = c("linear", "logistic")
)

Arguments

data

A vector; indexed elementwise.

treatment

Passed to morie_estimate_propensity_scores.

outcome

See Usage.

covariates

Passed to morie_estimate_propensity_scores.

outcome_model

Family for the outcome model: "auto" (logistic for a 0/1 outcome, linear otherwise), "linear" or "logistic".

Value

Named list: ate, se, ci_lower, ci_upper.

Details

The outcome model is one stats::glm() fit; its predictions with the treatment set to 1 and to 0 are averaged over the sample. The SE is the M-estimation sandwich of stdReg::stdGlm() (Sjolander 2016): the GLM score equations stacked with the two standardisation equations, so the outcome model's own uncertainty is included. Computed natively; cross-validated against stdReg in tests/cross.

References

Sjolander, A. (2016). Regression standardization with the R package stdReg. European Journal of Epidemiology, 31(6), 563–574.

Examples

set.seed(1)
df <- data.frame(t = rbinom(200, 1, 0.4), x = rnorm(200))
df$y <- 1 + 0.5 * df$t + df$x + rnorm(200)
morie_estimate_g_computation(df, "t", "y", "x")
#> $ate
#> [1] 0.6053772
#> 
#> $se
#> [1] 0.1546918
#> 
#> $ci_lower
#> [1] 0.3021814
#> 
#> $ci_upper
#> [1] 0.908573
#>