knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
This package conducts model selection for multivariate mediation analysis involving exposure by mediator interaction while addressing the underlying hierarchical structure between the main effect and interaction.
library(XMInt)
Example data (exposure X, outcome Y, and potential mediators M) was generated as follows.
For each subject $i = 1, ..., N$:
The first three M variables ($M_1,M_2,M_3$) are set to be the true mediators (i.e., having non-zero $a$ and $b_1$ coefficients), $X \times M_1$ is set to be the true exposure-by-mediator interaction term (i.e., having non-zero $b_2$ coefficients), and all other coefficients are set to be 0. The effect size (ES) represents the value of $a, b_1, b_2$ of the truth, which are $a_1, a_2, a_3, b_{1_{1}}, b_{1_{2}}, b_{1_{3}}, b_{2_{1}}$ in our case.
## data generation data = dat_gen(N = 200, V = 50, es = 1, seed = 1) X = data$X; Y = data$Y; M = data$M
## select model result = XMInt_select(X,Y,M)
## selected mediator(s) result$selected_mediator ## selected interaction(s) result$selected_interaction
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.