Learn R Programming

wrMisc (version 1.2.3)

pVal2lfdr: Convert p-values to lfdr

Description

This function takes a numeric vector of p-values and returns a vector of lfdr-values (local false discovery) using the package fdrtool. Multiple testing correction should be performed with caution, short series of p-values typically pose problems for transforming to lfdr. The transformation to lfdr values may give warning messages, in this case the resultant lfdr values may be invalid !

Usage

pVal2lfdr(x, silent = TRUE, callFrom = NULL)

Arguments

x

(numeric) vector of p.values

silent

(logical) suppres messages

callFrom

(character) allow easier tracking of message(s) produced

Value

(numeric) vector of lfdr values (or NULL if data insufficient to run the function 'fdrtool')

See Also

lfdr from fdrtool, other p-adjustments (multiple test correction, eg FDR) in p.adjust

Examples

Run this code
# NOT RUN {
## Note that this example is too small for estimating really meaningful fdr values
## In consequence, a warning will be issued.
set.seed(2017); t8 <- matrix(round(rnorm(160,10,0.4),2), ncol=8,
  dimnames=list(letters[1:20], c("AA1","BB1","CC1","DD1","AA2","BB2","CC2","DD2")))
t8[3:6,1:2] <- t8[3:6,1:2]+3   # augment lines 3:6 (c-f) for AA1&BB1
t8[5:8,5:6] <- t8[5:8,5:6]+3   # augment lines 5:8 (e-h) for AA2&BB2 (c,d,g,h should be found)
head(pVal2lfdr(apply(t8, 1, function(x) t.test(x[1:4], x[5:8])$p.value)))
# }

Run the code above in your browser using DataLab