View source: R/roc.plot.calculate.R
roc.plot.calculate | R Documentation |
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.
roc.plot.calculate(DATA, threshold = 101, which.model = 1, na.rm = FALSE)
DATA |
a matrix or dataframe of observed and predicted values where each row represents one plot and where columns are:
| ||||||||||||||||||||||||
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 | ||||||||||||||||||||||||
na.rm |
a logical indicating whether missing values should be removed |
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.
Returns a dataframe where:
[,1] | threshold | thresholds used for each row in the table |
[,2] | PCC | percent correctly classified |
[,3] | sensitivity | |
[,4] | specificity | |
[,5] | Kappa |
Elizabeth Freeman eafreeman@fs.fed.us
cmx, pcc, sensitivity, specificity, Kappa, presence.absence.accuracy, error.threshold.plot, auc.roc.plot
data(SIM3DATA) roc.plot.calculate(SIM3DATA,which.model=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.