Regression standardisation: one GLM for the outcome, its predictions
with the treatment set to 1 and to 0 averaged over the sample, and the
M-estimation sandwich SE of stdReg::stdGlm() (Sjolander 2016),
computed natively (the same estimate and SE as
morie_estimate_g_computation, cross-validated against
stdReg). The 95\
Examples
set.seed(1)
n <- 300
X <- matrix(rnorm(n * 3), n, 3)
tr <- rbinom(n, 1, plogis(X[, 1]))
y <- 2.5 * tr + drop(X %*% c(1, 0.5, -0.7)) + rnorm(n)
d <- data.frame(y = y, d = tr, x1 = X[, 1], x2 = X[, 2], x3 = X[, 3])
res <- estimate_ate_gcomputation(d,
treatment = "d", outcome = "y",
covariates = c("x1", "x2", "x3")
)
res$ate
#> [1] 2.41178
