Title: | Bayesian SVARs with Sign, Zero, and Narrative Restrictions |
---|---|
Description: | Implements state-of-the-art algorithms for the Bayesian analysis of Structural Vector Autoregressions (SVARs) identified by sign, zero, and narrative restrictions. The core model is based on a flexible Vector Autoregression with estimated hyper-parameters of the Minnesota prior and the dummy observation priors as in Giannone, Lenza, Primiceri (2015) <doi:10.1162/REST_a_00483>. The sign restrictions are implemented employing the methods proposed by Rubio-Ramírez, Waggoner & Zha (2010) <doi:10.1111/j.1467-937X.2009.00578.x>, while identification through sign and zero restrictions follows the approach developed by Arias, Rubio-Ramírez, & Waggoner (2018) <doi:10.3982/ECTA14468>. Furthermore, our tool provides algorithms for identification via sign and narrative restrictions, in line with the methods introduced by Antolín-Díaz and Rubio-Ramírez (2018) <doi:10.1257/aer.20161852>. Users can also estimate a model with sign, zero, and narrative restrictions imposed at once. The package facilitates predictive and structural analyses using impulse responses, forecast error variance and historical decompositions, forecasting and conditional forecasting, as well as analyses of structural shocks and fitted values. All this is complemented by colourful plots, user-friendly summary functions, and comprehensive documentation. The 'bsvarSIGNs' package is aligned regarding objects, workflows, and code structure with the R package 'bsvars' by Woźniak (2024) <doi:10.32614/CRAN.package.bsvars>, and they constitute an integrated toolset. |
Authors: | Xiaolei Wang [aut, cre] , Tomasz Woźniak [aut] |
Maintainer: | Xiaolei Wang <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.1 |
Built: | 2024-11-04 19:53:59 UTC |
Source: | CRAN |
Implements state-of-the-art algorithms for the Bayesian analysis of Structural Vector Autoregressions identified by sign, zero, and narrative restrictions. The core model is based on a flexible Vector Autoregression with estimated hyper-parameters of the Minnesota prior and the dummy observation priors as in Giannone, Lenza, Primiceri (2015) <doi:10.1162/REST_a_00483>. The sign restrictions are implemented employing the methods proposed by Rubio-Ramírez, Waggoner & Zha (2010) <doi:10.1111/j.1467-937X.2009.00578.x>, while identification through sign and zero restrictions follows the approach developed by Arias, Rubio-Ramírez, & Waggoner (2018) <doi:10.3982/ECTA14468>. Furthermore, our tool provides algorithms for identification via sign and narrative restrictions, in line with the methods introduced by Antolín-Díaz and Rubio-Ramírez (2018) <doi:10.1257/aer.20161852>. Users can also estimate a model with sign, zero, and narrative restrictions imposed at once. The package facilitates predictive and structural analyses using impulse responses, forecast error variance and historical decompositions, forecasting and conditional forecasting, as well as analyses of structural shocks and fitted values. All this is complemented by colourful plots, user-friendly summary functions, and comprehensive documentation. The 'bsvarSIGNs' package is aligned regarding objects, workflows, and code structure with the R package 'bsvars' by Woźniak (2024) <doi:10.32614/CRAN.package.bsvars>, and they constitute an integrated toolset.
Models. All the SVAR models in this package are specified by two equations, including the reduced form equation:
where is an
N
-vector of dependent variables,
is a
K
-vector of explanatory variables,
is an
N
-vector of reduced form error terms,
and is an
NxK
matrix of autoregressive slope coefficients and
parameters on deterministic terms in .
The structural equation is given by:
where is an
N
-vector of structural shocks, and
is an
NxN
matrix of contemporaneous relationships.
Finally, all of the models share the following assumptions regarding the
structural shocks u_t
, namely, joint conditional normality given the
past observations collected in matrix x_t
, and temporal and
contemporaneous independence. The latter implies zero correlations and
autocorrelations.
Identification. The identification of the SVAR model is achieved by imposing:
sign restrictions on the structural matrix ,
sign and zero restrictions on the zero-horizon impulse responses ,
sign restrictions on the impulse responses at other horizons for
,
sign restrictions on selected structural shocks ,
two types of sign restrictions on the historical decompositions.
These restrictions determine the sampling algorithms of the structural matrix
defined as
where is an
NxN
orthogonal matrix and is a lower-triangular
matrix
, and
is the
NxN
conditional covariance matrix of the reduced-form error term .
Consult the original papers by Rubio-Ramírez, Waggoner & Zha (2010),
Arias, Rubio-Ramírez, & Waggoner (2018) and Antolín-Díaz and Rubio-Ramírez (2018)
for more details.
Prior distributions. All the models feature a hierarchical Minnesota prior following the specification proposed by Giannone, Lenza, Primiceri (2015) and featuring:
appropriate handling of unit-root non-stationary variables through
the prior mean of the autoregressive coefficients ,
normal prior shrinkage exhibiting exponential decay in the lag order of the autoregressive matrices,
sum-of-coefficients and dummy-initial-observation prior,
estimated shrinkage hyper-parameters,
inverse-Wishart prior for the reduced-form covariance matrix ,
estimated diagonal elements of the inverse-Wishart prior scale matrix.
This package is currently in active development. Your comments, suggestions and requests are warmly welcome!
Xiaolei Wang [email protected] & Tomasz Woźniak [email protected]
Antolín-Díaz & Rubio-Ramírez (2018) Narrative Sign Restrictions for SVARs, American Economic Review, 108(10), 2802-29, <doi:10.1257/aer.20161852>.
Arias, Rubio-Ramírez, & Waggoner (2018), Inference Based on Structural Vector Autoregressions Identified With Sign and Zero Restrictions: Theory and Applications, Econometrica, 86(2), 685-720, <doi:10.3982/ECTA14468>.
Giannone, Lenza, Primiceri (2015) Prior Selection for Vector Autoregressions, Review of Economics and Statistics, 97(2), 436-451 <doi:10.1162/REST_a_00483>.
Rubio-Ramírez, Waggoner & Zha (2010) Structural Vector Autoregressions: Theory of Identification and Algorithms for Inference, The Review of Economic Studies, 77(2), 665-696, <doi:10.1111/j.1467-937X.2009.00578.x>.
Woźniak (2024) bsvars: Bayesian Estimation of Structural Vector Autoregressive Models. R package version 3.1, <doi:10.32614/CRAN.package.bsvars>.
# investigate the effects of the optimism shock data(optimism) # specify identifying restrictions: # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) # specify the model specification = specify_bsvarSIGN$new(optimism * 100, p = 4, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, S = 100) # compute and plot impulse responses irf = compute_impulse_responses(posterior, horizon = 40) plot(irf, probability = 0.68)
# investigate the effects of the optimism shock data(optimism) # specify identifying restrictions: # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) # specify the model specification = specify_bsvarSIGN$new(optimism * 100, p = 4, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, S = 100) # compute and plot impulse responses irf = compute_impulse_responses(posterior, horizon = 40) plot(irf, probability = 0.68)
Each of the draws from the posterior estimation of models is transformed into a draw from the posterior distribution of the structural shock conditional standard deviations.
## S3 method for class 'PosteriorBSVARSIGN' compute_conditional_sd(posterior)
## S3 method for class 'PosteriorBSVARSIGN' compute_conditional_sd(posterior)
posterior |
posterior estimation outcome - an object of class
|
An object of class PosteriorSigma
, that is, an NxTxS
array with attribute PosteriorSigma
containing S
draws of the
structural shock conditional standard deviations.
Xiaolei Wang [email protected] and Tomasz Woźniak [email protected]
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_conditional_sd() -> csd
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_conditional_sd() -> csd
Each of the draws from the posterior estimation of models from packages bsvars or bsvarSIGNs is transformed into a draw from the data predictive density.
## S3 method for class 'PosteriorBSVARSIGN' compute_fitted_values(posterior)
## S3 method for class 'PosteriorBSVARSIGN' compute_fitted_values(posterior)
posterior |
posterior estimation outcome - an object of class
|
An object of class PosteriorFitted
, that is, an NxTxS
array with attribute PosteriorFitted
containing S
draws from
the data predictive density.
Xiaolei Wang [email protected] and Tomasz Woźniak [email protected]
estimate.BSVARSIGN
, summary
, plot
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 20) |> compute_fitted_values() -> fitted
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 20) |> compute_fitted_values() -> fitted
Each of the draws from the posterior estimation of models from packages bsvars or bsvarSIGNs is transformed into a draw from the posterior distribution of the historical decompositions. IMPORTANT! The historical decompositions are interpreted correctly for covariance stationary data. Application to unit-root non-stationary data might result in non-interpretable outcomes.
## S3 method for class 'PosteriorBSVARSIGN' compute_historical_decompositions(posterior, show_progress = TRUE)
## S3 method for class 'PosteriorBSVARSIGN' compute_historical_decompositions(posterior, show_progress = TRUE)
posterior |
posterior estimation outcome - an object of class
|
show_progress |
a logical value, if |
An object of class PosteriorHD
, that is, an NxNxTxS
array
with attribute PosteriorHD
containing S
draws of the historical
decompositions.
Xiaolei Wang [email protected] and Tomasz Woźniak [email protected]
Kilian, L., & Lütkepohl, H. (2017). Structural VAR Tools, Chapter 4, In: Structural vector autoregressive analysis. Cambridge University Press.
estimate.BSVARSIGN
, summary
, plot
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_historical_decompositions() -> hd
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_historical_decompositions() -> hd
Each of the draws from the posterior estimation of models from packages bsvars or bsvarSIGNs is transformed into a draw from the posterior distribution of the impulse responses.
## S3 method for class 'PosteriorBSVARSIGN' compute_impulse_responses(posterior, horizon, standardise = FALSE)
## S3 method for class 'PosteriorBSVARSIGN' compute_impulse_responses(posterior, horizon, standardise = FALSE)
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer number denoting the forecast horizon for the impulse responses computations. |
standardise |
a logical value. If |
An object of class PosteriorIR, that is, an NxNx(horizon+1)xS
array with attribute PosteriorIR
containing S
draws of the impulse responses.
Xiaolei Wang [email protected] and Tomasz Woźniak [email protected]
Kilian, L., & Lütkepohl, H. (2017). Structural VAR Tools, Chapter 4, In: Structural vector autoregressive analysis. Cambridge University Press.
estimate.BSVARSIGN
, summary
, plot
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_impulse_responses(horizon = 8) -> ir
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_impulse_responses(horizon = 8) -> ir
Each of the draws from the posterior estimation of models from packages bsvars or bsvarSIGNs is transformed into a draw from the posterior distribution of the structural shocks.
## S3 method for class 'PosteriorBSVARSIGN' compute_structural_shocks(posterior)
## S3 method for class 'PosteriorBSVARSIGN' compute_structural_shocks(posterior)
posterior |
posterior estimation outcome - an object of class
|
An object of class PosteriorShocks
, that is, an NxTxS
array with attribute PosteriorShocks
containing S
draws of the
structural shocks.
Xiaolei Wang [email protected] and Tomasz Woźniak [email protected]
estimate.BSVARSIGN
, summary
, plot
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 20) |> compute_structural_shocks() -> ss
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 20) |> compute_structural_shocks() -> ss
Each of the draws from the posterior estimation of the model is transformed into a draw from the posterior distribution of the forecast error variance decomposition.
## S3 method for class 'PosteriorBSVARSIGN' compute_variance_decompositions(posterior, horizon)
## S3 method for class 'PosteriorBSVARSIGN' compute_variance_decompositions(posterior, horizon)
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer number denoting the forecast horizon for the impulse responses computations. |
An object of class PosteriorFEVD
, that is, an NxNx(horizon+1)xS
array with attribute PosteriorFEVD
containing S
draws of the
forecast error variance decomposition.
Xiaolei Wang [email protected] and Tomasz Woźniak [email protected]
Kilian, L., & Lütkepohl, H. (2017). Structural VAR Tools, Chapter 4, In: Structural vector autoregressive analysis. Cambridge University Press.
compute_impulse_responses.PosteriorBSVARSIGN
, estimate.BSVARSIGN
, summary
, plot
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_variance_decompositions(horizon = 8) -> fevd
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> compute_variance_decompositions(horizon = 8) -> fevd
Estimates Bayesian Structural Vector Autoregression model
using the Gibbs sampler proposed by Waggoner & Zha (2003) with traditional sign restrictions
following Rubio-Ramírez, Waggoner & Zha (2010) and narrative sign restrictions
following Antolín-Díaz & Rubio-Ramírez (2018). Additionally, the parameter matrices and
follow a Minnesota prior and generalised-normal prior distributions respectively with the matrix-specific
overall shrinkage parameters estimated using a hierarchical prior distribution.
Given sign restrictions, in each Gibbs sampler iteration, the sampler draws rotation matrix
uniformly from the space of
NxN
orthogonal matrices and checks if the sign restrictions
are satisfied. If a valid is found within
max_tries
(defined in specify_bsvarSIGN
),
the sampler saves the current and
draw and proceeds to the next iteration.
Otherwise, the sampler then proceeds to next iteration without saving the current
and
draw.
If a narrative sign restriction is given, the posterior
draws are resampled with
algorithm 1
in Antolín-Díaz & Rubio-Ramírez (2018).
See section Details for the model equations.
## S3 method for class 'BSVARSIGN' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'BSVARSIGN' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class BSVARSIGN generated using the |
S |
a positive integer, the number of posterior draws to be generated |
thin |
a positive integer, specifying the frequency of MCMC output thinning |
show_progress |
a logical value, if |
The Structural VAR model is given by the reduced form equation:
where is an
NxT
matrix of dependent variables, is a
KxT
matrix of explanatory variables,
is an
NxT
matrix of reduced form error terms, and is an
NxK
matrix of
autoregressive slope coefficients and parameters on deterministic terms in .
The structural equation is given by
where is an
NxT
matrix of structural form error terms, and
is an
NxN
matrix of contemporaneous relationships. More specifically,
where is an
NxN
rotation matrix and is an
NxN
lower triangular matrix.
Finally, the structural shocks, U
, are temporally and contemporaneously independent and jointly normally distributed with zero mean and unit variances.
An object of class PosteriorBSVARSIGN
containing the Bayesian estimation output and containing two elements:
posterior
a list with a collection of S
draws from the posterior distribution generated via Gibbs sampler containing:
an NxKxS
array with the posterior draws for matrix
an NxNxS
array with the posterior draws for matrix
a 5xS
matrix with the posterior draws for the hyper-parameters of the hierarchical prior distribution
an integer of the total skipped iterations,
the Gibbs sampler performs a total of S+skipped iterations,
when the sampler does not find a valid rotation matrix Q
within max_tries
,
the current iteration is skipped (i.e. the current draw of A,B
is not saved).
A message is shown when skipped/(skipped+S/thin) > 0.05, where S/thin is the total number of draws returned.
last_draw
an object of class BSVARSIGN with the last draw of the current MCMC run as the starting value to be passed to the continuation of the MCMC estimation using estimate()
.
Tomasz Woźniak [email protected], Xiaolei Wang [email protected]
Antolín-Díaz & Rubio-Ramírez (2018) Narrative Sign Restrictions for SVARs, American Economic Review, 108(10), 2802-29, <doi:10.1257/aer.20161852>.
Arias, Rubio-Ramírez, & Waggoner (2018), Inference Based on Structural Vector Autoregressions Identified With Sign and Zero Restrictions: Theory and Applications, Econometrica, 86(2), 685-720, <doi:10.3982/ECTA14468>.
Giannone, Lenza, Primiceri (2015) Prior Selection for Vector Autoregressions, Review of Economics and Statistics, 97(2), 436-451 <doi:10.1162/REST_a_00483>.
Rubio-Ramírez, Waggoner & Zha (2010) Structural Vector Autoregressions: Theory of Identification and Algorithms for Inference, The Review of Economic Studies, 77(2), 665-696, <doi:10.1111/j.1467-937X.2009.00578.x>.
# investigate the effects of the optimism shock data(optimism) # specify identifying restrictions: # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) # specify the model and set seed set.seed(123) specification = specify_bsvarSIGN$new(optimism * 100, p = 12, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, S = 10)
# investigate the effects of the optimism shock data(optimism) # specify identifying restrictions: # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) # specify the model and set seed set.seed(123) specification = specify_bsvarSIGN$new(optimism * 100, p = 12, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, S = 10)
Samples from the joint predictive density of all of the dependent
variables for models from packages bsvars, bsvarSIGNs or
bvarPANELs at forecast horizons from 1 to horizon
specified as
an argument of the function. Also facilitates forecasting using models with
exogenous variables and conditional forecasting given projected future
trajcetories of (some of the) variables.
## S3 method for class 'PosteriorBSVARSIGN' forecast( posterior, horizon = 1, exogenous_forecast = NULL, conditional_forecast = NULL )
## S3 method for class 'PosteriorBSVARSIGN' forecast( posterior, horizon = 1, exogenous_forecast = NULL, conditional_forecast = NULL )
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer, specifying the forecasting horizon. |
exogenous_forecast |
a matrix of dimension |
conditional_forecast |
a |
A list of class Forecasts
containing the
draws from the predictive density and data. The output list includes element:
an NxhorizonxS
array with the draws from predictive density
an matrix with the data on dependent variables
Tomasz Woźniak [email protected] and Xiaolei Wang [email protected]
estimate.BSVARSIGN
, summary
, plot
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 20) |> forecast(horizon = 4) -> predictive # conditional forecasting 2 quarters ahead conditioning on # provided future values for the Gross Domestic Product ############################################################ cf = matrix(NA , 2, 5) # # conditional forecasts equal to the last consumption observation cf[,3] = tail(optimism, 1)[3] predictive = forecast(posterior, 2, conditional_forecast = cf) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> forecast(horizon = 2, conditional_forecast = cf) -> predictive
# upload data data(optimism) # specify the model and set seed set.seed(123) # + no effect on productivity (zero restriction) # + positive effect on stock prices (positive sign restriction) sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specification = specify_bsvarSIGN$new(optimism, sign_irf = sign_irf) # estimate the model posterior = estimate(specification, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 20) |> forecast(horizon = 4) -> predictive # conditional forecasting 2 quarters ahead conditioning on # provided future values for the Gross Domestic Product ############################################################ cf = matrix(NA , 2, 5) # # conditional forecasts equal to the last consumption observation cf[,3] = tail(optimism, 1)[3] predictive = forecast(posterior, 2, conditional_forecast = cf) # workflow with the pipe |> ############################################################ set.seed(123) optimism |> specify_bsvarSIGN$new(sign_irf = sign_irf) |> estimate(S = 10) |> forecast(horizon = 2, conditional_forecast = cf) -> predictive
A sample data to identify monetary policy shock.
data(monetary)
data(monetary)
A matrix and a ts
object with time series of over two hundred observations on 5 variables:
monthly real gross domestic product
monthly gross domestic product: implicit price deflator
monthly consumer price index
monthly reserves of depository institutions
monthly non-borrowed reserves of depository institutions
monthly federal funds effective rate
Replication package, https://www.aeaweb.org/articles?id=10.1257/aer.20161852
Antolín-Díaz & Rubio-Ramírez (2018) Narrative Sign Restrictions for SVARs, American Economic Review, 108(10), 2802-29, <doi:10.1257/aer.20161852>.
A sample data to identify optimism shock.
data(optimism)
data(optimism)
A matrix and a ts
object with time series of over two hundred observations on 5 variables:
quarterly factor-utilization-adjusted total factor productivity
quarterly end-of-period S&P 500 divided by CPI
quarterly real consumption expenditures on nondurable goods and services
quarterly real interest rate
quarterly hours of all persons in the non-farm business sector
The series are as described by Beaudry, Nam and Wang (2011) in section 2.2.
Replication package, https://www.econometricsociety.org/publications/econometrica/2018/03/01/inference-based-structural-vector-autoregressions-identified
Arias, Jonas E., Juan F. Rubio‐Ramírez, and Daniel F. Waggoner. "Inference based on structural vector autoregressions identified with sign and zero restrictions: Theory and applications." Econometrica 86, no. 2 (2018): 685-720. <doi:10.3982/ECTA14468>
Beaudry, Paul, Deokwoo Nam, and Jian Wang. Do mood swings drive business cycles and is it rational?. No. w17651. National Bureau of Economic Research, 2011. <doi:10.3386/w17651>
The class BSVARSIGN presents complete specification for the Bayesian Structural VAR model with sign and narrative restrictions.
p
a non-negative integer specifying the autoregressive lag order of the model.
identification
an object IdentificationBSVARSIGN with the identifying restrictions.
prior
an object PriorBSVARSIGN with the prior specification.
data_matrices
an object DataMatricesBSVARSIGN with the data matrices.
starting_values
an object StartingValuesBSVARSIGN with the starting values.
new()
Create a new specification of the Bayesian Structural VAR model with sign and narrative restrictions BSVARSIGN.
specify_bsvarSIGN$new( data, p = 1L, sign_irf, sign_narrative, sign_structural, max_tries = Inf, exogenous = NULL, stationary = rep(FALSE, ncol(data)) )
data
a (T+p)xN
matrix with time series data.
p
a positive integer providing model's autoregressive lag order.
sign_irf
a NxNxH
array - sign and zero restrictions
on the impulse response functions, ±1 for positive/negative sign restriction
0 for zero restrictions and NA for no restrictions,
the h
-th slice NxN
matrix contains the
restrictions on the h-1
horizon.
sign_narrative
a list of objects of class "narrative" - narrative sign restrictions.
sign_structural
a NxN
matrix with entries ±1 or NA - sign restrictions on the
contemporaneous relations B
between reduced-form errors E
and
structural shocks U
where BE=U
.
max_tries
a positive integer with the maximum number of iterations
for finding a rotation matrix that would satisfy sign restrictions
exogenous
a (T+p)xd
matrix of exogenous variables.
stationary
an N
logical vector - its element set to FALSE
sets
the prior mean for the autoregressive parameters of the N
th equation to the white noise process,
otherwise to random walk.
A new complete specification for the Bayesian Structural VAR model BSVARSIGN.
get_data_matrices()
Returns the data matrices as the DataMatricesBSVAR object.
specify_bsvarSIGN$get_data_matrices()
# specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the data matrices spec$get_data_matrices()
get_identification()
Returns the identifying restrictions as the IdentificationBSVARSIGN object.
specify_bsvarSIGN$get_identification()
# specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the identifying restrictions spec$get_identification()
get_prior()
Returns the prior specification as the PriorBSVAR object.
specify_bsvarSIGN$get_prior()
# specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the prior specification spec$get_prior()
get_starting_values()
Returns the starting values as the StartingValuesBSVAR object.
specify_bsvarSIGN$get_starting_values()
# specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the starting values spec$get_starting_values()
clone()
The objects of this class are cloneable with this method.
specify_bsvarSIGN$clone(deep = FALSE)
deep
Whether to make a deep clone.
estimate.BSVARSIGN
, specify_posterior_bsvarSIGN
# specify a model with the optimism data and 4 lags data(optimism) specification = specify_bsvarSIGN$new( data = optimism, p = 4 ) ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_data_matrices` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the data matrices spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_identification` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the identifying restrictions spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_prior` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the prior specification spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_starting_values` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the starting values spec$get_starting_values()
# specify a model with the optimism data and 4 lags data(optimism) specification = specify_bsvarSIGN$new( data = optimism, p = 4 ) ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_data_matrices` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the data matrices spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_identification` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the identifying restrictions spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_prior` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the prior specification spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvarSIGN$get_starting_values` ## ------------------------------------------------ # specify a model with the optimism data and 4 lags data(optimism) spec = specify_bsvarSIGN$new( data = optimism, p = 4 ) # get the starting values spec$get_starting_values()
The class IdentificationBSVARSIGN presents the identifying restrictions for the Bayesian Structural VAR models with sign and narrative restrictions.
VB
a list of N
matrices determining the unrestricted elements of matrix .
sign_irf
a NxNxH
array of sign restrictions on the impulse response functions.
sign_narrative
a ANYx6
matrix of narrative sign restrictions.
sign_structural
a NxN
matrix of sign restrictions on contemporaneous relations.
max_tries
a positive integer with the maximum number of iterations
for finding a rotation matrix that would satisfy sign restrictions.
new()
Create new identifying restrictions IdentificationBSVARSIGN.
specify_identification_bsvarSIGN$new( N, sign_irf, sign_narrative, sign_structural, max_tries = Inf )
N
a positive integer - the number of dependent variables in the model.
sign_irf
a NxNxH
array - sign and zero restrictions
on the impulse response functions, ±1 for positive/negative sign restriction
0 for zero restrictions and NA for no restrictions,
the h
-th slice NxN
matrix contains the
restrictions on the h-1
horizon.
sign_narrative
a list of objects of class "narrative" - narrative sign restrictions.
sign_structural
a NxN
matrix with entries ±1 or NA - sign restrictions on the
contemporaneous relations B
between reduced-form errors E
and
structural shocks U
where BE=U
.
max_tries
a positive integer with the maximum number of iterations
for finding a rotation matrix that would satisfy sign restrictions.
Identifying restrictions IdentificationBSVARSIGN.
get_identification()
Returns the elements of the identification pattern IdentificationBSVARSIGN as a list
.
specify_identification_bsvarSIGN$get_identification()
set_identification()
Set new starting values StartingValuesBSVARSIGN.
specify_identification_bsvarSIGN$set_identification( N, sign_irf, sign_narrative, sign_structural )
N
a positive integer - the number of dependent variables in the model.
sign_irf
a NxNxH
array - sign and zero restrictions
on the impulse response functions, ±1 for positive/negative sign restriction
0 for zero restrictions and NA for no restrictions,
the h
-th slice NxN
matrix contains the
restrictions on the h-1
horizon.
sign_narrative
a list of objects of class "narrative" - narrative sign restrictions.
sign_structural
a NxN
matrix with entries ±1 or NA - sign restrictions on the
contemporaneous relations B
between reduced-form errors E
and
structural shocks U
where BE=U
.
max_tries
a positive integer with the maximum number of iterations
for finding a rotation matrix that would satisfy sign restrictions
clone()
The objects of this class are cloneable with this method.
specify_identification_bsvarSIGN$clone(deep = FALSE)
deep
Whether to make a deep clone.
# recursive specification for a 5-variable system specify_identification_bsvarSIGN$new(N = 5) # specify sign restrictions of the first shock on the contemporaneous IRF # + no effect on the first variable # + positive effect on the second variable sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specify_identification_bsvarSIGN$new(N = 5, sign_irf = sign_irf)
# recursive specification for a 5-variable system specify_identification_bsvarSIGN$new(N = 5) # specify sign restrictions of the first shock on the contemporaneous IRF # + no effect on the first variable # + positive effect on the second variable sign_irf = matrix(c(0, 1, rep(NA, 23)), 5, 5) specify_identification_bsvarSIGN$new(N = 5, sign_irf = sign_irf)
The class narrative specifies a single narrative restriction.
specify_narrative( start, periods = 1, type = "S", sign = 1, shock = 1, var = NA )
specify_narrative( start, periods = 1, type = "S", sign = 1, shock = 1, var = NA )
start |
positive integer - the period in which the narrative starts (greater than the number of lags). |
periods |
positive integer - the number of periods the narrative restriction lasts. |
type |
character - the type of the narrative restriction (one of "S", "A", "B"), where: "S" for restrictions on structural shocks; "A" for type A restrictions on historical decomposition, i.e. if the absolute value of the historical decomposition of shock to var is the greatest/least among all shocks; "B" for type B restrictions on historical decomposition, i.e. if the absolute value of the historical decomposition of shock to var is the greater/less than the sum of all other shocks. |
sign |
integer - the sign of the narrative restriction (1 or -1). |
shock |
positive integer - the index of the shock to which the narrative restriction applies. |
var |
positive integer - the index of the variable to which the narrative restriction applies. |
An object of class narrative
specifying one narrative restriction.
# specify a narrative restriction narrative = specify_narrative( start = 166, periods = 1, type = "S", sign = 1, shock = 1, var = 6 ) # use it to specify the model specification = specify_bsvarSIGN$new(monetary, sign_narrative = list(narrative))
# specify a narrative restriction narrative = specify_narrative( start = 166, periods = 1, type = "S", sign = 1, shock = 1, var = 6 ) # use it to specify the model specification = specify_bsvarSIGN$new(monetary, sign_narrative = list(narrative))
The class PosteriorBSVARSIGN contains posterior output and the specification including
the last MCMC draw for the Bayesian Structural VAR model with sign and narrative restrictions.
Note that due to the thinning of the MCMC output the starting value in element last_draw
might not be equal to the last draw provided in element posterior
.
last_draw
an object of class BSVARSIGN with the last draw of the current MCMC run as
the starting value to be passed to the continuation of the MCMC estimation using estimate()
.
posterior
a list containing Bayesian estimation output including:
an NxNxS
array B
, an NxKxS
array A
, and a 5xS
matrix hyper
.
new()
Create a new posterior output PosteriorBSVARSIGN.
specify_posterior_bsvarSIGN$new(specification_bsvarSIGN, posterior_bsvarSIGN)
specification_bsvarSIGN
an object of class BSVARSIGN with the last draw of the current MCMC run as the starting value.
posterior_bsvarSIGN
a list containing Bayesian estimation output collected in elements
an NxNxS
array B
, an NxKxS
array A
, and a 5xS
matrix hyper
.
A posterior output PosteriorBSVARSIGN.
get_posterior()
Returns a list containing Bayesian estimation output collected in elements
an NxNxS
array B
, an NxKxS
array A
, and a 5xS
matrix hyper
.
specify_posterior_bsvarSIGN$get_posterior()
data(optimism) specification = specify_bsvarSIGN$new(optimism) set.seed(123) estimate = estimate(specification, 50) estimate$get_posterior()
is_normalised()
Returns TRUE
if the posterior has been normalised using normalise_posterior()
and FALSE
otherwise.
specify_posterior_bsvarSIGN$is_normalised()
data(optimism) specification = specify_bsvarSIGN$new(optimism) set.seed(123) estimate = estimate(specification, 20) # check normalisation status afterwards posterior$is_normalised()
clone()
The objects of this class are cloneable with this method.
specify_posterior_bsvarSIGN$clone(deep = FALSE)
deep
Whether to make a deep clone.
estimate.BSVARSIGN
, specify_bsvarSIGN
# This is a function that is used within estimate() data(optimism) specification = specify_bsvarSIGN$new(optimism, p = 4) set.seed(123) posterior = estimate(specification, 50) class(posterior) ## ------------------------------------------------ ## Method `specify_posterior_bsvarSIGN$get_posterior` ## ------------------------------------------------ data(optimism) specification = specify_bsvarSIGN$new(optimism) set.seed(123) estimate = estimate(specification, 50) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvarSIGN$is_normalised` ## ------------------------------------------------ data(optimism) specification = specify_bsvarSIGN$new(optimism) set.seed(123) estimate = estimate(specification, 20) # check normalisation status afterwards posterior$is_normalised()
# This is a function that is used within estimate() data(optimism) specification = specify_bsvarSIGN$new(optimism, p = 4) set.seed(123) posterior = estimate(specification, 50) class(posterior) ## ------------------------------------------------ ## Method `specify_posterior_bsvarSIGN$get_posterior` ## ------------------------------------------------ data(optimism) specification = specify_bsvarSIGN$new(optimism) set.seed(123) estimate = estimate(specification, 50) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvarSIGN$is_normalised` ## ------------------------------------------------ data(optimism) specification = specify_bsvarSIGN$new(optimism) set.seed(123) estimate = estimate(specification, 20) # check normalisation status afterwards posterior$is_normalised()
The class PriorBSVARSIGN presents a prior specification for the homoskedastic bsvar model.
p
a positive integer - the number of lags.
hyper
a (N+3)xS
matrix of hyper-parameters .
A
a NxK
normal prior mean matrix for the autoregressive
parameters.
V
a KxK
matrix determining the normal prior column-specific
covariance for the autoregressive parameters.
S
an NxN
matrix determining the inverted-Wishart prior scale
of error terms covariance matrix.
nu
a positive scalar greater than N+1
- the shape of the
inverted-Wishart prior for error terms covariance matrix.
data
an TxN
matrix of observations.
Y
an NxT
matrix of dependent variables.
X
an KxT
matrix of independent variables.
Ysoc
an NxN
matrix with the sum-of-coefficients dummy observations.
Xsoc
an KxN
matrix with the sum-of-coefficients dummy observations.
Ysur
an NxN
matrix with the single-unit-root dummy observations.
Xsur
an KxN
matrix with the single-unit-root dummy observations.
mu.scale
a positive scalar - the shape of the gamma prior for .
mu.shape
a positive scalar - the shape of the gamma prior for .
delta.scale
a positive scalar - the shape of the gamma prior for .
delta.shape
a positive scalar - the shape of the gamma prior for .
lambda.scale
a positive scalar - the shape of the gamma prior for .
lambda.shape
a positive scalar - the shape of the gamma prior for .
psi.scale
a positive scalar - the shape of the inverted gamma prior for .
psi.shape
a positive scalar - the shape of the inverted gamma prior for .
new()
Create a new prior specification PriorBSVAR.
specify_prior_bsvarSIGN$new( data, p, exogenous = NULL, stationary = rep(FALSE, ncol(data)) )
data
the TxN
data matrix of observations.
p
a positive integer - the autoregressive lag order of the SVAR model.
exogenous
a Txd
matrix of exogenous variables.
stationary
an N
logical vector - its element set to FALSE
sets
the prior mean for the autoregressive parameters of the N
th equation to the white noise process,
otherwise to random walk.
A new prior specification PriorBSVARSIGN.
# a prior for 5-variable example with one lag and stationary data data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 1) prior$B # show autoregressive prior mean
get_prior()
Returns the elements of the prior specification PriorBSVAR as a list
.
specify_prior_bsvarSIGN$get_prior()
# a prior for 5-variable example with four lags prior = specify_prior_bsvar$new(N = 5, p = 4) prior$get_prior() # show the prior as list
estimate_hyper()
Estimates hyper-parameters with adaptive Metropolis algorithm.
specify_prior_bsvarSIGN$estimate_hyper( S = 10000, burn_in = S/2, mu = FALSE, delta = FALSE, lambda = TRUE, psi = FALSE )
S
number of MCMC draws.
burn_in
number of burn-in draws.
mu
whether to estimate the hyper-parameter in the sum-of-coefficients dummy prior.
delta
whether to estimate the hyper-parameter in the single-unit-root dummy prior.
lambda
whether to estimate the hyper-parameter of the shrinkage in the Minnesota prior.
psi
whether to estimate the hyper-parameter of the variances in the Minnesota prior.
# specify the model and set seed set.seed(123) data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 4) # estimate hyper parameters with adaptive Metropolis algorithm prior$estimate_hyper(S = 10, psi = TRUE) # trace plot hyper = t(prior$hyper) colnames(hyper) = c("mu", "delta", "lambda", paste("psi", 1:5, sep = "")) plot.ts(hyper)
clone()
The objects of this class are cloneable with this method.
specify_prior_bsvarSIGN$clone(deep = FALSE)
deep
Whether to make a deep clone.
# a prior for 5-variable example with one lag data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 1) prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvarSIGN$new` ## ------------------------------------------------ # a prior for 5-variable example with one lag and stationary data data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 1) prior$B # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvarSIGN$get_prior` ## ------------------------------------------------ # a prior for 5-variable example with four lags prior = specify_prior_bsvar$new(N = 5, p = 4) prior$get_prior() # show the prior as list ## ------------------------------------------------ ## Method `specify_prior_bsvarSIGN$estimate_hyper` ## ------------------------------------------------ # specify the model and set seed set.seed(123) data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 4) # estimate hyper parameters with adaptive Metropolis algorithm prior$estimate_hyper(S = 10, psi = TRUE) # trace plot hyper = t(prior$hyper) colnames(hyper) = c("mu", "delta", "lambda", paste("psi", 1:5, sep = "")) plot.ts(hyper)
# a prior for 5-variable example with one lag data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 1) prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvarSIGN$new` ## ------------------------------------------------ # a prior for 5-variable example with one lag and stationary data data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 1) prior$B # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvarSIGN$get_prior` ## ------------------------------------------------ # a prior for 5-variable example with four lags prior = specify_prior_bsvar$new(N = 5, p = 4) prior$get_prior() # show the prior as list ## ------------------------------------------------ ## Method `specify_prior_bsvarSIGN$estimate_hyper` ## ------------------------------------------------ # specify the model and set seed set.seed(123) data(optimism) prior = specify_prior_bsvarSIGN$new(optimism, p = 4) # estimate hyper parameters with adaptive Metropolis algorithm prior$estimate_hyper(S = 10, psi = TRUE) # trace plot hyper = t(prior$hyper) colnames(hyper) = c("mu", "delta", "lambda", paste("psi", 1:5, sep = "")) plot.ts(hyper)