Skip to contents

The marginal structural mean model with an effect modifier V is E[Y^a | V] = b0 + b1 a + b2 V a + b3 V; Hernan and Robins instruct that its parameters be estimated by fitting E[Y|A,V] = t0 + t1 A + t2 V A + t3 V by weighted least squares with the IP weights. Additive effect modification is present when b2 differs from zero, so b2 is the reported estimate. Because the weights are estimated, the robust (sandwich) standard error is reported rather than the model-based one.

Usage

Intanl(y, A, V, H)

Arguments

y

Outcome vector.

A

Treatment vector.

V

Effect modifier.

H

IP weights; NULL gives the unweighted fit.

Value

List with estimate (the interaction), beta0, beta_a, beta_av, beta_v, se, se_a, se0, se_v, n, method.

Details

Formula: E[Y^a|V] = b0 + b1 a + b2 V a + b3 V.

References

Hernan and Robins (2020), Causal Inference: What If, Chapman and Hall/CRC, section 12.5, p. 171.

Examples

set.seed(1)
Intanl(y = rnorm(20), A = rbinom(20, 1, 0.5), V = rbinom(20, 1, 0.5),
       H = runif(20, 0.5, 1.5))
#> $estimate
#> [1] -0.454002
#> 
#> $beta0
#> [1] -0.1062024
#> 
#> $beta_a
#> [1] 0.3892299
#> 
#> $beta_av
#> [1] -0.454002
#> 
#> $beta_v
#> [1] 0.367931
#> 
#> $se
#> [1] 0.7783651
#> 
#> $se_a
#> [1] 0.7168302
#> 
#> $se0
#> [1] 0.6319337
#> 
#> $se_v
#> [1] 0.6540943
#> 
#> $n
#> [1] 20
#> 
#> $method
#> [1] "E[Y^a|V] = b0 + b1 a + b2 V a + b3 V by IP-weighted least squares, Hernan & Robins (2020) s.12.5"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"