Returns the per-mediator table that explains a pe_mediation() result.
The table has one row for each candidate mediator the penalized fit
selected (retained with a nonzero coefficient). Each row gives the
mediator's two path statistics, its screening p-value, and whether the
screen identified it as active. This is the "why" behind the active
mediators identified, so a user can see which of those candidates were
close to the screening threshold and which were screened out.
Arguments
- fit
A result from
pe_mediation()or one of its workers.
Value
A tidy data.frame (class poemed_tbl) with columns:
- mediator
Column position of the mediator in the original
M.- name
The mediator's column name in
M; present only whenMhas column names.- t_outcome
The standardized mediator-on-outcome statistic (the \(M \to Y\) path, \(\hat\alpha_{m,j} / \hat\sigma_{m,j}\)).
- t_exposure
The standardized exposure-on-mediator statistic (the \(X \to M\) path). With one exposure it is the signed t statistic, so a negative value marks a negative path. With several exposures it is the largest absolute t statistic across the exposures, so it is never negative and does not show the path's direction; regress the mediator on the exposures and any confounders (for example with
lm()) to see the signs.- screen_p
The screening p-value, the larger of the two path p-values (the smaller of these across exposures when there are several). A mediator is identified as active when this clears the multiplicity threshold.
- active
Logical;
TRUEwhen the screen identified the mediator as active under the fit'smethod, so theTRUErows are the fit's active mediators (its"active_mediators"attribute). Every row is a candidate the penalized fit selected, soFALSEmarks a candidate the screen did not identify as active.
The table is empty when the penalized fit selected no candidate mediators.
Details
Two steps narrow the mediators, and the table keeps them apart. The
penalized fit selects some of the candidate mediators, which are the rows
of the table. The multiplicity screen then identifies active mediators
among those candidates, which are the rows whose active column is TRUE.
A row with active = FALSE is therefore a candidate that the screen did
not identify as active, not a mediator the penalized fit dropped.
See also
pe_mediation(), pe_selection().
Other mediation tests:
pe_mediate(),
pe_mediation(),
pe_mediation_linear(),
pe_mediation_logistic(),
pe_mediation_poisson(),
pe_selection(),
summary.poemed_tbl()
Examples
set.seed(113)
d <- simulate_mediation_data(n = 200, p = 60, outcome = "continuous",
pattern = "contrasting", c1 = 1)
fit <- pe_mediation(d$X, d$Y, d$M, outcome = "continuous")
#> Warning: HBIC selected lambda = 0.05, the smallest value of `lambda_grid`, for the full model and the reduced model of the benchmark test. The criterion is minimized over the grid alone, so its minimum may lie beyond that end or between the end and its neighbor. Consider extending the grid past it and using a finer partition (more values), and compare the active mediators identified and the p-values across grids.
# HBIC chose the smallest value of the default grid here, so the fit
# warned; see the lambda_grid argument of ?pe_mediation.
pe_mediators(fit)
#> mediator t_outcome t_exposure screen_p active
#> 1 21.88 0.3641 0.7158 FALSE
#> 2 -10.28 3.131 0.0017 TRUE
#> 3 8.72 4.349 < 0.0001 TRUE
#> 4 -6.871 6.185 < 0.0001 TRUE
#> 33 -2.226 -2.793 0.0260 FALSE
#> 36 -1.535 -2.425 0.1249 FALSE