View source: R/mediation.test.Bayes.R
mediation_test_Bayes | R Documentation |
Carries out the Bayes risk 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.
mediation_test_Bayes(t, map, truncation = 0)
t |
A |
map |
The "map" of rejection probabilities – the 'map' item of the
output of function |
truncation |
A nonnegative |
For details, we refer to the technical report "Optimal Tests of the Composite Null Hypothesis Arising in Mediation Analysis", by Miles & Chambaz (2024), https://arxiv.org/abs/2107.07575
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 type-I error;
a nonnegative numeric
, used to bound the
rejection region away from the null hypothesis space
a vector
of logical
s, FALSE
if
the null hypothesis can be rejected for the alternative at level
'alpha' and TRUE
otherwise;
a vector
of
numeric
s, the p-values of the tests, 'NA' in this case;
the character
"Bayes";
The "map" of
rejection probabilities – the 'map' item of the output of function
compute_map_rejection_probs
.
n <- 10
x <- MASS::mvrnorm(2 * n, mu = c(0, 0), Sigma = diag(c(1, 1)))
delta <- matrix(stats::runif(4 * n, min = -3, max = 3), ncol = 2)
epsilon <- stats::rbinom(n, 1, 1/2)
delta <- delta * cbind(c(epsilon, rep(1, n)),
c(1 - epsilon, rep(1, n)))
x <- x + delta
(mt_01_0.05 <- mediation_test_Bayes(x, map = map_01_0.05))
plot(mt_01_0.05)
(mt_quad_0.05_0.1 <- mediation_test_Bayes(x, map = map_quad_0.05_0.1))
plot(mt_quad_0.05_0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.