# roc.ROSE: ROC curve In ROSE: ROSE: Random Over-Sampling Examples

## Description

This function returns the ROC curve and computes the area under the curve (AUC) for binary classifiers.

## Usage

 ```1 2``` ```roc.curve(response, predicted, plotit = TRUE, add.roc = FALSE, n.thresholds=100, ...) ```

## Arguments

 `response` A vector of responses containing two classes to be used to compute the ROC curve. It can be of class `"factor"`, `"numeric"` or `"character"`. `predicted` A vector containing a prediction for each observation. This can be of class `"factor"` or `"character"` if the predicted label classes are provided or `"numeric"` for the probabilities of the rare class (or a monotonic function of them). `plotit` Logical, if `TRUE` the ROC curve is plotted in a new window. Default value is set to `TRUE`. `add.roc` Logical, if `TRUE` the ROC curve is added to an existing window. Default value is set to `FALSE`. `n.thresholds` Number of `thresholds` at which the ROC curve is computed. Default value is the minimum between 100 and the number of elements in `response`. A value of `n.thresholds` greater than the length of `response` is ignored. `...` Further arguments to be passed either to `plot` or `lines`.

## Value

The value is an object of class `roc.curve` which has components

 `Call` The matched call. `auc` The value of the area under the ROC curve.

 `false positive rate` The false positive rate (or equivalently the complement of sensitivity) of the classifier at the evaluated `thresholds`. `true positive rate` The true positive rate (or equivalently the specificity) of the classifier at the evaluated `thresholds`. `thresholds` Thresholds at which the ROC curve is evaluated.

## References

Fawcet T. (2006). An introduction to ROC analysis. Pattern Recognition Letters, 27 (8), 861–875.

`accuracy.meas`, `roc`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28``` ```# 2-dimensional example # loading data data(hacide) # check imbalance on training set table(hacide.train\$cls) # model estimation using logistic regression fit.hacide <- glm(cls~., data=hacide.train, family="binomial") # prediction on training set pred.hacide.train <- predict(fit.hacide, newdata=hacide.train) # plot the ROC curve (training set) roc.curve(hacide.train\$cls, pred.hacide.train, main="ROC curve \n (Half circle depleted data)") # check imbalance on test set table(hacide.test\$cls) # prediction using test set pred.hacide.test <- predict(fit.hacide, newdata=hacide.test) # add the ROC curve (test set) roc.curve(hacide.test\$cls, pred.hacide.test, add=TRUE, col=2, lwd=2, lty=2) legend("topleft", c("Resubstitution estimate", "Holdout estimate"), col=1:2, lty=1:2, lwd=2) ```

### Example output

```Loaded ROSE 0.0-3

0   1
980  20
Area under the curve (AUC): 0.876

0   1
245   5
Area under the curve (AUC): 0.804
```

ROSE documentation built on May 29, 2017, 8:43 p.m.