View source: R/plot_mvgam_trend.R
| plot_mvgam_trend | R Documentation |
Plot latent trend predictions from mvgam models
plot_mvgam_trend(
object,
series = 1,
newdata,
data_test,
realisations = FALSE,
n_realisations = 15,
n_cores = 1,
derivatives = FALSE,
xlab,
ylab
)
object |
|
series |
|
newdata |
Optional |
data_test |
Deprecated. Still works in place of |
realisations |
|
n_realisations |
|
n_cores |
Deprecated. Parallel processing is no longer supported |
derivatives |
|
xlab |
Label for x axis |
ylab |
Label for y axis |
A ggplot object
Nicholas J Clark
## Not run:
simdat <- sim_mvgam(
n_series = 3,
trend_model = AR()
)
mod <- mvgam(
y ~ s(season, bs = 'cc', k = 6),
trend_model = AR(),
noncentred = TRUE,
data = simdat$data_train,
chains = 2
)
# Plot estimated trends for some series
plot_mvgam_trend(mod)
plot_mvgam_trend(mod, series = 2)
# Extrapolate trends forward in time and plot on response scale
plot_mvgam_trend(
mod,
newdata = simdat$data_test
)
plot_mvgam_trend(
mod,
newdata = simdat$data_test,
series = 2
)
# But it is recommended to compute extrapolations for all series
# first and then plot
trend_fc <- forecast(
mod,
newdata = simdat$data_test
)
plot(trend_fc, series = 1)
plot(trend_fc, series = 2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.