Learn R Programming

MIAmaxent (version 1.3.1)

testAUC: Calculate model AUC with test data.

Description

For a given model, testAUC calculates the Area Under the Curve (AUC) of the Receiver Operating Characteristic (ROC) as a threshold-independent measure of binary classification performance. This function is intended to be used with occurrence data that is independent from the data used to train the model, to obtain an unbiased measure of model performance.

Usage

testAUC(model, transformations, data, plot = TRUE, ...)

Arguments

model

The model to be projected. This may be the object returned by chooseModel, or the 'selectedmodel' returned by selectEV.

transformations

Transformation functions used to create the derived variables in the model. I.e. the 'transformations' returned by deriveVars. Equivalently, the full file pathway of the 'transformations.Rdata' file saved as a result of deriveVars.

data

Data frame containing test occurrence data in the first column and corresponding explanatory variables in the model in subsequent columns. The test data should be coded as: 1/0/NA, representing presence, absence, and uninformed. See readData.

plot

Logical. Plot the ROC curve?

...

Arguments to be passed to plot to control the appearance of the ROC plot. For example:

  • lwd for line width

  • main for plot title

  • cex for plot text and symbol size

Note that some graphical parameters may return errors or warnings if they cannot be changed or correspond to multiple elements in the plot.

Details

If plotted, the point along the ROC curve where the discrimination threshold is PRO = 1, is shown for reference.

Examples

Run this code
if (FALSE) {
# From vignette:
grasslandPA <- readData(
  occurrence = system.file("extdata", "occurrence_PA.csv", package="MIAmaxent"),
  contEV = system.file("extdata", "EV_continuous", package="MIAmaxent"),
  catEV = system.file("extdata", "EV_categorical", package="MIAmaxent"),
  PA = TRUE, XY = TRUE)
head(grasslandPA)
tail(grasslandPA)
testAUC(model = grasslandmodel, transformations = grasslandDVs$transformations,
        data = grasslandPA)
}

Run the code above in your browser using DataLab