evaluate: Model evaluation

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/evaluate.R

Description

Cross-validation of models with presence/absence data. Given a vector of presence and a vector of absence values (or a model and presence and absence points and predictors), confusion matrices are computed (for varying thresholds), and model evaluation statistics are computed for each confusion matrix / threshold. See the description of class ModelEvaluation-class for more info.

Usage

1
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

...

Additional arguments for the predict function

Value

An object of ModelEvaluation-class

Author(s)

Robert J. Hijmans

References

Fielding, A.H. and J.F. Bell, 1997. A review of methods for the assessment of prediction errors in conservation presence/absence models. Environmental Conservation 24:38-49

See Also

threshold

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## See ?maxent for an example with real data.
# this is a contrived example:
# p has the predicted values for 50 known cases (locations) 
# with presence of the phenomenon (species)
p <- rnorm(50, mean=0.7, sd=0.3)
# b has the predicted values for 50 background locations (or absence)
a <- rnorm(50, mean=0.4, sd=0.4)
e <- evaluate(p=p, a=a)

threshold(e)

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

str(e)

Example output

Loading required package: raster
Loading required package: sp
               kappa spec_sens no_omission prevalence equal_sens_spec
thresholds 0.3500907 0.3500907  0.02986721  0.4975804       0.5715727
           sensitivity
thresholds    0.361494
Formal class 'ModelEvaluation' [package "dismo"] with 22 slots
  ..@ presence  : num [1:50] 0.429 0.943 0.744 0.934 0.448 ...
  ..@ absence   : num [1:50] 1.214 0.656 0.704 0.419 0.346 ...
  ..@ np        : int 50
  ..@ na        : int 50
  ..@ auc       : num 0.691
  ..@ pauc      : num(0) 
  ..@ cor       : Named num 0.34
  .. ..- attr(*, "names")= chr "cor"
  ..@ pcor      : num 0.000549
  ..@ t         : num [1:102] -0.601 -0.438 -0.23 -0.155 -0.074 ...
  ..@ confusion : int [1:102, 1:4] 50 50 50 50 50 50 50 50 50 49 ...
  .. ..- attr(*, "dimnames")=List of 2
  .. .. ..$ : NULL
  .. .. ..$ : chr [1:4] "tp" "fp" "fn" "tn"
  ..@ prevalence: num [1:102] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
  ..@ ODP       : num [1:102] 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 0.5 ...
  ..@ CCR       : num [1:102] 0.5 0.51 0.52 0.53 0.54 0.55 0.56 0.57 0.58 0.57 ...
  ..@ TPR       : num [1:102] 1 1 1 1 1 1 1 1 1 0.98 ...
  ..@ TNR       : num [1:102] 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.16 ...
  ..@ FPR       : num [1:102] 1 0.98 0.96 0.94 0.92 0.9 0.88 0.86 0.84 0.84 ...
  ..@ FNR       : num [1:102] 0 0 0 0 0 0 0 0 0 0.02 ...
  ..@ PPP       : num [1:102] 0.5 0.505 0.51 0.515 0.521 ...
  ..@ NPP       : num [1:102] NaN 1 1 1 1 ...
  ..@ MCR       : num [1:102] 0.5 0.49 0.48 0.47 0.46 0.45 0.44 0.43 0.42 0.43 ...
  ..@ OR        : num [1:102] NaN Inf Inf Inf Inf ...
  ..@ kappa     : num [1:102] 0 0.02 0.04 0.06 0.08 ...

dismo documentation built on May 29, 2017, 11:57 a.m.