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)
a matrix or dataframe of observed and predicted values where each row represents one plot and where columns are:
DATA[,1] |
plot ID | text | |||
DATA[,2] |
observed values | zero-one values | |||
DATA[,3] |
predicted probabilities from first model | numeric (between 0 and 1) |
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.
a number indicating which model from DATA
should be used
a logical indicating whether missing values should be removed
Returns a dataframe where:
[,1] | threshold |
thresholds used for each row in the table |
[,2] | PCC |
percent correctly classified |
[,3] | sensitivity |
|
[,4] | specificity |
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.
cmx, pcc, sensitivity, specificity, Kappa, presence.absence.accuracy, error.threshold.plot, auc.roc.plot
# NOT RUN {
data(SIM3DATA)
roc.plot.calculate(SIM3DATA,which.model=2)
# }
Run the code above in your browser using DataLab