Skip to contents

Decomposes the average treatment effect of a binary treatment into a direct effect and an indirect effect running through a mediator, using the inverse-probability-weighting identification of Huber (2014). Two propensity scores are required, \(Pr(D=1|X)\) and \(Pr(D=1|M,X)\); no model is imposed on the outcome or on the mediator, so arbitrary nonlinearities in either are permitted.

Usage

morie_causal_mediation(
  y,
  d,
  m,
  x,
  link = c("probit", "logit"),
  trim = 0,
  boot = 0L,
  seed = NULL
)

Arguments

y

numeric outcome vector.

d

binary treatment vector (0/1).

m

mediator: vector or matrix.

x

covariate matrix.

"probit" (the specification Huber uses) or "logit".

trim

propensity scores outside [trim, 1 - trim] are dropped. Defaults to 0, i.e. no trimming: Huber's footnote 10 states that no trimming is applied, scores near the boundary not arising in that paper's simulation or application. Raise it when common support is doubtful.

boot

number of bootstrap replications for standard errors; 0 skips them. Huber uses the bootstrap for inference.

seed

optional RNG seed for the bootstrap.

Value

list with total_effect, direct_treated, direct_control, indirect_treated, indirect_control, the four weighted means y11, y01, y10, y00, n_trimmed, decomposition_holds, and se when boot > 0.

Details

Effects are reported in both treatment states because they differ whenever the treatment interacts with the mediator: the direct effect \(\theta(1)\) holds the mediator at its treated value while \(\theta(0)\) holds it at its control value. The decomposition \(\Delta = \theta(1) + \delta(0) = \theta(0) + \delta(1)\) holds by construction, which is worth checking on any result.

References

Huber, M. (2014). Identifying causal mechanisms (primarily) based on inverse probability weighting. Journal of Applied Econometrics, 29(6), 920-943.

Examples

set.seed(2)
n <- 1000
x <- matrix(rnorm(n), n)
d <- rbinom(n, 1, pnorm(0.5 * x[, 1]))
m <- 0.5 * d + 0.5 * x[, 1] + rnorm(n)
y <- 0.3 * d + 0.4 * m + x[, 1] + rnorm(n)
r <- morie_causal_mediation(y, d, m, x)
round(c(total = r$total_effect, direct = r$direct_treated, indirect = r$indirect_treated), 3)
#>    total   direct indirect 
#>    0.651    0.480    0.198