Learn R Programming

PresenceAbsence (version 1.1.11)

roc.plot.calculate: ROC Plot Calculations

Description

roc.plot.calculate calculates PCC, sensitivity, specificity, and Kappa for a single presence absence model at a series of thresholds in preparation for creating a ROC plot.

Usage

roc.plot.calculate(DATA, threshold = 101, which.model = 1, na.rm = FALSE)

Value

Returns a dataframe where:

[,1]thresholdthresholds used for each row in the table
[,2]PCCpercent correctly classified
[,3]sensitivity
[,4]specificity
[,5]Kappa

Arguments

DATA

a matrix or dataframe of observed and predicted values where each row represents one plot and where columns are:

DATA[,1]plot IDtext
DATA[,2]observed valueszero-one values
DATA[,3]predicted probabilities from first modelnumeric (between 0 and 1)
DATA[,4]predicted probabilities from second model, etc...

threshold

cutoff values between zero and one used for translating predicted probabilities into 0 /1 values, defaults to 0.5. It can be a single value between zero and one, a vector of values between zero and one, or a positive integer representing the number of evenly spaced thresholds to calculate.

which.model

a number indicating which model from DATA should be used

na.rm

a logical indicating whether missing values should be removed

Author

Elizabeth Freeman eafreeman@fs.fed.us

Details

roc.plot.calculate is a streamlined version of presence.absence.accuracy designed specifically to compute the accuracy measures needed to produce a ROC plot. roc.plot.calculate is less versatile, but more efficient than presence.absence.accuracy.

Unlike presence.absence.accuracy, roc.plot.calculate will only work for a single set of model predictions. Therefore either DATA can contain only one model prediction, or which.model must be used to indicate a single model prediction from DATA. By default, if DATA contains more than one model prediction, and which.model is not specified, roc.plot.calculate will use the first model prediction (e.g. DATA[,3]).

roc.plot.calculate was written as a sub-function for the plotting functions(i.e. error.threshold.plot, auc.roc.plot, but can be used on its own to produce a simple table of how the accuracy measures vary with choice of threshold.

To produce attractive plots requires a large number of thresholds. The default value of threshold = 101 is a good compromise between speed and resolution.

See Also

cmx, pcc, sensitivity, specificity, Kappa, presence.absence.accuracy, error.threshold.plot, auc.roc.plot

Examples

Run this code
data(SIM3DATA)

roc.plot.calculate(SIM3DATA,which.model=2)

Run the code above in your browser using DataLab