Learn R Programming

PWFSLSmoke (version 1.0.16)

skill_ROC: ROC Curve

Description

This function calculates an ROC dataframe of TPR, FPR, and Cost for a range of thresholds as well as the area under the ROC curve.

Usage

skill_ROC(predicted, observed, t1Range = NULL, t2 = NULL, n = 101)

Arguments

predicted

vector of predicted values (or a ws_monitor object with a single location)

observed

vector of observed values (or a ws_monitor object with a single location)

t1Range

lo and high values used to generate test thresholds for classifying predicted data

t2

used to classify observed data

n

number of test thresholds in ROC curve

Value

List containing an roc matrix and the auc area under the ROC curve.

References

Receiver Operating Characteristic

See Also

skill_confusionMatrix

skill_ROCPlot

Examples

Run this code
# NOT RUN {
# Spokane summer of 2015
airnow <- airnow_load(20150701,20150930)
airnow <- monitor_rollingMean(airnow, width=3)
MonroeSt <- monitor_subset(airnow, monitorIDs="530630047_01")
EBroadway <- monitor_subset(airnow, monitorIDs="530639997_01")
rocList <- skill_ROC(EBroadway, MonroeSt, t1Range=c(0,100), t2=55)
roc <- rocList$roc
auc <- rocList$auc
plot(roc$TPR ~ roc$FPR, type='S')
title(paste0('Area Under Curve = ', format(auc,digits=3)))
# }

Run the code above in your browser using DataLab