irf.mvgam | R Documentation |
Compute Generalized or Orthogonalized Impulse Response Functions (IRFs) from
mvgam
models with Vector Autoregressive dynamics
irf(object, ...)
## S3 method for class 'mvgam'
irf(object, h = 10, cumulative = FALSE, orthogonal = FALSE, ...)
object |
|
... |
ignored |
h |
Positive |
cumulative |
|
orthogonal |
|
See mvgam_irf-class
for a full description of the quantities that are
computed and returned by this function, along with key references.
An object of mvgam_irf-class
containing the posterior IRFs. This
object can be used with the supplied S3 functions plot.mvgam_irf()
and summary.mvgam_irf()
Nicholas J Clark
mvgam_irf-class
, VAR()
, plot.mvgam_irf()
, stability()
, fevd()
# Fit a model to the portal time series that uses a latent VAR(1)
mod <- mvgam(
formula = captures ~ -1,
trend_formula = ~ trend,
trend_model = VAR(cor = TRUE),
family = poisson(),
data = portal_data,
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 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)
plot(irfs, series = 4)
# Calculate posterior median, upper and lower 95th quantiles
# of the impulse responses
summary(irfs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.