dismo (version 0.5-6)

evaluate: Model testing

Description

Model testing for models predicting presence/absence. Given a vector of presence and a vector of absence values (or a model and presence and absence points and predictors), a number of confusion matrices is computed (for varying thresholds), and model evaluation statistics are computed for each confusion matrix / threshold.

Usage

evaluate(p, a, model, x, tr)

Arguments

p
presence points (x and y coordinates or SpatialPoints* object). Or, if x is missing, values at presence points Or, a matrix with values to compute predictions for
a
absence points (x and y coordinates or SpatialPoints* object). Or, if x is missing, values at presence points. Or, a matrix with values to compute predictions for
model
any fitted model, including objects inherting from 'DistModel'; not used when x is missing
x
Optional. Predictor variables (object of class Raster*). If present, p and a are interpreted as (spatial) points
tr
Optional. a vector of threshold values to use for computing the confusion matrices

Value

  • An object of class ModelEvaluation

Examples

Run this code
# p = the predicted value for 50 known cases (locations) with presence of the phenomenon (species)
p = rnorm(50, mean=0.7, sd=0.3)
# b = the predicted value for 50 known cases (locations) with absence of the phenomenon (species)
a = rnorm(50, mean=0.4, sd=0.4)
e = evaluate(p=p, a=a)

# threshold at maximum kappa
e@t[which.max(e@kappa)]

# threshold at maximum of the sum of the sensitivity (true positive rate) and specificity (true negative rate)
e@t[which.max(e@TPR + e@TNR)]

plot(e, 'ROC')
plot(e, 'TPR')
boxplot(e)
density(e)

Run the code above in your browser using DataCamp Workspace