BH_mediation_test_minimax: Carries out the minimax optimal test of the composite null...

View source: R/mediation.test.minimax.R

BH_mediation_test_minimaxR 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.

Description

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.

Usage

BH_mediation_test_minimax(t, alpha = 0.05, truncation = 0, sample_size = Inf)

Arguments

t

A vector consisting of two numerics, the test statistic in the real plane, or a 'n x 2' matrix of such test statistics.

alpha

A positive numeric, the wished false discovery rate.

truncation

A nonnegative numeric used to bound the rejection region away from the null hypothesis space. Defaults to 0, in which case the rejection region is minimax optimal.

sample_size

An integer (larger than one), the size of the sample used to derive the test statistic. Defaults to 'Inf', meaning that, under the null hypothesis, the test statistic is drawn from the N_2(0,I_2) law. If the integer is finite, then, under the null hypothesis, the test statistic is drawn from the product of two Student laws with 'sample_size-1' degrees of freedom.

Details

For details, we refer to the technical report "Optimal Tests of the Composite Null Hypothesis Arising in Mediation Analysis", by Miles & Chambaz (2021), https://arxiv.org/abs/2107.07575

Value

A list, consisting of:

t:

a vector of two numerics, the test statistic, or a 'n x 2' matrix of such test statistics;

alpha:

a numeric, the false discovery rate;

truncation:

a nonnegative numeric, used to bound the rejection region away from the null hypothesis space

sample_size:

an integer, the size of the sample used to derive the test statistic

decision:

a vector of logicals, FALSE if the null hypothesis can be rejected for the alternative at false discovery rate 'alpha' and TRUE otherwise;

pval:

a vector of numerics, the p-values of the tests;

method:

the character "minimax+BH".

See Also

mediation_test_minimax(), upon which this function builds.

Examples

n <- 10
x <- MASS::mvrnorm(n, mu = c(0, 0), Sigma = diag(c(1, 1)))
delta <- matrix(stats::runif(2 * n, min = -3, max = 3), ncol = 2)
epsilon <- stats::rbinom(n, 1, 1/2)
delta <- delta * cbind(epsilon, 1 - epsilon)
x <- x + delta
(mt <- BH_mediation_test_minimax(x, alpha = 0.05))
plot(mt)


achambaz/mediation.test documentation built on Oct. 20, 2024, 9:25 a.m.