DiscreteFDR (version 1.0)

kernel.ADBH: Kernel functions for ADBH

Description

Kernel functions that transform observed p-values or their support according to [AHSU] and [AHSD]. The output is used by ADBH. Additionally, kernel.ADBH.crit computes and returns the critical constants. The end user should not use them.

Usage

kernel.ADBH.crit(msg = "", stepf, pv.numer, pv.denom, alpha, sorted.pv,
  bigMem = FALSE, verbose = TRUE)

kernel.ADBH.fast(msg = "", stepf, pv.numer, pv.denom, bigMem = FALSE, verbose = TRUE)

Arguments

msg

a character string to be displayed if verbose=TRUE.

stepf

a list of the CDFs under the null hypothesis of each p-value.

pv.numer

a numeric vector. Contains all values of the p-values supports if we search for the critical constants. If not, contains only the observed p-values. Must be in increasing order.

pv.denom

a numeric vector. Identical to pv.numer for a step-down procedure. Equals c.m for a step-up procedure.

alpha

the target FDR level, a number strictly between 0 and 1.

sorted.pv

a vector of observed p-values, in increasing order.

bigMem

a boolean. If TRUE, the code uses matrixes and functions of the apply family as far as possible (faster for small number of hypotheses and support size, but slower otherwise due to memory management overhead). If FALSE, computations are done with for loops and chunks to conserve memory.

verbose

a boolean indicating if msg must be printed. Used when bigMem=TRUE, to print messages informing if in-memory computation was successful or if loops and chunks were used as fallback.

Value

For kernel.ADBH.crit, a list which elements are:

crit.consts

a vector of critical constants

pval.transf

a vector of transformed p-values (only for step-down direction).

For kernel.ADBH.fast, a vector of transformed p-values.

Details

When computing critical constants under step-down, that is, when using kernel.ADBH.crit with pv.numer=pv.denom, we still need to get transformed p-values to compute the adjusted p-values. Also, note that here the critical constants are computed by the kernel function and not by the principal function ADBH, contrary to what happens with DBH. This is why sorted.pv is needed.

This version: 2018-02-20.

See Also

ADBH, DiscreteFDR, kernel.DBH, DBH

Examples

Run this code
# NOT RUN {
data(amnesia)

#We only keep the first 100 lines to keep the computations fast.
amnesia<-amnesia[1:100,]

#Construction of the p-values and their support
amnesia.formatted <- fisher.pvalues.support(amnesia)
raw.pvalues <- amnesia.formatted$raw
pCDFlist <- amnesia.formatted$support

m <- length(raw.pvalues)
alpha <- 0.05

#Compute the step functions from the supports
stepf <- build.stepfuns(pCDFlist)

#We stay in a step-down context, where pv.numer=pv.denom,
#for the sake of simplicity

#If not searching for critical constants, we use only the observed p-values
sorted.pvals <- sort(raw.pvalues)
y <- kernel.ADBH.fast("", stepf, sorted.pvals, sorted.pvals)

#If searching for critical constants, we use (almost) the complete support
pv.list.all <- unique(sort(as.numeric(unlist(pCDFlist))))
# apply the shortcut drawn from Lemma 4, that is
# c.1 >= the effective critical value associated to alpha/(m + alpha)
pv.list<-short.eff(pv.list.all, alpha/(m + alpha) )
# then re-add the observed p-values (needed to compute the adjusted p-values),
# because we may have removed some of them the shortcut
pv.list <- sort(unique(c(pv.list, sorted.pvals)))
# compute transformed support
y <- kernel.ADBH.crit("", stepf, pv.list, pv.list, alpha, sorted.pvals)
crit.constants <- y$crit.consts
#The following exists only for step-down direction
transformed.pvalues <- y$pval.transf

# }

Run the code above in your browser using DataCamp Workspace