Skip to content

Commit ca72aeb

Browse files
sbfnkclaude
andcommitted
Use 90% intervals for scoringutils compatibility
- Change forecast levels from c(0.50, 0.80, 0.95) to c(0.50, 0.90, 0.95) - Add intervals = c(0.5, 0.9, 0.95) to all hubVis plot calls - Update comparison table to show Coverage_90 instead of Coverage_80 - This gives scoringutils the 0.05/0.95 quantiles it needs for interval_coverage_90 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 80ff52f commit ca72aeb

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ For bugs and feature requests:
175175
## Contributors
176176

177177
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
178+
178179
<!-- prettier-ignore-start -->
180+
179181
<!-- markdownlint-disable -->
180182

181183
All contributions to this project are gratefully acknowledged using the
@@ -186,5 +188,7 @@ specification. Contributions of any kind are welcome!
186188
<a href="https://github.com/epiforecasts/forecastbaselines/commits?author=sbfnk">sbfnk</a>
187189

188190
<!-- markdownlint-enable -->
191+
189192
<!-- prettier-ignore-end -->
193+
190194
<!-- ALL-CONTRIBUTORS-LIST:END -->

vignettes/forecastbaselines.Rmd

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ fc_with_intervals <- forecast(
173173
seed = 42
174174
),
175175
horizon = 1:12,
176-
levels = c(0.50, 0.80, 0.95),
176+
levels = c(0.50, 0.90, 0.95),
177177
include_median = FALSE,
178178
model_name = "Constant"
179179
)
@@ -191,6 +191,7 @@ library(hubVis)
191191
hubVis::plot_step_ahead_model_output(
192192
constant_hubverse$model_output,
193193
constant_hubverse$target_data,
194+
intervals = c(0.5, 0.9, 0.95),
194195
interactive = TRUE
195196
)
196197
```
@@ -209,7 +210,7 @@ arma_fc <- forecast(
209210
arma_fitted,
210211
interval_method = EmpiricalInterval(n_trajectories = 1000),
211212
horizon = 1:12,
212-
levels = c(0.50, 0.80, 0.95),
213+
levels = c(0.50, 0.90, 0.95),
213214
include_median = FALSE,
214215
model_name = "ARMA(2,1)"
215216
)
@@ -226,13 +227,14 @@ arma_hubverse <- as_hubverse(
226227
hubVis::plot_step_ahead_model_output(
227228
arma_hubverse$model_output,
228229
arma_hubverse$target_data,
230+
intervals = c(0.5, 0.9, 0.95),
229231
interactive = TRUE
230232
)
231233
```
232234

233235
The hubVis visualizations show:
234236

235-
- Prediction intervals at 50%, 80%, and 95% confidence levels
237+
- Prediction intervals at 50%, 90%, and 95% confidence levels
236238
- Observed truth values overlaid on the forecasts
237239

238240
# Model Evaluation
@@ -259,7 +261,7 @@ forecasts <- lapply(names(models), function(name) {
259261
forecast(fitted,
260262
interval_method = EmpiricalInterval(n_trajectories = 1000),
261263
horizon = 1:12,
262-
levels = c(0.50, 0.80, 0.95),
264+
levels = c(0.50, 0.90, 0.95),
263265
include_median = FALSE,
264266
model_name = name
265267
)
@@ -277,13 +279,13 @@ all_quantiles <- scoringutils::as_forecast_quantile(all_quantiles)
277279
scores <- scoringutils::score(all_quantiles)
278280
score_summary <- scoringutils::summarise_scores(scores, by = "model")
279281
280-
# Display key metrics (WIS decomposition)
282+
# Display key metrics
281283
comparison <- data.frame(
282284
Model = score_summary$model,
283285
WIS = round(score_summary$wis, 2),
284-
Dispersion = round(score_summary$dispersion, 2),
285-
Underprediction = round(score_summary$underprediction, 2),
286-
Overprediction = round(score_summary$overprediction, 2)
286+
Coverage_50 = paste0(round(score_summary$interval_coverage_50 * 100, 1), "%"),
287+
Coverage_90 = paste0(round(score_summary$interval_coverage_90 * 100, 1), "%"),
288+
Coverage_95 = paste0(round(score_summary$interval_coverage_95 * 100, 1), "%")
287289
)
288290
print(comparison)
289291
@@ -300,6 +302,7 @@ comparison_hubverse <- as_hubverse(
300302
hubVis::plot_step_ahead_model_output(
301303
comparison_hubverse$model_output,
302304
comparison_hubverse$target_data,
305+
intervals = c(0.5, 0.9, 0.95),
303306
interactive = TRUE
304307
)
305308
```
@@ -324,7 +327,7 @@ stl_fitted <- fit_baseline(seasonal_data, stl_model)
324327
stl_fc <- forecast(stl_fitted,
325328
interval_method = EmpiricalInterval(n_trajectories = 1000),
326329
horizon = 1:12,
327-
levels = c(0.50, 0.80, 0.95),
330+
levels = c(0.50, 0.90, 0.95),
328331
include_median = FALSE,
329332
truth = future_seasonal,
330333
model_name = "STL"
@@ -336,7 +339,7 @@ lsd_fitted <- fit_baseline(seasonal_data, lsd_model)
336339
lsd_fc <- forecast(lsd_fitted,
337340
interval_method = EmpiricalInterval(n_trajectories = 1000),
338341
horizon = 1:12,
339-
levels = c(0.50, 0.80, 0.95),
342+
levels = c(0.50, 0.90, 0.95),
340343
include_median = FALSE,
341344
truth = future_seasonal,
342345
model_name = "LSD"
@@ -364,6 +367,7 @@ filtered_output <- seasonal_hubverse$model_output[seasonal_hubverse$model_output
364367
hubVis::plot_step_ahead_model_output(
365368
filtered_output,
366369
filtered_target,
370+
intervals = c(0.5, 0.9, 0.95),
367371
interactive = TRUE
368372
)
369373
```

0 commit comments

Comments
 (0)