kernel {DiscreteFDR}R Documentation

Kernel functions

Description

[Deprecated]

Kernel functions that transform observed p-values or their support according to [HSU], [HSD], [AHSU], [AHSD] and [HBR-\lambda]. The output is used by discrete.BH or DBR, respectively. kernel_DBH_crit, kernel_ADBH_crit and kernel_DBR_crit additionally compute and return the critical constants. The end user should not use these functions directly.

Note: In future versions, these functions will no longer be exported to the global namespace. Instead, they will be purely internal functions and will have to be called directly via :::, e.g. DiscreteFDR:::kernel_DBH_fast().

Usage

kernel_DBH_fast(pCDFlist, pvalues, stepUp = FALSE, alpha = 0.05, support = 0L)

kernel_DBH_crit(pCDFlist, pvalues, sorted_pv, stepUp = FALSE, alpha = 0.05)

kernel_ADBH_fast(pCDFlist, pvalues, stepUp = FALSE, alpha = 0.05, support = 0L)

kernel_ADBH_crit(pCDFlist, pvalues, sorted_pv, stepUp = FALSE, alpha = 0.05)

kernel_DBR_fast(pCDFlist, pvalues, lambda = 0.05)

kernel_DBR_crit(pCDFlist, pvalues, sorted_pv, lambda = 0.05, alpha = 0.05)

Arguments

pCDFlist

a list of the supports of the CDFs of the p-values. Each support is represented by a vector that must be in increasing order.

pvalues

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 sorted in increasing order!

stepUp

a numeric vector. Identical to pvalues 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. For *.fast kernels, it is only necessary, if stepUp = TRUE.

support

a numeric vector. Contains all values of the p-values supports. Ignored, if stepUp = FALSE. Must be sorted in increasing order!

sorted_pv

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

lambda

a number strictly between 0 and 1. If lambda=NULL (by default), then lambda is chosen equal to alpha.

Details

When computing critical constants under step-down, that is, when using kernel_DBH_crit, kernel_ADBH_crit or kernel_DBR_crit with stepUp = FALSE (i.e. the step-down case), we still need to get transformed p-values to compute the adjusted p-values.

Value

For kernel.DBH.fast, kernel.ADBH.fast and kernel.DBR.fast, a vector of transformed p-values is returned. kernel.DBH.crit, kernel.ADBH.crit kernel.DBR.crit return a list with critical constants (⁠$crit.consts⁠) and transformed p-values (⁠$pval.transf⁠), but if stepUp = FALSE, there are critical values only.

See Also

discrete.BH, fast.Discrete, DBR

Examples

X1 <- c(4, 2, 2, 14, 6, 9, 4, 0, 1)
X2 <- c(0, 0, 1, 3, 2, 1, 2, 2, 2)
N1 <- rep(148, 9)
N2 <- rep(132, 9)
Y1 <- N1 - X1
Y2 <- N2 - X2
df <- data.frame(X1, Y1, X2, Y2)
df

#Construction of the p-values and their support
df.formatted <- fisher.pvalues.support(counts = df, input = "noassoc")
raw.pvalues <- df.formatted$raw
pCDFlist <- df.formatted$support

alpha <- 0.05

# Compute the step functions from the supports

# 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.DBH.fast <- kernel_DBH_fast(pCDFlist, sorted.pvals)
y.ADBH.fast <- kernel_ADBH_fast(pCDFlist, sorted.pvals)
# transformed values
y.DBH.fast
y.ADBH.fast

# compute transformed support
pv.list <- sort(unique(unlist(pCDFlist)))
y.DBH.crit <- kernel_DBH_crit(pCDFlist, pv.list, sorted.pvals)
y.ADBH.crit <- kernel_ADBH_crit(pCDFlist, pv.list, sorted.pvals)
y.DBR.crit <- kernel_DBR_crit(pCDFlist, pv.list, sorted.pvals)
# critical constants
y.DBH.crit$crit.consts
y.ADBH.crit$crit.consts
y.DBR.crit$crit.consts
# The following exist only for step-down direction or DBR
y.DBH.crit$pval.transf
y.ADBH.crit$pval.transf
y.DBR.crit$pval.transf


[Package DiscreteFDR version 1.3.7 Index]