Skip to contents

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

mediation_test_minimax_BH(
  t,
  alpha = 0.05,
  truncation = 0,
  BH = c("statistics", "pval"),
  sample_size = Inf,
  K = 10L
)

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.

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.

sample_size

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

K

An integer (10 by default) used internally to speed up the Benjamini-Hochberg testing procedure when it is based on the test statistics (more details in the Details section). Must be smaller than 'nrow(t)'.

@details Suppose we are carrying out \(J\) tests. Starting from \(j=1\), we increment \(j\) until fewer than \(j\) null hypotheses are rejected at level \(\alpha\times j/J\) for K consecutive iterations. Eventually, we reject all null hypotheses at level \(\alpha \times jj/J\), where \(jj\) is the largest integer so far for which at least \(jj\) null hypotheses are rejected at this level. For further 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

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 original (conservative) p-values of the tests;

method:

the character "minimax_BH",

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;

K:

the integer K used internally to speed up the Benjamini-Hochberg procedure based on the test statistics.

See also

mediation_test_minimax(), upon which this function builds.

Examples

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))
#> [1] 24
mt_BH_pval <- mediation_test_minimax_BH(x, alpha = 1/20, BH = "pval")
(sum(mt_BH_pval$decision))
#> [1] 11