
DIRECT mediation estimator: OLS with instrument and NC as covariates
Source:R/mediation.R
fit_direct_mediation.RdAdjusts for the genetic instrument G and negative-control W in both
the mediator and outcome regressions. Like fit_direct,
this is a naive adjustment that does not correct for unmeasured
confounding via a ratio or IV approach.
Examples
set.seed(1)
dat <- generate_toy_data(n = 200, mo_confounding = 0.8, seed = 1)
fit_direct_mediation(dat$Y[, 1], dat$X, dat$M, dat$G[, 1], dat$W[, 1])
#> $NDE
#> [1] -0.3486436
#>
#> $NDE_se
#> [1] 0.06224249
#>
#> $NDE_p
#> [1] 7.165418e-08
#>
#> $NIE
#> [1] 0.8687889
#>
#> $NIE_se
#> [1] 0.06284506
#>
#> $NIE_p
#> [1] 1.818792e-43
#>
#> $alpha_M
#> [1] 0.7229852
#>
#> $alpha_se
#> [1] 0.02021802
#>
#> $beta_M
#> [1] 1.201669
#>
#> $beta_M_se
#> [1] 0.08016613
#>