Learn R Programming

FDRestimation (version 1.0.0)

p.fdr: FDR Computation

Description

This function computes FDRs and Method Adjusted p-values.

Usage

p.fdr(
  pvalues,
  zvalues = "two.sided",
  threshold = 0.05,
  adjust.method = "BH",
  BY.corr = "positive",
  just.fdr = FALSE,
  default.odds = 1,
  estim.method = "set.pi0",
  set.pi0 = 1,
  hist.breaks = "scott",
  ties.method = "random",
  sort.results = FALSE,
  na.rm = TRUE
)

Arguments

pvalues

A numeric vector of raw p-values.

zvalues

A numeric vector of z-values to be used in pi0 estimation or a string with options "two.sided", "greater" or "less". Defaults to "two.sided".

threshold

A numeric value in the interval [0,1] used in a multiple comparison hypothesis tests to determine significance from the null. Defaults to 0.05.

adjust.method

A string used to identify the p-value and false discovery rate adjustment method. Defaults to BH. Options are BH, BY, codeBon,Holm, Hoch, and Sidak.

BY.corr

A string of either "positive" or "negative" to determine which correlation is used in the BY method. Defaults to positive.

just.fdr

A Boolean TRUE or FALSE value which output only the FDR vector instead of the list output. Defaults to FALSE.

default.odds

A numeric value determining the ratio of pi1/pi0 used in the computation of one FDR. Defaults to 1.

estim.method

A string used to determine which method is used to estimate the null proportion or pi0 value. Defaults to set.pi0.

set.pi0

A numeric value to specify a known or assumed pi0 value in the interval [0,1]. Defaults to 1. Which means the assumption is that all inputted raw p-values come from the null distribution.

hist.breaks

A numeric or string variable representing how many breaks are used in the pi0 estimation histogram methods. Defaults to "scott".

ties.method

A string a character string specifying how ties are treated. Options are "first", "last", "average", "min", "max", or "random". Defaults to "random".

sort.results

A Boolean TRUE or FALSE value which sorts the output in either increasing or non-increasing order dependent on the FDR vector. Defaults to FALSE.

na.rm

A Boolean TRUE or FALSE value indicating whether NA's should be removed from the inputted raw p-value vector before further computation. Defaults to TRUE.

Value

A list containing the following components:

fdrs

A numeric vector of method adjusted FDRs.

Results Matrix

A numeric matrix of method adjusted FDRs, method adjusted p-values, and raw p-values.

Reject Vector

A vector containing Reject.H0 and/or FTR.H0 based off of the threshold value and hypothesis test on the adjusted p-values.

pi0

A numeric value for the pi0 value used in the computations.

threshold

A numeric value for the threshold value used in the hypothesis tests.

Adjustment Method

The string with the method name used in computation(needed for the plot.fdr function).

Details

We run into errors or warnings when pvalues, zvalues, threshold, set.pi0, BY.corr, or default.odds are not inputted correctly.

References

Rpack:bibtexRdpack

RFDRestimation

efron:2013FDRestimation

bh:1995FDRestimation

shaffer:1995FDRestimation

wach:2004FDRestimation

storey:2003FDRestimation

by:2001FDRestimation

mein:2006FDRestimation

jiang:2008FDRestimation

nett:2006FDRestimation

pounds:2003FDRestimation

holm:1979FDRestimation

bon:1936FDRestimation

hoch:1988FDRestimation

sidak:1967FDRestimation

murray2020falseFDRestimation

See Also

plot.p.fdr, summary.p.fdr, get.pi0

Examples

Run this code
# NOT RUN {
# Example 1
pi0 = 0.8
pi1 = 1-pi0
n = 10000
n.0 = ceiling(n*pi0)
n.1 = n-n.0

sim.data = c(rnorm(n.1,3,1),rnorm(n.0,0,1))
sim.data.p = 2*pnorm(-abs(sim.data))

fdr.output = p.fdr(pvalues=sim.data.p, adjust.method="BH")

fdr.output$fdrs
fdr.output$pi0

# Example 2

sim.data.p = output = c(runif(800),runif(200, min=0, max=0.01))
fdr.output = p.fdr(pvalues=sim.data.p, adjust.method="Holm", sort.results = TRUE)

fdr.output$`Results Matrix`

# }

Run the code above in your browser using DataLab