precREC-methods: Achieved precision versus recall plot

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Calculate and plot achieved precision versus recall using adjusted p-values (padj) and known true positives (labels).

Usage

1
2
3
4
5
6
7
8
precREC(object, padj, ...)

## S4 method for signature 'SimResults,missing'
precREC(object, threshold=c(0.99, 0.95, 0.9),  transformation="1-x", plot=TRUE, ...)
## S4 method for signature 'missing,ANY'
precREC(padj, labels, threshold=c(0.99, 0.95, 0.9),  transformation="1-x", plot=TRUE, ...)
## S4 method for signature 'SimResultsList,missing'
precREC(object, threshold=c(0.99, 0.95, 0.9),  transformation="1-x", plot=TRUE, ...)

Arguments

object

An object of SimResults.

padj

A vector or matrix containing the adjusted p-value.

labels

A numeric vector indicating class labels (positives with 1, negatives with 0). For more details, see ?ROCR::prediction.

threshold

Numeric value of the adjusted p-value threshold (cutoff), or vector of multiple thresholds, used to determine the significance of tests.

transformation

The transformation of pval and padj. The default setting "1-x" means 1-pval(padj). Note that another useful transformation is "-log10(x)".

plot

Logical, should precision-recall values be plotted.

...

Optional arguments for plotting (see below for more details).

  • col, cex and other general graphical parameters from par can be directly used into the figure.

  • point.type are special parameters of precision-recall values (see details below).

  • lwd.threshold, lty.threshold and col.threshold are special parameters referred to the lines drawn for threshold (see details below).

  • add, logical, whether the new plot added to current one or not.

  • legend, a list or NULL, is used to add legends to plots (see details below).

Details

The function precREC calculates the achieved precision (positive predictive value (PPV) or 1-FDR) and recall (true positive rate (TPR)) given a particular threshold, control precision. Several thresholds can be assessed simultaneously (e.g., threshold=c(0.99,0.98,0.97,0.96,0.95)).

Most of the graphical parameters such as col, cex, pch and etc from par, can be directly passed to plot for precision-recall values. point.type, letter indicating how precision-recall values should be plotted: "b" for both points and lines; "p" for points only; and "l" for lines only. col.line and lwd.line, col and lwd of line connecting precision-recall points, if point.type is either "b" or "l". lwd.threshold, lty.threshold and col.threshold are lwd, lty and col referred to the lines drawn for 'threshold'.

The precision is considered to be controlled if the precision (1-FDR) falls above the threshold it is assessed at, and precision-recall points are filled-in. precision-recall points are unfilled, or empty, if the precision is not controlled and is equal to or less than the cutoff it is assessed at. Note that the fill-unfill option is only compatible with pch values of 21 to 25. Visually, this means that for a given threshold, a point (of the same color) will be filled if it falls left of the threshold line, and will be unfilled if it sits to the right of the threshold line.

To increase the flexibility of plots, you can use argument add. If add=TRUE, plots are added to current one combining different rocX curves together into one figure.

legend is a list including all the arguments from function legend (see help(legend)). If it is NULL, do not add legends to plots.

If input is an SimResultsList object, the average performance would be plotted (see example 3).

Value

Invisibly, an S4 object of class precREC-class containing the threshold value(s) assessed, and the associated precision, achieved precision, PREC, and true positive rates, TPR.

Author(s)

Xiaobei Zhou and Mark D. Robinson

See Also

SimResults, rocX

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# example1
data(Pickrell)
re <- SimResults(pval=Pickrell$pval, labels=Pickrell$labels)
p <- precREC(re, plot=TRUE)
p <- precREC(re, plot=TRUE, legend=NULL)
plot(p, cex=2, pch=c(23,25), col=1:3, main="precREC plot", 
     lwd.line=2, cex.axis=1.5, col.threshold=4, lwd.threshold=2)

# example2
data(calibration)
padj <- calibration$padj
labels <- calibration$labels
precREC(padj=padj, labels=labels, xlim=c(0,.3))


# example3
data(PickrellList)
rel <- SimResultsList()
for(i in 1:5)
    rel[[i]] <- SimResults(pval=PickrellList[[i]]$pval, labels=PickrellList[[i]]$labels)
powerFDR(rel)

markrobinsonuzh/benchmarkR documentation built on May 21, 2019, 12:24 p.m.