Skip to contents

Summarizes which mediators a pe_mediation() fit identified as active. When the fit was produced with report_all_methods = TRUE, this reports the identified active set under each of the three multiplicity methods (Bonferroni for familywise error rate control, Benjamini-Hochberg and Benjamini-Yekutieli for false discovery rate control), so their conservativeness can be compared on the same fit. Otherwise it reports the single method that was used.

Usage

pe_selection(fit)

Arguments

fit

A result from pe_mediation() or one of its workers.

Value

A tidy data.frame of class poemed_tbl (so its p-values print to fixed decimals) with one row per multiplicity method and columns method, n_active (number of active mediators identified), j_pe (the power enhancement component \(J_m\) under that method's screen), stat_pe and pval_pe (the resulting power-enhanced statistic \(M_{PE}\) and its p-value), and active_mediators (their column names when M has them, otherwise their column positions, comma-separated, or "none"). Because each multiplicity method screens a different identified set into \(J_m\), the pval_pe column gives the PE / PE_BH / PE_BY global p-values side by side, as the article's extended data-analysis tables report them.

Author

Xiufan Yu and Ken Kelley

Examples

set.seed(113)
d <- simulate_mediation_data(n = 300, p = 100, outcome = "continuous",
                             pattern = "homogeneous", c1 = 1)
fit <- pe_mediation(d$X, d$Y, d$M, outcome = "continuous",
                    report_all_methods = TRUE)
#> Warning: HBIC selected lambda = 0.05, the smallest value of `lambda_grid`, for the full model. 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.
# On this homogeneous design (truly active mediators 1 to 5) the screens
# differ: Bonferroni, which controls the familywise error rate,
# identifies three mediators as active (3, 4, and 5); BH, the false
# discovery rate screen for independent or positively dependent
# mediators, identifies four (2 to 5); BY, valid under arbitrary
# dependence, identifies the same three as Bonferroni.
pe_selection(fit)
#>  method     n_active j_pe stat_pe pval_pe  active_mediators
#>  Bonferroni 3        2325 2355    < 0.0001 3, 4, 5         
#>  BH         4        2863 2893    < 0.0001 2, 3, 4, 5      
#>  BY         3        2325 2355    < 0.0001 3, 4, 5         
d$active_mediators
#> [1] 1 2 3 4 5
# HBIC chose 0.05, the smallest value of the default grid, so the fit
# warned. On a grid that extends below it and is spaced more finely,
# seq(0.01, 10, length.out = 200), it chooses about 0.11, and the
# screens then identify 3 and 4 (Bonferroni) and 2, 3, and 4 (BH and BY):
# the identified active set depends on the grid as well as on the screen.