Learn R Programming

SDMTools (version 1.1-221)

accuracy: Measures of Model Accuracy

Description

accuracy estimates six measures of accuracy for presence-absence or presence-psuedoabsence data. These include AUC, ommission rates, sensitivity, specificity, proportion correctly identified and Kappa. Note: this method will exclude any missing data.

Usage

accuracy(obs, pred, threshold = 0.5)

Arguments

obs
a vector of observed values which must be 0 for absences and 1 for occurrences
pred
a vector of the same length as obs representing the predicted values. Values must be between 0 & 1 prepresenting a likelihood.
threshold
this can be: a) a single value representing a single threshold between 0 & 1; b) a vector of threshold values between 0 & 1; OR c) an integer value representing the number of equal interval threshold values between 0 & 1

Value

a data.frame with seven columns:
threshold
the threshold values representing each row of data
AUC
the AUC given the defined threshold value
ommission.rate
the ommission rate as a proportion of true occurrences misidentified given the defined threshold value
sensitivity
the sensitivity given the defined threshold value
specificity
the specificity given the defined threshold value
prop.correct
the proportion of the presence and absence records correctly identified given the defined threshold value
Kappa
the Kappa statistic of the model given the defined threshold value

See Also

auc, Kappa, omission, sensitivity, specificity, prop.correct, confusion.matrix

Examples

Run this code
#create some data
obs = c(sample(c(0,1),20,replace=TRUE),NA); obs = obs[order(obs)]
pred = runif(length(obs),0,1); pred = pred[order(pred)]

#calculate accuracy of the model with a single threshold value
accuracy(obs,pred,threshold=0.5)

#calculate accuracy given several defined thresholds
accuracy(obs,pred,threshold=c(0.33,0.5,0.66))

#calculate accuracy given a number of equal interval thresholds
accuracy(obs,pred,threshold=20)

Run the code above in your browser using DataLab