R: Area Under the Curve of the Reciever Operating Curve

auc {SDMTools} | R Documentation

## Area Under the Curve of the Reciever Operating Curve

### Description

`auc` estimates the AUC of the ROC using a Mann-Whitney U statistic.
Note: this method will exclude any missing data.

### Usage

    auc(obs, pred)

### Arguments

`obs` | a vector of observed values which must be 0 for absences and 1 for occurrences
`pred` | a vector of the same length as `obs` representing the predicted values. Values must be between 0 & 1 representing a likelihood.

### Value

Returns a single value represting the AUC value.

### Author(s)

Jeremy VanDerWal jjvanderwal@gmail.com

### See Also

`Kappa`, `omission`, `sensitivity`, `specificity`, `prop.correct`, `confusion.matrix`, `accuracy`

### Examples

    #create some data
    obs = c(sample(c(0,1),20,replace=TRUE),NA)
    pred = runif(length(obs),0,1)

    #calculate AUC from the random data
    auc(obs,pred)

    #calculate an example 'perfect' AUC
    obs = obs[order(obs)]
    pred = pred[order(pred)]
    auc(obs,pred)

[Package SDMTools version 1.1-221.2 Index]