Skip to contents

E[Y(a)] = E[E[Y | A = a, L]], with an OLS outcome model including treatment-covariate interactions. Mirrors morie.fn.causmrop.

Usage

morie_g_formula(y, a, l)

Arguments

y

Outcome.

a

Binary 0/1 treatment.

l

Covariate matrix or vector.

Value

List with EY1, EY0, ate, n.

References

Robins JM (1986). Mathematical Modelling 7, 1393-1512.

Examples

set.seed(1)
n <- 3000
x <- stats::rnorm(n)
e <- pmin(pmax(1/(1 + exp(-x)), 0.05), 0.95)
tr <- as.numeric(stats::runif(n) < e)
y <- x + stats::rnorm(n) + 3 * tr
L <- stats::rnorm(n)
a <- as.numeric(stats::runif(n) < 1/(1 + exp(-1.5 * L)))
morie_g_formula(y, a, L)
#> $EY1
#> [1] 1.46452
#> 
#> $EY0
#> [1] 1.413564
#> 
#> $ate
#> [1] 0.05095646
#> 
#> $n
#> [1] 3000
#>