irf.mvgam {mvgam} | R Documentation |
Calculate latent VAR impulse response functions
Description
Compute Generalized or Orthogonalized Impulse Response Functions (IRFs) from
mvgam
models with Vector Autoregressive dynamics
Usage
irf(object, ...)
## S3 method for class 'mvgam'
irf(object, h = 1, cumulative = FALSE, orthogonal = FALSE, ...)
Arguments
object |
|
... |
ignored |
h |
Positive |
cumulative |
|
orthogonal |
|
Details
Generalized or Orthogonalized Impulse Response Functions can be computed
using the posterior estimates of Vector Autoregressive parameters. This function
generates a positive "shock" for a target process at time t = 0
and then
calculates how each of the remaining processes in the latent VAR are expected
to respond over the forecast horizon h
. The function computes IRFs for all
processes in the object and returns them in an array that can be plotted using
the S3 plot
function
Value
An object of class mvgam_irf
containing the posterior IRFs. This
object can be used with the supplied S3 functions plot
Author(s)
Nicholas J Clark
See Also
Examples
# 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(y ~ -1,
trend_formula = ~ 1,
trend_model = VAR(cor = TRUE),
family = gaussian(),
data = simdat$data_train,
silent = 2)
# Calulate Generalized IRFs for each series
irfs <- irf(mod, h = 12, cumulative = FALSE)
# Plot them
plot(irfs, series = 1)
plot(irfs, series = 2)
plot(irfs, series = 3)