Skip to contents

Fits the outcome regression \(\hat\mu(d, X)\) by OLS with the treatment as a column, then averages \(\hat\mu(1, X_i) - \hat\mu(0, X_i)\) over the sample (Robins 1986). The standard error is the non-parametric bootstrap: rows are resampled, the regression refitted, and the contrast recomputed. Consistent only when the outcome model is right (single-robust); compare IPW (propensity model) and AIPW (doubly robust).

Usage

morie_otis_gcomputation(
  df,
  treatment,
  outcome,
  covariates,
  n_bootstrap = 200L,
  seed = 123L
)

Arguments

df

A data frame containing treatment, outcome, and all covariates (rows with NAs in these columns are dropped).

treatment

Name of the binary treatment column. Strings "Yes"/"No" (case-insensitive) are auto-binarised; numeric columns are coerced with NA -> 0.

outcome

Name of the (numeric) outcome column.

covariates

Character vector of covariate names. Character / factor columns are converted to drop-first dummies.

n_bootstrap

Number of bootstrap replicates (default 200).

seed

Integer seed for the bootstrap draws (default 123).

Value

A morie_causal_estimate list.

References

Robins, J. M. (1986). A new approach to causal inference in mortality studies with a sustained exposure period. Mathematical Modelling 7, 1393-1512.

Examples

set.seed(1)
n <- 300L
x <- rnorm(n)
d <- rbinom(n, 1, plogis(0.4 * x))
y <- 0.5 * d + x + rnorm(n)
df <- data.frame(d = d, y = y, x = x)
# the contrast of a linear outcome model is the treatment coefficient
g <- morie_otis_gcomputation(df, "d", "y", "x", n_bootstrap = 50L)
c(g$ate, unname(coef(lm(y ~ d + x))["d"]))
#> [1] 0.5070764 0.5070764