locfdr {locfdr}R Documentation

Computation of Local False Discovery Rates

Description

Compute local false discovery rates, following the definitions and description in Efron (2004) JASA, Volume 99, pages 96–104.

Usage

locfdr(zz, bre = 120, df = 7, pct = 1/1000, pct0 = 2/3, nulltype = 1,
type = 0, plot.fdr = FALSE, plot.density = FALSE, dev = dev.cur(),
lwd=2, col=c("blue", "red"))

Arguments

zz A vector of summary statistics, one for each case under simultaneous consideration. In a microarray experiment there would be one component of zz for each gene, perhaps a t-statistic comparing gene expression levels under two different conditions. The calculations assume a large number of cases, say at least length(zz) > 100.
bre Number of breaks in the discretization of the z-score axis, set to 120 by default. This can also be a vector of breakpoints fully describing the discretization.
df Number degrees of freedom for fitting the estimated density f(z), set to 7 by default.
pct Excluded tail proportions of zz's when fitting f(z); pct=1/1000 by default; pct=0 includes full range of zz's; pct can also be a 2-vector, describing the fitting range.
pct0 Included proportion of range used in fitting null density f0(z); default value is 2/3.
nulltype Type of null hypothesis assumed in estimating f0(z); 0 is theoretical null N(0,1) [which assumes that the original zz scores have been scaled to have a N(0,1) distribution under the null hypothesis]; 1 is the empirical null [which assumes a N(a,b) null hypothesis, with a=zmax and b=sig2 estimated from the central part of the f(z) fit]; 2 is a "split normal" version of 1 in which the f0(z) is allowed to have different scales on the two sides of the maximum.] The default is nulltype=1.
type Type of fitting used for f(z); 0 is a natural spline, 1 is a polynomial, in either case with degrees of freedom df [so total degrees of freedom df+1 including the intercept.] The default is type=0.
plot.fdr Whether an fdr plot is to be displayed. Default is FALSE.
plot.density Whether a plot of the two densities f0 and f is to be displayed. Defaul is FALSE.
dev The device used for plotting, by default the current device
lwd The width of the lines in the plot, default=2
col The colors used in the plot, default=c("blue", "red")

Value

A list with three components.

fdr the estimated local false discovery rates for each case
f0.p0 The estimated mean and variance(s) for f0(z) assuming nulltype 1 or 2, and also the estimated proportion p0 of null cases
mat A matrix summarizing the estimates of f(z), f0(z), fdr(z), etc. at the midpoints "z" of the break discretization. These are convenient for comparisons and plotting; mat includes fdr from nulltype 1 or 2 as specified, estimates of the usual tail-area False Discovery Rates, Fdrleft and Fdrright, and also fdrtheo and f0theo if nulltype=0 is specified.

Author(s)

Bradley Efron

References

Efron, B. (2004) Large-scale simultaneous hypothesis testing: the choice of a null hypothesis, JASA, Vol. 99, pp 96-104

Examples

## HIV data example
data(hivdata)
w <- locfdr(hivdata)
print(w)

## Second Simulation Example


[Package locfdr version 1.0-1 Index]