Learn R Programming

WVPlots (version 1.3.7)

PRPlot: Plot Precision-Recall plot.

Description

Plot Precision-Recall plot.

Usage

PRPlot(frame, xvar, truthVar, truthTarget, title, ..., estimate_sig = FALSE)

Arguments

frame

data frame to get values from

xvar

name of the independent (input or model) column in frame

truthVar

name of the dependent (output or result to be modeled) column in frame

truthTarget

value we consider to be positive

title

title to place on plot

...

no unnamed argument, added to force named binding of later arguments.

estimate_sig

logical, if TRUE compute significance

Details

See https://www.nature.com/articles/nmeth.3945 for a discussion of precision and recall, and how the precision/recall plot relates to the ROC plot.

In addition to plotting precision versus recall, PRPlot reports the best achieved F1 score, and plots an isoline corresponding to that F1 score.

See Also

ROCPlot

Examples

Run this code

if (requireNamespace('data.table', quietly = TRUE)) {
	# don't multi-thread during CRAN checks
		data.table::setDTthreads(1)
}

set.seed(34903490)
x = rnorm(50)
y = 0.5*x^2 + 2*x + rnorm(length(x))
frm = data.frame(x=x,y=y,yC=y>=as.numeric(quantile(y,probs=0.8)))
frm$absY <- abs(frm$y)
frm$posY = frm$y > 0
frm$costX = 1
WVPlots::PRPlot(frm, "x", "yC", TRUE, title="Example Precision-Recall plot")

Run the code above in your browser using DataLab