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")
)Details
Delegates the standardisation step to stdReg::stdGlm() when
stdReg is installed; otherwise computes the contrast inline
from a single stats::glm() fit with treatment-flipped
counterfactual datasets.
Examples
set.seed(1)
df <- data.frame(t = rbinom(200, 1, 0.4), y = rnorm(200), x = rnorm(200))
morie_estimate_g_computation(df, "t", "y", "x")
#> $ate
#> [1] -0.06093144
#>
#> $se
#> [1] 0.1419764
#>
#> $ci_lower
#> [1] -0.3392052
#>
#> $ci_upper
#> [1] 0.2173424
#>