View source: R/mediation.test.minimax.R
mediation_test_minimax_BH | R Documentation |
Carries out the minimax optimal test of the composite null
"\delta_x \times \delta_y=0
" against its alternative
"\delta_x \times \delta_y\neq 0
" based on the test statistic in the
real plane, aiming for a control of false discovery rate à la
Benjamini-Hochberg.
mediation_test_minimax_BH(
t,
alpha = 0.05,
truncation = 0,
BH = c("statistics", "pval"),
sample_size = Inf,
K = 10L
)
t |
A |
alpha |
A positive |
truncation |
A nonnegative |
BH |
A |
sample_size |
A |
K |
An @details Suppose we are carrying out |
A list, consisting of:
a vector
of two
numeric
s, the test statistic, or a 'n x 2' matrix
of such
test statistics;
a numeric
, the false discovery
rate;
a nonnegative numeric
, used to bound
the rejection region away from the null hypothesis space
an integer
, the size of the sample used to
derive the test statistic
a vector
of
logical
s, FALSE
if the null hypothesis can be rejected
for the alternative at false discovery rate 'alpha' and TRUE
otherwise;
a vector
of numeric
s, the
original (conservative) p-values of the tests;
the
character
"minimax_BH",
a character
, either
'statistics' or 'pval', determining whether the Benjamini-Hochberg
testing procedure is based on the test statistics or on the
(conservative) p-values;
the integer
K used internally
to speed up the Benjamini-Hochberg procedure based on the test statistics.
mediation_test_minimax()
, upon which this function builds.
n <- 100
x <- MASS::mvrnorm(2 * n, mu = c(0, 0), Sigma = diag(c(1, 1)))
delta <- matrix(stats::runif(4 * n, min = -5, max = 5), ncol = 2)
epsilon <- stats::rbinom(n, size = 1, prob = 1/2)
delta <- delta * cbind(c(epsilon, rep(1, n)),
c(1 - epsilon, rep(1, n)))
x <- x + delta
mt_BH_stats <- mediation_test_minimax_BH(x, alpha = 1/20, BH = "statistics")
(sum(mt_BH_stats$decision))
mt_BH_pval <- mediation_test_minimax_BH(x, alpha = 1/20, BH = "pval")
(sum(mt_BH_pval$decision))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.