View source: R/score.mvgam_forecast.R
| score.mvgam_forecast | R Documentation |
Compute probabilistic forecast scores for mvgam models
## S3 method for class 'mvgam_forecast'
score(
object,
score = "crps",
log = FALSE,
weights,
interval_width = 0.9,
n_cores = 1,
...
)
score(object, ...)
object |
|
score |
|
log |
|
weights |
optional |
interval_width |
proportional value on |
n_cores |
|
... |
Ignored |
A list containing scores and interval coverages per
forecast horizon. If score %in% c('drps', 'crps', 'elpd', 'brier'),
the list will also contain return the sum of all series-level scores
per horizon. If score %in% c('energy','variogram'), no
series-level scores are computed and the only score returned will be
for all series. For all scores apart from elpd and brier, the
in_interval column in each series-level slot is a binary indicator of
whether or not the true value was within the forecast's corresponding
posterior empirical quantiles. Intervals are not calculated when using
elpd because forecasts will only contain the linear predictors
Nicholas J Clark
Gneiting, T. and Raftery, A. E. (2007). Strictly Proper Scoring Rules, Prediction, and Estimation. Journal of the American Statistical Association, 102(477), 359-378. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1198/016214506000001437")}
forecast.mvgam, ensemble
## Not run:
# Simulate observations for three count-valued time series
data <- sim_mvgam()
# Fit a dynamic model using 'newdata' to automatically produce forecasts
mod <- mvgam(
y ~ 1,
trend_model = RW(),
data = data$data_train,
newdata = data$data_test,
chains = 2,
silent = 2
)
# Extract forecasts into a 'mvgam_forecast' object
fc <- forecast(mod)
plot(fc)
# Compute Discrete Rank Probability Scores and 0.90 interval coverages
fc_scores <- score(fc, score = 'drps')
str(fc_scores)
# An example using binary data
data <- sim_mvgam(family = bernoulli())
mod <- mvgam(
y ~ s(season, bs = 'cc', k = 6),
trend_model = AR(),
data = data$data_train,
newdata = data$data_test,
family = bernoulli(),
chains = 2,
silent = 2
)
# Extract forecasts on the expectation (probability) scale
fc <- forecast(mod, type = 'expected')
plot(fc)
# Compute Brier scores
fc_scores <- score(fc, score = 'brier')
str(fc_scores)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.