Skip to contents

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\

Usage

estimate_ate_gcomputation(
  data,
  treatment,
  outcome,
  covariates,
  outcome_model = "linear"
)

Arguments

data

Data frame with all required columns.

treatment

Binary treatment column (0/1).

outcome

Outcome column.

covariates

Character vector of covariates.

outcome_model

"linear" (OLS) or "logistic" (logit GLM).

Value

Named list with ate, se, ci_lower, ci_upper, n_obs, outcome_model.

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