# \donttest{
# 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)
# }
Run the code above in your browser using DataLab