Description Usage Arguments Value See Also Examples
View source: R/monitor_performance.R
This function uses confusion matrix analysis to calculate
different measures of predictive performance for every timeseries found
in predicted
with respect to the observed values found in the single timeseries
found in observed
.
The requested metric is returned in a dataframe organized with one row per monitor, all available metrics are returned.
1 2 3 4 5 6 7 8 9 | monitor_performance(
predicted,
observed,
t1,
t2,
metric = NULL,
FPCost = 1,
FNCost = 1
)
|
predicted |
ws_monitor object with predicted data |
observed |
ws_monitor object with observed data |
t1 |
value used to classify |
t2 |
threshold used to classify |
metric |
confusion matrix metric to be used |
FPCost |
cost associated with false positives (type II error) |
FNCost |
cost associated with false negatives (type I error) |
Dataframe of monitors vs named measure of performance.
monitor_performanceMap
skill_confusionMatrix
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 | # Fail gracefully if any resources are not available
try({
library(PWFSLSmoke)
# If daily avg data were the prediciton and Spokane were
# the observed, which WA State monitors had skill?
wa <- airnow_loadAnnual(2017) %>% monitor_subset(stateCodes='WA')
wa_dailyAvg <- monitor_dailyStatistic(wa, mean)
Spokane_dailyAvg <- monitor_subset(wa_dailyAvg, monitorIDs='530630021_01')
threshold <- AQI$breaks_24[4] # Unhealthy
performanceMetrics <- monitor_performance(wa_dailyAvg,
Spokane_dailyAvg,
threshold, threshold)
monitorIDs <- rownames(performanceMetrics)
mask <- performanceMetrics$heidkeSkill &
!is.na(performanceMetrics$heidkeSkill)
skillfulIDs <- monitorIDs[mask]
skillful <- monitor_subset(wa_dailyAvg, monitorIDs=skillfulIDs)
monitor_leaflet(skillful)
}, silent = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.