skill_ROC: ROC Curve

Description Usage Arguments Value References See Also Examples

View source: R/skill_ROC.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
# Fail gracefully if any resources are not available
try({

# Napa Fires -- October, 2017
ca <- airnow_loadAnnual(2017) %>%
  monitor_subset(tlim = c(20171001,20171101), stateCodes = 'CA')
Vallejo <- monitor_subset(ca, monitorIDs = '060950004_01')
Napa <- monitor_subset(ca, monitorIDs = '060550003_01')
t2 <- AQI$breaks_24[4] # 'Unhealthy'
rocList <- skill_ROC(Vallejo, Napa, t1Range = c(0,100), t2 = t2)
roc <- rocList$roc
auc <- rocList$auc
plot(roc$TPR ~ roc$FPR, type = 'S')
title(paste0('Area Under Curve = ', format(auc,digits = 3)))

}, silent = FALSE)

## End(Not run)

PWFSLSmoke documentation built on Nov. 23, 2021, 5:06 p.m.