Learn R Programming

fdrtool (version 1.1.0)

fdrtool: Estimate (Local) False Discovery Rates For Diverse Test Statistics

Description

fdrtool takes a vector of z-scores (or of correlations, p-values, or t-statistics), and estimates for each case both the tail area-based Fdr as well as the density-based fdr (=q-value resp. local false discovery rate). The parameters of the null distribution are estimated adaptively from the data (except for the case of p-values where this is not necessary).

Usage

fdrtool(x, statistic=c("normal", "correlation", "pvalue", "studentt"),
  plot=TRUE, censored.fit.arg=NULL, pval.estimate.eta0.arg=NULL)

Arguments

x
vector of the observed test statistics.
statistic
one of ""normal" (default), "correlation", "pvalue", "studentt". This species the null model.
plot
plot a figure with estimated densities, distribution functions, and (local) false discovery rates.
censored.fit.arg
list with arguments passed on to censored.fit.
pval.estimate.eta0.arg
list with arguments passed on to pval.estimate.eta0.

Value

  • A list with the following components:
  • pvala vector with p-values for each case.
  • qvala vector with q-values (Fdr) for each case.
  • lfdra vector with local fdr values for each case.
  • statisticthe specified type of null model.
  • parama vector containing the estimated parameters (the null proportion eta0 and the free parameter of the null model).

Details

The algorithm implemented in this function proceeds as follows:

  1. The parameters of the null model are estimated from the data usingcensored.fit.
  2. Subsequently the corresponding p-values are computed.
  3. The proportion of null-p-valueseta0is estimated usingpval.estimate.eta0.
  4. A modifiedgrenanderalgorithm is employed to obtain the overall density and distribution function (note that this respects the estimatedeta0).
  5. Finally, q-values and local fdr values are computed for each case.

The assumed null models all have (except for p-values) one free scale parameter. Note that the z-scores are assumed to have zero mean.

See Also

pval.estimate.eta0, censored.fit.

Examples

Run this code
# load "fdrtool" library and p-values
library("fdrtool")
data(pvalues)


# estimate fdr and Fdr from p-values

data(pvalues)
fdr <- fdrtool(pvalues, statistic="pvalue")
fdr$qval # estimated Fdr values 
fdr$lfdr # estimated local fdr 


# estimate fdr and Fdr from z-scores

sd.true = 2.232
n = 500
z = rnorm(n, sd=sd.true)
z = c(z, runif(30, 5, 10)) # add some contamination
fdr <- fdrtool(z)

# you may change some parameters of the underlying functions
fdr <- fdrtool(z, censored.fit.arg=list( pct=.9))

Run the code above in your browser using DataLab