Evaluate a model

  collapse = TRUE,
  comment = "#>"
options(knitr.table.format = "html")
default_model <- SDMtune:::bm_maxent
files <- list.files(path = file.path(system.file(package = "dismo"), "ex"), pattern = "grd", full.names = TRUE)
predictors <- raster::stack(files)


In the previous articles you have learned how to prepare the data for the analysis, how to train a model and how to make predictions using SDMtune. In this article you will learn how to evaluate your model using three different metrics.

SDMtune implements three evaluation metrics:

We will compute the value of the metrics on the training dataset, using the default model that we trained in a previous article.


As usually we first load the SDMtune package:


The AUC can be calculated using the function auc():


We can also plot the ROC curve using the function plotROC():



The TSS is computed with the function tss():



For the AICc we use the function aicc(). In this case we need to pass to the env argument the 'predictors' raster stack object that we created in the first article:

aicc(default_model, env = predictors)

Try yourself

Try to compute the three metrics using a model trained using the Maxnet method.


In this article you have learned:

In the next article you will learn two different strategies that can be used to correctly evaluate the model performance.


Try the SDMtune package in your browser

Any scripts or data that you put into this service are public.

SDMtune documentation built on July 17, 2021, 9:06 a.m.