Three small simulated data sets, one per outcome type, for trying the
POEMED tests and reproducing the help-page examples. Each was generated
by simulate_mediation_data() under a homogeneous mediation pattern
(a few same-sign active mediators among many null ones) with three
confounders, at seed 113, so the generating truth is known and travels
with the data.
Format
Each is a list, the return value of
simulate_mediation_data(), with components:
- X
Exposure matrix, \(n \times 1\).
- M
Candidate mediator matrix, \(n \times 100\).
- Y
Outcome vector of length \(n\): continuous for
example_continuous, 0/1 forexample_binary, nonnegative counts forexample_count.- Z
Confounder matrix, \(n \times 3\).
- alpha_m, Gamma_x, alpha_x
The mediator-on-outcome, exposure-on-mediator, and direct-effect coefficients used to generate the data.
- alpha_z, Gamma_z
The confounder coefficients the simulator drew from U(-0.5, 0.5) and used:
alpha_z, the three confounder-on-outcome coefficients, andGamma_z, the \(3 \times 100\) matrix of confounder-on-mediator coefficients, in which each confounder loads equally on every mediator (each row holds one value).- beta
The total indirect effect \(\Gamma_x \alpha_m\): 0.42 for
example_continuous, 0.8 forexample_binary, and 0.24 forexample_count.- active_mediators
Indices of the truly active mediators: mediators 1 to 5 in
example_continuous, and mediators 1, 2, and 5 inexample_binaryandexample_count.- n, p, q, outcome, pattern
The generating settings.
The sample sizes are \(n = 200\) (example_continuous) and
\(n = 300\) (example_binary, example_count).
In example_count the simulator's overflow guard fired (the largest
log-mean was 5.88; see the Value section of
simulate_mediation_data()), so the counts follow a log-mean whose
coefficients are the recorded alpha_m, alpha_x, and alpha_z
multiplied by 0.71 (with an intercept of 0.83), and a total indirect
effect of 0.17 where beta records 0.24.
Source
Simulated with simulate_mediation_data(); see
data-raw/example_data.R in the package sources.
Examples
data(example_continuous)
str(example_continuous$active_mediators) # truly active: mediators 1 to 5
#> int [1:5] 1 2 3 4 5
fit <- pe_mediation(example_continuous$X, example_continuous$Y,
example_continuous$M, Z = example_continuous$Z,
outcome = "continuous")
# Both tests reject at the 0.05 level, and the screen identifies one of
# the five truly active mediators (mediator 4).
fit
#> term value
#> stat_hdmm 6.146
#> pval_hdmm 0.0132
#> stat_pe 482.6
#> j_pe 476.5
#> pval_pe < 0.0001
#> total_indirect_effect 0.3758
#> n_active_mediators 1
#> df 1
#> n_candidate_mediators 100
#> n_observations 200
#>
#> Outcome model: continuous (linear)
#> Active mediators identified (1): 4
#> Tuning parameter (HBIC): lambda = 0.151 from 100 values in [0.05, 10]