fevd.mvgam | R Documentation |
Compute forecast error variance decompositions from
mvgam
models with Vector Autoregressive dynamics
fevd(object, ...)
## S3 method for class 'mvgam'
fevd(object, h = 10, ...)
object |
|
... |
ignored |
h |
Positive |
See mvgam_fevd-class
for a full description of the quantities that are
computed and returned by this function, along with key references.
Nicholas J Clark
VAR()
, irf()
, stability()
, mvgam_fevd-class
# Simulate some time series that follow a latent VAR(1) process
simdat <- sim_mvgam(
family = gaussian(),
n_series = 4,
trend_model = VAR(cor = TRUE),
prop_trend = 1
)
plot_mvgam_series(data = simdat$data_train, series = "all")
# Fit a model that uses a latent VAR(1)
mod <- mvgam(
formula = y ~ -1,
trend_formula = ~ 1,
trend_model = VAR(cor = TRUE),
family = gaussian(),
data = simdat$data_train,
chains = 2,
silent = 2
)
# Plot the autoregressive coefficient distributions;
# use 'dir = "v"' to arrange the order of facets
# correctly
mcmc_plot(
mod,
variable = 'A',
regex = TRUE,
type = 'hist',
facet_args = list(dir = 'v')
)
# Calulate forecast error variance decompositions for each series
fevds <- fevd(mod, h = 12)
# Plot median contributions to forecast error variance
plot(fevds)
# View a summary of the error variance decompositions
summary(fevds)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.