kernel {DiscreteFDR} | R Documentation |
Kernel Functions
Description
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: As of version 2.0, these functions are purely internal functions!
As a consequence, they have to be called directly via :::
, e.g.
DiscreteFDR:::kernel_DBH_fast()
. But users should not rely on them, as
parameters (including their names, order, etc.) may be changed without
notice!
Usage
kernel_DBH_fast(
pCDFlist,
pvalues,
stepUp = FALSE,
alpha = 0.05,
support = numeric(),
pCDFcounts = NULL
)
kernel_DBH_crit(
pCDFlist,
support,
sorted_pv,
stepUp = FALSE,
alpha = 0.05,
pCDFcounts = NULL
)
kernel_ADBH_fast(
pCDFlist,
sorted_pv,
stepUp = FALSE,
alpha = 0.05,
support = numeric(),
pCDFcounts = NULL
)
kernel_ADBH_crit(
pCDFlist,
support,
sorted_pv,
stepUp = FALSE,
alpha = 0.05,
pCDFcounts = NULL
)
kernel_DBR_fast(pCDFlist, sorted_pv, lambda = 0.05, pCDFcounts = NULL)
kernel_DBR_crit(
pCDFlist,
support,
sorted_pv,
lambda = 0.05,
alpha = 0.05,
pCDFcounts = NULL
)
Arguments
pCDFlist |
list of the supports of the CDFs of the p-values; each list item must be a numeric vector, which is sorted in increasing order and whose last element equals 1. |
pvalues |
numeric vector, sorted in increasing order, that either must contain the entirety of all observable values of the p-value supports (when computing critical constants) or only the sorted raw p-values. |
stepUp |
boolean specifying whether to conduct the step-up ( |
alpha |
single real number strictly between 0 and 1 indicating the target FDR level; for |
support |
numeric vector, sorted in increasing order, that contains the entirety of all observable values of the p-value supports; for |
pCDFcounts |
integer vector of counts that indicates to how many p-values each unique p-value distributions belongs. |
sorted_pv |
numeric vector containing the raw p-values, sorted in increasing order. |
lambda |
real number strictly between 0 and 1 specifying the DBR tuning parameter. |
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
## Not run:
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
# Compute p-values and their supports of Fisher's exact test
test.result <- generate.pvalues(df, "fisher")
raw.pvalues <- test.result$get_pvalues()
pCDFlist <- test.result$get_pvalue_supports()
alpha <- 0.05
# Compute the step functions from the supports
# If not searching for critical constants, we use only the observed p-values
sorted.pvals <- sort(raw.pvalues)
y.DBH.sd.fast <- kernel_DBH_fast(pCDFlist, sorted.pvals)
y.ADBH.sd.fast <- kernel_ADBH_fast(pCDFlist, sorted.pvals)
y.DBR.fast <- kernel_DBR_fast(pCDFlist, sorted.pvals)
# transformed values
y.DBH.sd.fast
y.ADBH.sd.fast
y.DBR.fast
# compute transformed support
pv.list <- sort(unique(unlist(pCDFlist)))
y.DBH.sd.crit <- kernel_DBH_crit(pCDFlist, pv.list, sorted.pvals)
y.ADBH.sd.crit <- kernel_ADBH_crit(pCDFlist, pv.list, sorted.pvals)
y.DBR.crit <- kernel_DBR_crit(pCDFlist, pv.list, sorted.pvals)
# critical constants
y.DBH.sd.crit$crit.consts
y.ADBH.sd.crit$crit.consts
y.DBR.crit$crit.consts
# The following exist only for step-down direction or DBR
y.DBH.sd.crit$pval.transf
y.ADBH.sd.crit$pval.transf
y.DBR.crit$pval.transf
## End(Not run)