testAUC: Calculate model AUC with test data.

Description Usage Arguments Details Examples

View source: R/testAUC.R

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

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

Arguments

model

The model to be projected, represented by an object of class 'glm'. 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# 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)

## End(Not run)

MIAmaxent documentation built on Dec. 1, 2020, 5:08 p.m.