Title: | Bayesian Estimation of Structural Vector Autoregressive Models |
---|---|
Description: | Provides fast and efficient procedures for Bayesian analysis of Structural Vector Autoregressions. This package estimates a wide range of models, including homo-, heteroskedastic, and non-normal specifications. Structural models can be identified by adjustable exclusion restrictions, time-varying volatility, or non-normality. They all include a flexible three-level equation-specific local-global hierarchical prior distribution for the estimated level of shrinkage for autoregressive and structural parameters. Additionally, the package facilitates predictive and structural analyses such as impulse responses, forecast error variance and historical decompositions, forecasting, verification of heteroskedasticity, non-normality, and hypotheses on autoregressive parameters, as well as analyses of structural shocks, volatilities, and fitted values. Beautiful plots, informative summary functions, and extensive documentation including the vignette by Woźniak (2024) <doi:10.48550/arXiv.2410.15090> complement all this. The implemented techniques align closely with those presented in Lütkepohl, Shang, Uzeda, & Woźniak (2024) <doi:10.48550/arXiv.2404.11057>, Lütkepohl & Woźniak (2020) <doi:10.1016/j.jedc.2020.103862>, and Song & Woźniak (2021) <doi:10.1093/acrefore/9780190625979.013.174>. The 'bsvars' package is aligned regarding objects, workflows, and code structure with the R package 'bsvarSIGNs' by Wang & Woźniak (2024) <doi:10.32614/CRAN.package.bsvarSIGNs>, and they constitute an integrated toolset. |
Authors: | Tomasz Woźniak [aut, cre] |
Maintainer: | Tomasz Woźniak <[email protected]> |
License: | GPL (>= 3) |
Version: | 3.2 |
Built: | 2024-11-24 06:28:35 UTC |
Source: | CRAN |
Provides fast and efficient procedures for Bayesian analysis of Structural Vector Autoregressions. This package estimates a wide range of models, including homo-, heteroskedastic and non-normal specifications. Structural models can be identified by adjustable exclusion restrictions, time-varying volatility, or non-normality. They all include a flexible three-level equation-specific local-global hierarchical prior distribution for the estimated level of shrinkage for autoregressive and structural parameters. Additionally, the package facilitates predictive and structural analyses such as impulse responses, forecast error variance and historical decompositions, forecasting, verification of heteroskedasticity and hypotheses on autoregressive parameters, and analyses of structural shocks, volatilities, and fitted values. Beautiful plots, informative summary functions, and extensive documentation including the vignette by Woźniak (2024) <doi:10.48550/arXiv.2410.15090> complement all this. The implemented techniques align closely with those presented in Lütkepohl, Shang, Uzeda, & Woźniak (2024) <doi:10.48550/arXiv.2404.11057>, Lütkepohl & Woźniak (2020) <doi:10.1016/j.jedc.2020.103862>, Song & Woźniak (2021) <doi:10.1093/acrefore/9780190625979.013.174>, and Woźniak & Droumaguet (2015) <doi:10.13140/RG.2.2.19492.55687>. The 'bsvars' package is aligned regarding objects, workflows, and code structure with the R package 'bsvarSIGNs' by Wang & Woźniak (2024) <doi:10.32614/CRAN.package.bsvarSIGNs>, 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
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.
Finally, all of the models share the following assumptions regarding the structural
shocks U
, namely, joint conditional normality given the past observations collected
in matrix X
, and temporal and contemporaneous independence. The latter implies
zero correlations and autocorrelations.
The various SVAR models estimated differ by the specification of structural shocks variances. The different models include:
homoskedastic model with unit variances
heteroskedastic model with stationary Markov switching in the variances
heteroskedastic model with non-centred Stochastic Volatility process for variances
heteroskedastic model with centred Stochastic Volatility process for variances
a model with Student-t distributed structural shocks
non-normal model with a finite mixture of normal components and component-specific variances
heteroskedastic model with sparse Markov switching in the variances where the number of heteroskedastic components is estimated
non-normal model with a sparse mixture of normal components and component-specific variances where the number of heteroskedastic components is estimated
Prior distributions. All the models feature a Minnesota prior for autoregressive
parameters in matrix and a generalised-normal distribution for the structural
matrix
. Both of these distributions feature a 3-level equation-specific
local-global hierarchical prior that make the shrinkage estimation flexible improving
the model fit and its forecasting performance.
Estimation algorithm. The models are estimated using frontier numerical methods making the Gibbs sampler fast and efficient. The sampler of the structural matrix follows Waggoner & Zha (2003), whereas that for autoregressive parameters follows Chan, Koop, Yu (2022). The specification of Markov switching heteroskedasticity is inspired by Song & Woźniak (2021), and that of Stochastic Volatility model by Kastner & Frühwirth-Schnatter (2014). The estimation algorithms for particular models are scrutinised in Lütkepohl, Shang, Uzeda, & Woźniak (2024) and Woźniak & Droumaguet (2024) and some other inferential and identification problems are considered in Lütkepohl & Woźniak (2020).
This package is currently in active development. Your comments, suggestions and requests are warmly welcome!
Tomasz Woźniak [email protected]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Kastner, G. and Frühwirth-Schnatter, S. (2014) Ancillarity-Sufficiency Interweaving Strategy (ASIS) for Boosting MCMC Estimation of Stochastic Volatility Models. Computational Statistics & Data Analysis, 76, 408–423, doi:10.1016/j.csda.2013.01.002.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Song, Y., and Woźniak, T. (2021) Markov Switching Heteroskedasticity in Time Series Analysis. In: Oxford Research Encyclopedia of Economics and Finance. Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs.
Useful links:
# upload data data(us_fiscal_lsuw) # upload dependent variables data(us_fiscal_ex) # upload exogenous variables # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> compute_variance_decompositions(horizon = 8) -> fevds # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
# upload data data(us_fiscal_lsuw) # upload dependent variables data(us_fiscal_ex) # upload exogenous variables # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> compute_variance_decompositions(horizon = 8) -> fevds # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
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.
compute_conditional_sd(posterior)
compute_conditional_sd(posterior)
posterior |
posterior estimation outcome obtained by running the
|
An object of class PosteriorSigma
, that is, an NxTxS
array with attribute PosteriorSigma
containing S
draws of the
structural shock conditional standard deviations.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
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 'PosteriorBSVAR' compute_conditional_sd(posterior)
## S3 method for class 'PosteriorBSVAR' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
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 'PosteriorBSVARMIX' compute_conditional_sd(posterior)
## S3 method for class 'PosteriorBSVARMIX' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations csd = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations csd = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
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 'PosteriorBSVARMSH' compute_conditional_sd(posterior)
## S3 method for class 'PosteriorBSVARMSH' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations csd = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations csd = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
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 'PosteriorBSVARSV' compute_conditional_sd(posterior)
## S3 method for class 'PosteriorBSVARSV' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations csd = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations csd = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
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 'PosteriorBSVART' compute_conditional_sd(posterior)
## S3 method for class 'PosteriorBSVART' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_conditional_sd() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> 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.
compute_fitted_values(posterior)
compute_fitted_values(posterior)
posterior |
posterior estimation outcome
obtained by running the |
An object of class PosteriorFitted
, that is, an NxTxS
array with attribute PosteriorFitted
containing S
draws from
the data predictive density.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> fitted
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> 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 data predictive density.
## S3 method for class 'PosteriorBSVAR' compute_fitted_values(posterior)
## S3 method for class 'PosteriorBSVAR' 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.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> fitted
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> 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 data predictive density.
## S3 method for class 'PosteriorBSVARMIX' compute_fitted_values(posterior)
## S3 method for class 'PosteriorBSVARMIX' 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.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density csd = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density csd = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> 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 'PosteriorBSVARMSH' compute_fitted_values(posterior)
## S3 method for class 'PosteriorBSVARMSH' 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.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density csd = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density csd = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> 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 'PosteriorBSVARSV' compute_fitted_values(posterior)
## S3 method for class 'PosteriorBSVARSV' 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.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density csd = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> csd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density csd = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> csd
Each of the draws from the posterior estimation of the model is transformed into a draw from the data predictive density.
## S3 method for class 'PosteriorBSVART' compute_fitted_values(posterior)
## S3 method for class 'PosteriorBSVART' 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.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() -> fitted
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute draws from in-sample predictive density fitted = compute_fitted_values(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> 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.
compute_historical_decompositions(posterior, show_progress = TRUE)
compute_historical_decompositions(posterior, show_progress = TRUE)
posterior |
posterior estimation outcome obtained by running the |
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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(diff(us_fiscal_lsuw), p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() -> hd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(diff(us_fiscal_lsuw), p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> 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 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 'PosteriorBSVAR' compute_historical_decompositions(posterior, show_progress = TRUE)
## S3 method for class 'PosteriorBSVAR' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(diff(us_fiscal_lsuw), p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() -> hd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(diff(us_fiscal_lsuw), p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> 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 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 'PosteriorBSVARMIX' compute_historical_decompositions(posterior, show_progress = TRUE)
## S3 method for class 'PosteriorBSVARMIX' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() -> hds
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() -> hds
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 'PosteriorBSVARMSH' compute_historical_decompositions(posterior, show_progress = TRUE)
## S3 method for class 'PosteriorBSVARMSH' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() -> hds
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() -> hds
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 'PosteriorBSVARSV' compute_historical_decompositions(posterior, show_progress = TRUE)
## S3 method for class 'PosteriorBSVARSV' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 5) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 5) |> estimate(S = 5) |> compute_historical_decompositions() -> hds
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 5) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 5) |> estimate(S = 5) |> compute_historical_decompositions() -> hds
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 'PosteriorBSVART' compute_historical_decompositions(posterior, show_progress = TRUE)
## S3 method for class 'PosteriorBSVART' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(diff(us_fiscal_lsuw), p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 10) |> compute_historical_decompositions() -> hd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(diff(us_fiscal_lsuw), p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10) # compute historical decompositions hd = compute_historical_decompositions(posterior) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> 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.
compute_impulse_responses(posterior, horizon, standardise = FALSE)
compute_impulse_responses(posterior, horizon, standardise = FALSE)
posterior |
posterior estimation outcome obtained by running the |
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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 8) -> ir
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> 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 impulse responses.
## S3 method for class 'PosteriorBSVAR' compute_impulse_responses(posterior, horizon, standardise = FALSE)
## S3 method for class 'PosteriorBSVAR' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 8) -> ir
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses 2 years ahead irf = compute_impulse_responses(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> 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 impulse responses.
## S3 method for class 'PosteriorBSVARMIX' compute_impulse_responses(posterior, horizon, standardise = FALSE)
## S3 method for class 'PosteriorBSVARMIX' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
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 'PosteriorBSVARMSH' compute_impulse_responses(posterior, horizon, standardise = FALSE)
## S3 method for class 'PosteriorBSVARMSH' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
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 'PosteriorBSVARSV' compute_impulse_responses(posterior, horizon, standardise = FALSE)
## S3 method for class 'PosteriorBSVARSV' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
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 'PosteriorBSVART' compute_impulse_responses(posterior, horizon, standardise = FALSE)
## S3 method for class 'PosteriorBSVART' 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.
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
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irfs = compute_impulse_responses(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) -> irfs
Each of the draws from the posterior estimation of a model is transformed into
a draw from the posterior distribution of the regime probabilities. These represent either
the realisations of the regime indicators, when type = "realized"
, filtered probabilities,
when type = "filtered"
, forecasted regime probabilities, when type = "forecasted"
,
or the smoothed probabilities, when type = "smoothed"
, .
compute_regime_probabilities( posterior, type = c("realized", "filtered", "forecasted", "smoothed") )
compute_regime_probabilities( posterior, type = c("realized", "filtered", "forecasted", "smoothed") )
posterior |
posterior estimation outcome of regime-dependent heteroskedastic models
- an object of either of the classes: PosteriorBSVARMSH, or PosteriorBSVARMIX
obtained by running the |
type |
one of the values |
An object of class PosteriorRegimePr, that is, an MxTxS
array with attribute PosteriorRegimePr
containing S
draws of the regime probabilities.
Tomasz Woźniak [email protected]
Song, Y., and Woźniak, T., (2021) Markov Switching. Oxford Research Encyclopedia of Economics and Finance, Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 2, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute the posterior draws of realized regime indicators regimes = compute_regime_probabilities(posterior) # compute the posterior draws of filtered probabilities filtered = compute_regime_probabilities(posterior, "filtered") # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) -> posterior regimes = compute_regime_probabilities(posterior) filtered = compute_regime_probabilities(posterior, "filtered")
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 2, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute the posterior draws of realized regime indicators regimes = compute_regime_probabilities(posterior) # compute the posterior draws of filtered probabilities filtered = compute_regime_probabilities(posterior, "filtered") # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) -> posterior regimes = compute_regime_probabilities(posterior) filtered = compute_regime_probabilities(posterior, "filtered")
Each of the draws from the posterior estimation of a model is transformed into
a draw from the posterior distribution of the regime probabilities. These represent either
the realisations of the regime indicators, when type = "realized"
, filtered probabilities,
when type = "filtered"
, forecasted regime probabilities, when type = "forecasted"
,
or the smoothed probabilities, when type = "smoothed"
, .
## S3 method for class 'PosteriorBSVARMIX' compute_regime_probabilities( posterior, type = c("realized", "filtered", "forecasted", "smoothed") )
## S3 method for class 'PosteriorBSVARMIX' compute_regime_probabilities( posterior, type = c("realized", "filtered", "forecasted", "smoothed") )
posterior |
posterior estimation outcome - an object of class
|
type |
one of the values |
An object of class PosteriorRegimePr, that is, an MxTxS
array with attribute PosteriorRegimePr
containing S
draws of the regime probabilities.
Tomasz Woźniak [email protected]
Song, Y., and Woźniak, T., (2021) Markov Switching. Oxford Research Encyclopedia of Economics and Finance, Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 2, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute the posterior draws of realized regime indicators regimes = compute_regime_probabilities(posterior) # compute the posterior draws of filtered probabilities filtered = compute_regime_probabilities(posterior, "filtered") # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) -> posterior regimes = compute_regime_probabilities(posterior) filtered = compute_regime_probabilities(posterior, "filtered")
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 2, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute the posterior draws of realized regime indicators regimes = compute_regime_probabilities(posterior) # compute the posterior draws of filtered probabilities filtered = compute_regime_probabilities(posterior, "filtered") # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) -> posterior regimes = compute_regime_probabilities(posterior) filtered = compute_regime_probabilities(posterior, "filtered")
Each of the draws from the posterior estimation of a model is transformed into
a draw from the posterior distribution of the regime probabilities. These represent either
the realisations of the regime indicators, when type = "realized"
, filtered probabilities,
when type = "filtered"
, forecasted regime probabilities, when type = "forecasted"
,
or the smoothed probabilities, when type = "smoothed"
, .
## S3 method for class 'PosteriorBSVARMSH' compute_regime_probabilities( posterior, type = c("realized", "filtered", "forecasted", "smoothed") )
## S3 method for class 'PosteriorBSVARMSH' compute_regime_probabilities( posterior, type = c("realized", "filtered", "forecasted", "smoothed") )
posterior |
posterior estimation outcome - an object of class
|
type |
one of the values |
An object of class PosteriorRegimePr, that is, an MxTxS
array with attribute PosteriorRegimePr
containing S
draws of the regime probabilities.
Tomasz Woźniak [email protected]
Song, Y., and Woźniak, T., (2021) Markov Switching. Oxford Research Encyclopedia of Economics and Finance, Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 2, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute the posterior draws of realized regime indicators regimes = compute_regime_probabilities(posterior) # compute the posterior draws of filtered probabilities filtered = compute_regime_probabilities(posterior, "filtered") # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) -> posterior regimes = compute_regime_probabilities(posterior) filtered = compute_regime_probabilities(posterior, "filtered")
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 2, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute the posterior draws of realized regime indicators regimes = compute_regime_probabilities(posterior) # compute the posterior draws of filtered probabilities filtered = compute_regime_probabilities(posterior, "filtered") # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) -> posterior regimes = compute_regime_probabilities(posterior) filtered = compute_regime_probabilities(posterior, "filtered")
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.
compute_structural_shocks(posterior)
compute_structural_shocks(posterior)
posterior |
posterior estimation outcome obtained by running the |
An object of class PosteriorShocks, that is, an NxTxS
array with attribute PosteriorShocks
containing S
draws of the structural shocks.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
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 'PosteriorBSVAR' compute_structural_shocks(posterior)
## S3 method for class 'PosteriorBSVAR' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
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 'PosteriorBSVARMIX' compute_structural_shocks(posterior)
## S3 method for class 'PosteriorBSVARMIX' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
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 'PosteriorBSVARMSH' compute_structural_shocks(posterior)
## S3 method for class 'PosteriorBSVARMSH' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
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 'PosteriorBSVARSV' compute_structural_shocks(posterior)
## S3 method for class 'PosteriorBSVARSV' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
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 'PosteriorBSVART' compute_structural_shocks(posterior)
## S3 method for class 'PosteriorBSVART' 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.
Tomasz Woźniak [email protected]
estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() -> ss
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 forecast error variance decomposition.
compute_variance_decompositions(posterior, horizon)
compute_variance_decompositions(posterior, horizon)
posterior |
posterior estimation outcome obtained by running the |
horizon |
a positive integer number denoting the forecast horizon for the forecast error variance decomposition 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.
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
, estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
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 'PosteriorBSVAR' compute_variance_decompositions(posterior, horizon)
## S3 method for class 'PosteriorBSVAR' compute_variance_decompositions(posterior, horizon)
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer number denoting the forecast horizon for the forecast error variance decomposition 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.
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
, estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
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. In this mixture model the forecast error variance decompositions are computed for the forecasts with the origin at the last observation in sample data and using the conditional variance forecasts.
## S3 method for class 'PosteriorBSVARMIX' compute_variance_decompositions(posterior, horizon)
## S3 method for class 'PosteriorBSVARMIX' compute_variance_decompositions(posterior, horizon)
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer number denoting the forecast horizon for the forecast error variance decomposition 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.
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
, estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
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. In this heteroskedastic model the forecast error variance decompositions are computed for the forecasts with the origin at the last observation in sample data and using the conditional variance forecasts.
## S3 method for class 'PosteriorBSVARMSH' compute_variance_decompositions(posterior, horizon)
## S3 method for class 'PosteriorBSVARMSH' compute_variance_decompositions(posterior, horizon)
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer number denoting the forecast horizon for the forecast error variance decomposition 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.
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
, estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
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. In this heteroskedastic model the forecast error variance decompositions are computed for the forecasts with the origin at the last observation in sample data and using the conditional variance forecasts.
## S3 method for class 'PosteriorBSVARSV' compute_variance_decompositions(posterior, horizon)
## S3 method for class 'PosteriorBSVARSV' compute_variance_decompositions(posterior, horizon)
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer number denoting the forecast horizon for the forecast error variance decomposition 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.
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
, estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
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 'PosteriorBSVART' compute_variance_decompositions(posterior, horizon)
## S3 method for class 'PosteriorBSVART' compute_variance_decompositions(posterior, horizon)
posterior |
posterior estimation outcome - an object of class
|
horizon |
a positive integer number denoting the forecast horizon for the forecast error variance decomposition 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.
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
, estimate
, normalise_posterior
, summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decomposition 2 years ahead fevd = compute_variance_decompositions(posterior, horizon = 8) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 8) -> fevd
Estimates homo- or heteroskedastic SVAR models for packages bsvars
and bsvarSIGNs. The packages apply the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. Additionally, the parameter matrices
and
follow a Minnesota prior and generalised-normal prior distributions respectively with the matrix-specific
3-level equation-specific local-global hierarchical prior for the shrinkage parameters. A variety of models
for conditional variances are possible including versions of Stochastic Volatility and Markov-switching heteroskedasticity.
Non-normal specifications include finite and sparse normal mixture model for the structural shocks.
The estimation algorithms for particular models are scrutinised in
Lütkepohl, Shang, Uzeda, & Woźniak (2024) and Woźniak & Droumaguet (2024)
and some other inferential and identification problems are considered in
Lütkepohl & Woźniak (2020) and Song & Woźniak (2021).
Models from package bsvars implement identification via exclusion restrictions,
heteroskedasticity and non-normality. Models from package bsvarSIGNs implement
identification via sign and narrative restrictions.
See section Details and package bsvarSIGNs documentation for more information.
estimate(specification, S, thin = 1, show_progress = TRUE)
estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object generated using one of 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 homoskedastic SVAR 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.
The structural shocks, U
, are temporally and contemporaneously independent and jointly normally distributed with zero mean and unit variances.
The various SVAR models estimated differ by the specification of structural shocks
variances. Their specification depends on the specify_bsvar*
function used. The different models include:
homoskedastic model with unit variances
heteroskedastic model with stationary Markov switching in the variances
heteroskedastic model with Stochastic Volatility process for variances
non-normal model with a finite mixture of normal components and component-specific variances
heteroskedastic model with sparse Markov switching in the variances where the number of heteroskedastic components is estimated
non-normal model with a sparse mixture of normal components and component-specific variances where the number of heteroskedastic components is estimated
An object of class PosteriorBSVAR* 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 many arrays and vectors whose selection depends on the model specification.
last_draw
an object generated by one of the specify_bsvar*
functions 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Song, Y., and Woźniak, T. (2021) Markov Switching Heteroskedasticity in Time Series Analysis. In: Oxford Research Encyclopedia of Economics and Finance. Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs.
specify_bsvar
, specify_bsvar_msh
, specify_bsvar_mix
, specify_bsvar_sv
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) -> posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) -> posterior
Estimates the homoskedastic SVAR using the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. 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
as in Lütkepohl, Shang, Uzeda, and Woźniak (2024). See section Details for the model equations.
## S3 method for class 'BSVAR' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'BSVAR' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class BSVAR 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 homoskedastic SVAR 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.
Finally, the structural shocks, U
, are temporally and contemporaneously independent and jointly normally distributed with zero mean and unit variances.
An object of class PosteriorBSVAR 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
last_draw
an object of class BSVAR 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
specify_bsvar
, specify_posterior_bsvar
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the SVAR with non-normal residuals following a finite M
mixture of normal distributions proposed by Woźniak & Droumaguet (2022).
Implements the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. Additionally, the parameter matrices
and
follow a Minnesota prior and generalised-normal prior distributions respectively with the matrix-specific
overall shrinkage parameters estimated thanks to a hierarchical prior distribution. The finite mixture of normals
model is estimated using the prior distributions and algorithms proposed by Woźniak & Droumaguet (2024),
Lütkepohl & Woźniak (2020), and Song & Woźniak (2021). See section Details for the model equations.
## S3 method for class 'BSVARMIX' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'BSVARMIX' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class BSVARMIX 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 heteroskedastic SVAR 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.
Finally, the structural shocks, , are temporally and contemporaneously independent and finite-mixture of normals distributed with zero mean.
The conditional variance of the
n
th shock at time t
is given by:
where is a the regime indicator of
the regime-specific conditional variances of structural shocks
.
In this model, the variances of each of the structural shocks sum to
M
.
The regime indicator is either such that:
the regime probabilities are non-zero which requires all regimes to have a positive number occurrences over the sample period, or
sparse with potentially many regimes with zero occurrences over the sample period and in which the number of regimes is estimated.
These model selection also with this respect is made using function specify_bsvar_mix
.
An object of class PosteriorBSVARMIX 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 NxMxS
array with the posterior draws for the structural shocks conditional variances
an MxMxS
array with the posterior draws for the transition matrix.
an MxTxS
array with the posterior draws for the regime allocation matrix.
an MxS
matrix with the posterior draws for the ergodic probabilities
an NxTxS
array with the posterior draws for the structural shocks conditional standard deviations' series over the sample period
last_draw
an object of class BSVARMIX 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Song, Y., and Woźniak, T., (2021) Markov Switching. Oxford Research Encyclopedia of Economics and Finance, Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
specify_bsvar_mix
, specify_posterior_bsvar_mix
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the SVAR with Markov-switching heteroskedasticity with M
regimes (MS(M)) proposed by Woźniak & Droumaguet (2022).
Implements the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. Additionally, the parameter matrices
and
follow a Minnesota prior and generalised-normal prior distributions respectively with the matrix-specific
overall shrinkage parameters estimated thanks to a hierarchical prior distribution. The MS
model is estimated using the prior distributions and algorithms proposed by Woźniak & Droumaguet (2024),
Lütkepohl & Woźniak (2020), and Song & Woźniak (2021). See section Details for the model equations.
## S3 method for class 'BSVARMSH' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'BSVARMSH' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class BSVARMSH 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 heteroskedastic SVAR 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 X
.
The structural equation is given by
where is an
NxT
matrix of structural form error terms, and
is an
NxN
matrix of contemporaneous relationships.
Finally, the structural shocks, , are temporally and contemporaneously independent and jointly normally distributed with zero mean.
The conditional variance of the
n
th shock at time t
is given by:
where is a Markov process driving the time-variability of
the regime-specific conditional variances of structural shocks
.
In this model, the variances of each of the structural shocks sum to
M
.
The Markov process is either:
stationary, irreducible, and aperiodic which requires all regimes to have a positive number occurrences over the sample period, or
sparse with potentially many regimes with zero occurrences over the sample period and in which the number of regimes is estimated.
These model selection also with this respect is made using function specify_bsvar_msh
.
An object of class PosteriorBSVARMSH 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 NxMxS
array with the posterior draws for the structural shocks conditional variances
an MxMxS
array with the posterior draws for the transition matrix.
an MxTxS
array with the posterior draws for the regime allocation matrix.
an MxS
matrix with the posterior draws for the initial state probabilities
an NxTxS
array with the posterior draws for the structural shocks conditional standard deviations' series over the sample period
last_draw
an object of class BSVARMSH 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Song, Y., and Woźniak, T., (2021) Markov Switching. Oxford Research Encyclopedia of Economics and Finance, Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
specify_bsvar_msh
, specify_posterior_bsvar_msh
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the SVAR with Stochastic Volatility (SV) heteroskedasticity
proposed by Lütkepohl, Shang, Uzeda, and Woźniak (2024).
Implements the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler
by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. Additionally,
the parameter matrices
and
follow a Minnesota prior and generalised-normal prior distributions
respectively with the matrix-specific
overall shrinkage parameters estimated thanks to a hierarchical prior distribution.
The SV model is estimated using a range of techniques including:
simulation smoother, auxiliary mixture, ancillarity-sufficiency interweaving strategy,
and generalised inverse Gaussian distribution summarised by Kastner & Frühwirth-Schnatter (2014).
See section Details for the model equations.
## S3 method for class 'BSVARSV' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'BSVARSV' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class BSVARSV 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 heteroskedastic SVAR 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.
Finally, the structural shocks, , are temporally and contemporaneously independent and jointly normally distributed with zero mean.
Two alternative specifications of the conditional variance of the n
th shock at time t
can be estimated: non-centred Stochastic Volatility by Lütkepohl, Shang, Uzeda, and Woźniak (2022)
or centred Stochastic Volatility by Chan, Koop, & Yu (2021).
The non-centred Stochastic Volatility by Lütkepohl, Shang, Uzeda, and Woźniak (2022)
is selected by setting argument centred_sv
of function specify_bsvar_sv$new()
to value FALSE
.
It has the conditional variances given by:
where is the estimated conditional standard deviation of the log-conditional variance
and the log-volatility process
follows an autoregressive process:
where ,
is an autoregressive parameter and
is a standard normal error term.
The centred Stochastic Volatility by Chan, Koop, & Yu (2021)
is selected by setting argument centred_sv
of function specify_bsvar_sv$new()
to value TRUE
.
Its conditional variances are given by:
where the log-conditional variances follow an autoregressive process:
where ,
is an autoregressive parameter and
is a zero-mean normal error term
with variance
.
An object of class PosteriorBSVARSV 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 NxTxS
array with the posterior draws of the log-volatility processes
an NxS
matrix with the posterior draws of SV autoregressive parameters
an NxS
matrix with the posterior draws of SV process conditional standard deviations
an NxTxS
array with the posterior draws of the auxiliary mixture component indicators
an NxS
matrix with the posterior draws of the variances of the zero-mean normal prior for omega
an S
-vector with the posterior draws of the scale of the gamma prior of the hierarchical prior for sigma2_omega
last_draw
an object of class BSVARSV 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Kastner, G. and Frühwirth-Schnatter, S. (2014) Ancillarity-Sufficiency Interweaving Strategy (ASIS) for Boosting MCMC Estimation of Stochastic Volatility Models. Computational Statistics & Data Analysis, 76, 408–423, doi:10.1016/j.csda.2013.01.002.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
specify_bsvar_sv
, specify_posterior_bsvar_sv
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20, 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20, 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the homoskedastic SVAR using the Gibbs sampler proposed
by Waggoner & Zha (2003) for the structural matrix and the
equation-by-equation sampler by Chan, Koop, & Yu (2024) for the autoregressive
slope parameters
. The Robust Adaptive Metropolis algorithm by
Vihola (2012) is used to the
df
parameter of the Student-t distribution.
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 as in Lütkepohl, Shang, Uzeda, and Woźniak (2024).
See section Details for the model equations.
## S3 method for class 'BSVART' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'BSVART' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class BSVART 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 homoskedastic SVAR model with t-distributed structural shocks 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.
Finally, the structural shocks, U
, are temporally and contemporaneously
independent and jointly Student-t distributed with zero mean, unit variances,
and an estimated degrees-of-freedom parameter.
An object of class PosteriorBSVART 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 S
vector with the posterior draws for the degrees-of-freedom
parameter of the Student-t distribution
a TxS
matrix with the posterior draws for the latent variable
last_draw
an object of class BSVART 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Vihola, M. (2012) Robust adaptive Metropolis algorithm with coerced acceptance rate. Statistics & Computing, 22, 997–1008, doi:10.1007/s11222-011-9269-5.
specify_bsvar_t
, specify_posterior_bsvar_t
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) -> posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) -> posterior
Estimates the homoskedastic SVAR using the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. 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
as in Lütkepohl, Shang, Uzeda, and Woźniak (2024). See section Details for the model equations.
## S3 method for class 'PosteriorBSVAR' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'PosteriorBSVAR' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class PosteriorBSVAR 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 homoskedastic SVAR 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.
Finally, the structural shocks, U
, are temporally and contemporaneously independent and jointly normally distributed with zero mean and unit variances.
An object of class PosteriorBSVAR 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
last_draw
an object of class BSVAR 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
specify_bsvar
, specify_posterior_bsvar
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the SVAR with non-normal residuals following a finite M
mixture of normal distributions proposed by Woźniak & Droumaguet (2022).
Implements the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. Additionally, the parameter matrices
and
follow a Minnesota prior and generalised-normal prior distributions respectively with the matrix-specific
overall shrinkage parameters estimated thanks to a hierarchical prior distribution. The finite mixture of normals
model is estimated using the prior distributions and algorithms proposed by Woźniak & Droumaguet (2024),
Lütkepohl & Woźniak (2020), and Song & Woźniak (2021). See section Details for the model equations.
## S3 method for class 'PosteriorBSVARMIX' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'PosteriorBSVARMIX' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class PosteriorBSVARMIX 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 heteroskedastic SVAR 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.
Finally, the structural shocks, , are temporally and contemporaneously independent and finite-mixture of normals distributed with zero mean.
The conditional variance of the
n
th shock at time t
is given by:
where is a the regime indicator of
the regime-specific conditional variances of structural shocks
.
In this model, the variances of each of the structural shocks sum to
M
.
The regime indicator is either such that:
the regime probabilities are non-zero which requires all regimes to have a positive number occurrences over the sample period, or
sparse with potentially many regimes with zero occurrences over the sample period and in which the number of regimes is estimated.
These model selection also with this respect is made using function specify_bsvar_mix
.
An object of class PosteriorBSVARMIX 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 NxMxS
array with the posterior draws for the structural shocks conditional variances
an MxMxS
array with the posterior draws for the transition matrix.
an MxTxS
array with the posterior draws for the regime allocation matrix.
an MxS
matrix with the posterior draws for the ergodic probabilities
an NxTxS
array with the posterior draws for the structural shocks conditional standard deviations' series over the sample period
last_draw
an object of class BSVARMIX 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Song, Y., and Woźniak, T., (2021) Markov Switching. Oxford Research Encyclopedia of Economics and Finance, Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
specify_bsvar_mix
, specify_posterior_bsvar_mix
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> estimate(S = 20, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the SVAR with Markov-switching heteroskedasticity with M
regimes (MS(M)) proposed by Woźniak & Droumaguet (2022).
Implements the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. Additionally, the parameter matrices
and
follow a Minnesota prior and generalised-normal prior distributions respectively with the matrix-specific
overall shrinkage parameters estimated thanks to a hierarchical prior distribution. The MS
model is estimated using the prior distributions and algorithms proposed by Woźniak & Droumaguet (2024),
Lütkepohl & Woźniak (2020), and Song & Woźniak (2021). See section Details for the model equations.
## S3 method for class 'PosteriorBSVARMSH' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'PosteriorBSVARMSH' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class PosteriorBSVARMSH 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 heteroskedastic SVAR 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 X
.
The structural equation is given by
where is an
NxT
matrix of structural form error terms, and
is an
NxN
matrix of contemporaneous relationships.
Finally, the structural shocks, , are temporally and contemporaneously independent and jointly normally distributed with zero mean.
The conditional variance of the
n
th shock at time t
is given by:
where is a Markov process driving the time-variability of
the regime-specific conditional variances of structural shocks
.
In this model, the variances of each of the structural shocks sum to
M
.
The Markov process is either:
stationary, irreducible, and aperiodic which requires all regimes to have a positive number occurrences over the sample period, or
sparse with potentially many regimes with zero occurrences over the sample period and in which the number of regimes is estimated.
These model selection also with this respect is made using function specify_bsvar_msh
.
An object of class PosteriorBSVARMSH 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 NxMxS
array with the posterior draws for the structural shocks conditional variances
an MxMxS
array with the posterior draws for the transition matrix.
an MxTxS
array with the posterior draws for the regime allocation matrix.
an MxS
matrix with the posterior draws for the initial state probabilities
an NxTxS
array with the posterior draws for the structural shocks conditional standard deviations' series over the sample period
last_draw
an object of class BSVARMSH 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Song, Y., and Woźniak, T., (2021) Markov Switching. Oxford Research Encyclopedia of Economics and Finance, Oxford University Press, doi:10.1093/acrefore/9780190625979.013.174.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
specify_bsvar_msh
, specify_posterior_bsvar_msh
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the SVAR with Stochastic Volatility (SV) heteroskedasticity
proposed by Lütkepohl, Shang, Uzeda, and Woźniak (2024).
Implements the Gibbs sampler proposed by Waggoner & Zha (2003)
for the structural matrix and the equation-by-equation sampler
by Chan, Koop, & Yu (2024)
for the autoregressive slope parameters
. Additionally,
the parameter matrices
and
follow a Minnesota prior and generalised-normal prior distributions
respectively with the matrix-specific
overall shrinkage parameters estimated thanks to a hierarchical prior distribution.
The SV model is estimated using a range of techniques including:
simulation smoother, auxiliary mixture, ancillarity-sufficiency interweaving strategy,
and generalised inverse Gaussian distribution summarised by Kastner & Frühwirth-Schnatter (2014).
See section Details for the model equations.
## S3 method for class 'PosteriorBSVARSV' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'PosteriorBSVARSV' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class PosteriorBSVARSV 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 heteroskedastic SVAR 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.
Finally, the structural shocks, , are temporally and contemporaneously independent and jointly normally distributed with zero mean.
Two alternative specifications of the conditional variance of the n
th shock at time t
can be estimated: non-centred Stochastic Volatility by Lütkepohl, Shang, Uzeda, and Woźniak (2022)
or centred Stochastic Volatility by Chan, Koop, & Yu (2021).
The non-centred Stochastic Volatility by Lütkepohl, Shang, Uzeda, and Woźniak (2022)
is selected by setting argument centred_sv
of function specify_bsvar_sv$new()
to value FALSE
.
It has the conditional variances given by:
where is the estimated conditional standard deviation of the log-conditional variance
and the log-volatility process
follows an autoregressive process:
where ,
is an autoregressive parameter and
is a standard normal error term.
The centred Stochastic Volatility by Chan, Koop, & Yu (2021)
is selected by setting argument centred_sv
of function specify_bsvar_sv$new()
to value TRUE
.
Its conditional variances are given by:
where the log-conditional variances follow an autoregressive process:
where ,
is an autoregressive parameter and
is a zero-mean normal error term
with variance
.
An object of class PosteriorBSVARSV 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 NxTxS
array with the posterior draws of the log-volatility processes
an NxS
matrix with the posterior draws of SV autoregressive parameters
an NxS
matrix with the posterior draws of SV process conditional standard deviations
an NxTxS
array with the posterior draws of the auxiliary mixture component indicators
an NxS
matrix with the posterior draws of the variances of the zero-mean normal prior for omega
an S
-vector with the posterior draws of the scale of the gamma prior of the hierarchical prior for sigma2_omega
last_draw
an object of class BSVARSV 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Kastner, G. and Frühwirth-Schnatter, S. (2014) Ancillarity-Sufficiency Interweaving Strategy (ASIS) for Boosting MCMC Estimation of Stochastic Volatility Models. Computational Statistics & Data Analysis, 76, 408–423, doi:10.1016/j.csda.2013.01.002.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
specify_bsvar_sv
, specify_posterior_bsvar_sv
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20, 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20, 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> estimate(S = 20, thin = 2) |> compute_impulse_responses(horizon = 4) -> irf
Estimates the homoskedastic SVAR using the Gibbs sampler proposed
by Waggoner & Zha (2003) for the structural matrix and the
equation-by-equation sampler by Chan, Koop, & Yu (2024) for the autoregressive
slope parameters
. The Robust Adaptive Metropolis algorithm by
Vihola (2012) is used to the
df
parameter of the Student-t distribution.
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 as in Lütkepohl, Shang, Uzeda, and Woźniak (2024).
See section Details for the model equations.
## S3 method for class 'PosteriorBSVART' estimate(specification, S, thin = 1, show_progress = TRUE)
## S3 method for class 'PosteriorBSVART' estimate(specification, S, thin = 1, show_progress = TRUE)
specification |
an object of class PosteriorBSVART 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 homoskedastic SVAR model with t-distributed structural shocks 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.
Finally, the structural shocks, U
, are temporally and contemporaneously
independent and jointly Student-t distributed with zero mean, unit variances,
and an estimated degrees-of-freedom parameter.
An object of class PosteriorBSVART 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 S
vector with the posterior draws for the degrees-of-freedom
parameter of the Student-t distribution
a TxS
matrix with the posterior draws for the latent variable
last_draw
an object of class BSVART 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]
Chan, J.C.C., Koop, G, and Yu, X. (2024) Large Order-Invariant Bayesian VARs with Stochastic Volatility. Journal of Business & Economic Statistics, 42, doi:10.1080/07350015.2023.2252039.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Waggoner, D.F., and Zha, T., (2003) A Gibbs sampler for structural vector autoregressions. Journal of Economic Dynamics and Control, 28, 349–366, doi:10.1016/S0165-1889(02)00168-9.
Vihola, M. (2012) Robust adaptive Metropolis algorithm with coerced acceptance rate. Statistics & Computing, 22, 997–1008, doi:10.1007/s11222-011-9269-5.
specify_bsvar_t
, specify_posterior_bsvar_t
, normalise_posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) -> posterior
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) set.seed(123) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10, thin = 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 5) |> estimate(S = 10, thin = 2) -> posterior
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.
forecast(posterior, horizon = 1, exogenous_forecast, conditional_forecast)
forecast(posterior, horizon = 1, exogenous_forecast, conditional_forecast)
posterior |
posterior estimation outcome
obtained by running the |
horizon |
a positive integer, specifying the forecasting horizon. |
exogenous_forecast |
forecasted values of the exogenous variables. |
conditional_forecast |
forecasted values for selected variables. |
A list of class Forecasts
containing the
draws from the predictive density and for heteroskedastic models the draws
from the predictive density of structural shocks conditional standard
deviations and data. The output elements include:
an NxTxS
array with the draws from predictive density
provided only for heteroskedastic models, an NxTxS
array with the draws
from the predictive density of structural shocks conditional standard deviations
an matrix with the data on dependent variables
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
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.
## S3 method for class 'PosteriorBSVAR' forecast( posterior, horizon = 1, exogenous_forecast = NULL, conditional_forecast = NULL )
## S3 method for class 'PosteriorBSVAR' 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 NxTxS
array with the draws from predictive density
an matrix with the data on dependent variables
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw, p = 1, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
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.
## S3 method for class 'PosteriorBSVARMIX' forecast( posterior, horizon = 1, exogenous_forecast = NULL, conditional_forecast = NULL )
## S3 method for class 'PosteriorBSVARMIX' 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 for heteroskedastic models the draws
from the predictive density of structural shocks conditional standard
deviations and data. The output elements include:
an NxTxS
array with the draws from predictive density
provided only for heteroskedastic models, an NxTxS
array with the draws
from the predictive density of structural shocks conditional standard deviations
an matrix with the data on dependent variables
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, M = 2, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(M = 2, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw, M = 2, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(M = 2, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
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.
## S3 method for class 'PosteriorBSVARMSH' forecast( posterior, horizon = 1, exogenous_forecast = NULL, conditional_forecast = NULL )
## S3 method for class 'PosteriorBSVARMSH' 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 for heteroskedastic models the draws
from the predictive density of structural shocks conditional standard
deviations and data. The output elements include:
an NxTxS
array with the draws from predictive density
provided only for heteroskedastic models, an NxTxS
array with the draws
from the predictive density of structural shocks conditional standard deviations
an matrix with the data on dependent variables
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, M = 2, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(M = 2, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw, M = 2, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(M = 2, exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
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.
## S3 method for class 'PosteriorBSVARSV' forecast( posterior, horizon = 1, exogenous_forecast = NULL, conditional_forecast = NULL )
## S3 method for class 'PosteriorBSVARSV' 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 for heteroskedastic models the draws
from the predictive density of structural shocks conditional standard
deviations and data. The output elements include:
an NxTxS
array with the draws from predictive density
provided only for heteroskedastic models, an NxTxS
array with the draws
from the predictive density of structural shocks conditional standard deviations
an matrix with the data on dependent variables
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 5) # sample from predictive density 1 year ahead predictive = forecast(posterior, 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 5) |> estimate(S = 5) |> forecast(horizon = 2) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 5) # sample from predictive density 1 year ahead predictive = forecast(posterior, 2) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 5) |> estimate(S = 5) |> forecast(horizon = 2) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
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.
## S3 method for class 'PosteriorBSVART' forecast( posterior, horizon = 1, exogenous_forecast = NULL, conditional_forecast = NULL )
## S3 method for class 'PosteriorBSVART' 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 NxTxS
array with the draws from predictive density
an matrix with the data on dependent variables
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 1) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 10) # sample from predictive density 1 year ahead predictive = forecast(posterior, 4) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(p = 1) |> estimate(S = 5) |> estimate(S = 10) |> forecast(horizon = 4) -> predictive # conditional forecasting using a model with exogenous variables ############################################################ data(us_fiscal_ex_forecasts) # upload exogenous variables future values data(us_fiscal_cond_forecasts) # upload a matrix with projected ttr #' set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw, exogenous = us_fiscal_ex) burn_in = estimate(specification, 5) posterior = estimate(burn_in, 10) # forecast 2 years ahead predictive = forecast( posterior, horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) summary(predictive) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new(exogenous = us_fiscal_ex) |> estimate(S = 5) |> estimate(S = 10) |> forecast( horizon = 8, exogenous_forecast = us_fiscal_ex_forecasts, conditional_forecast = us_fiscal_cond_forecasts ) |> plot()
Normalises the sign of rows of matrix MCMC draws,
provided as the first argument
posterior_B
, relative to matrix
B_hat
, provided as the second argument of the function. The implemented
procedure proposed by Waggoner, Zha (2003) normalises the MCMC output in an
optimal way leading to the unimodal posterior. Only normalised MCMC output is
suitable for the computations of the posterior characteristics of the
matrix elements and their functions such as the impulse response functions and other
economically interpretable values.
normalise_posterior(posterior, B_hat)
normalise_posterior(posterior, B_hat)
posterior |
posterior estimation outcome - an object of either of classes:
PosteriorBSVAR, PosteriorBSVARMSH, PosteriorBSVARMIX, or PosteriorBSVARSV
containing, amongst other draws, the |
B_hat |
an |
Nothing. The normalised elements overwrite the corresponding elements of
the first argument posterior_B
by reference.
Tomasz Woźniak [email protected]
Waggoner, D.F., and Zha, T., (2003) Likelihood Preserving Normalization in Multiple Equation Models. Journal of Econometrics, 114(2), 329–47, doi:10.1016/S0304-4076(03)00087-3.
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10, thin = 1) # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10, thin = 1) # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised
K
random variablesPlots the median and an interval between two specified percentiles
for a sequence of K
random variables based on the S
posterior
draws provided for each of them.
plot_ribbon( draws, probability = 0.9, col = "#ff69b4", ylim, ylab, xlab, start_at = 0, add = FALSE, ... )
plot_ribbon( draws, probability = 0.9, col = "#ff69b4", ylim, ylab, xlab, start_at = 0, add = FALSE, ... )
draws |
a |
probability |
a number from interval |
col |
a colour of the plot |
ylim |
the range of the |
ylab |
the label of the |
xlab |
the label of the |
start_at |
an integer to denote the beginning of the |
add |
a logical value. If |
... |
other graphical parameters to be passed to |
Tomasz Woźniak [email protected]
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model irf = compute_impulse_responses(posterior, horizon = 4) # impulse responses plot_ribbon(irf[1,1,,])
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model irf = compute_impulse_responses(posterior, horizon = 4) # impulse responses plot_ribbon(irf[1,1,,])
Plots of fitted values of dependent variables including their median and percentiles.
## S3 method for class 'Forecasts' plot( x, probability = 0.9, data_in_plot = 1, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'Forecasts' plot( x, probability = 0.9, data_in_plot = 1, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class Forecasts obtained using the
|
probability |
a parameter determining the interval to be plotted. The
interval stretches from the |
data_in_plot |
a fraction value in the range (0, 1) determining how many of the last observations in the data should be plotted with the forecasts. |
col |
a colour of the plot line and the ribbon |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute forecasts fore = forecast(posterior, horizon = 4) plot(fore) # plot forecasts # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> forecast(horizon = 4) |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute forecasts fore = forecast(posterior, horizon = 4) plot(fore) # plot forecasts # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> forecast(horizon = 4) |> plot()
Plots of the posterior means of the forecast error variance decompositions.
## S3 method for class 'PosteriorFEVD' plot( x, shock_names, cols, main, xlab, mar.multi = c(1, 4.6, 0, 4.6), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'PosteriorFEVD' plot( x, shock_names, cols, main, xlab, mar.multi = c(1, 4.6, 0, 4.6), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class PosteriorFEVD obtained using the
|
shock_names |
a vector of length |
cols |
an |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
compute_variance_decompositions
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute forecast error variance decompositions fevd = compute_variance_decompositions(posterior, horizon = 4) plot(fevd) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_variance_decompositions(horizon = 4) |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute forecast error variance decompositions fevd = compute_variance_decompositions(posterior, horizon = 4) plot(fevd) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_variance_decompositions(horizon = 4) |> plot()
Plots of fitted values of dependent variables including their median and percentiles.
## S3 method for class 'PosteriorFitted' plot( x, probability = 0.9, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'PosteriorFitted' plot( x, probability = 0.9, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class PosteriorFitted obtained using the
|
probability |
a parameter determining the interval to be plotted. The
interval stretches from the |
col |
a colour of the plot line and the ribbon |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute fitted values fitted = compute_fitted_values(posterior) plot(fitted) # plot fitted values # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_fitted_values() |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute fitted values fitted = compute_fitted_values(posterior) plot(fitted) # plot fitted values # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_fitted_values() |> plot()
Plots of the posterior means of the historical decompositions.
## S3 method for class 'PosteriorHD' plot( x, shock_names, cols, main, xlab, mar.multi = c(1, 4.6, 0, 4.6), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'PosteriorHD' plot( x, shock_names, cols, main, xlab, mar.multi = c(1, 4.6, 0, 4.6), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class PosteriorHD obtained using the
|
shock_names |
a vector of length |
cols |
an |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
compute_historical_decompositions
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute historical decompositions fevd = compute_historical_decompositions(posterior) plot(fevd) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_historical_decompositions() |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute historical decompositions fevd = compute_historical_decompositions(posterior) plot(fevd) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_historical_decompositions() |> plot()
Plots of of all variables to all shocks including their median and percentiles.
## S3 method for class 'PosteriorIR' plot( x, probability = 0.9, shock_names, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.1, 0, 1.1), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'PosteriorIR' plot( x, probability = 0.9, shock_names, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.1, 0, 1.1), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class PosteriorIR obtained using the
|
probability |
a parameter determining the interval to be plotted. The
interval stretches from the |
shock_names |
a vector of length |
col |
a colour of the plot line and the ribbon |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute impulse responses fitted = compute_impulse_responses(posterior, horizon = 4) plot(fitted) # plot # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_impulse_responses(horizon = 4) |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute impulse responses fitted = compute_impulse_responses(posterior, horizon = 4) plot(fitted) # plot # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_impulse_responses(horizon = 4) |> plot()
Plots of estimated regime probabilities of Markov-switching heteroskedasticity or allocations of normal-mixture components including their median and percentiles.
## S3 method for class 'PosteriorRegimePr' plot( x, probability = 0.9, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'PosteriorRegimePr' plot( x, probability = 0.9, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class PosteriorRegimePr obtained using the
|
probability |
a parameter determining the interval to be plotted. The
interval stretches from the |
col |
a colour of the plot line and the ribbon |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw)# specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute regime probabilities rp = compute_regime_probabilities(posterior) plot(rp) # plot # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_regime_probabilities() |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw)# specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute regime probabilities rp = compute_regime_probabilities(posterior) plot(rp) # plot # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_regime_probabilities() |> plot()
Plots of structural shocks including their median and percentiles.
## S3 method for class 'PosteriorShocks' plot( x, probability = 0.9, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'PosteriorShocks' plot( x, probability = 0.9, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class PosteriorShocks obtained using the
|
probability |
a parameter determining the interval to be plotted. The
interval stretches from the |
col |
a colour of the plot line and the ribbon |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute structural shocks shocks = compute_structural_shocks(posterior) plot(shocks) # plot # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_structural_shocks() |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 10) # run the burn-in posterior = estimate(burn_in, 20, thin = 1) # estimate the model # compute structural shocks shocks = compute_structural_shocks(posterior) plot(shocks) # plot # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20, thin = 1) |> compute_structural_shocks() |> plot()
Plots of structural shocks' conditional standard deviations including their median and percentiles.
## S3 method for class 'PosteriorSigma' plot( x, probability = 0.9, shock_names, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
## S3 method for class 'PosteriorSigma' plot( x, probability = 0.9, shock_names, col = "#ff69b4", main, xlab, mar.multi = c(1, 4.6, 0, 2.1), oma.multi = c(6, 0, 5, 0), ... )
x |
an object of class PosteriorSigma obtained using the
|
probability |
a parameter determining the interval to be plotted. The
interval stretches from the |
shock_names |
a vector of length |
col |
a colour of the plot line and the ribbon |
main |
an alternative main title for the plot |
xlab |
an alternative x-axis label for the plot |
mar.multi |
the default |
oma.multi |
the default |
... |
additional arguments affecting the summary produced. |
Tomasz Woźniak [email protected]
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 5) # run the burn-in posterior = estimate(burn_in, 5) # estimate the model # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) plot(sigma) # plot conditional sds # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 5) |> estimate(S = 5) |> compute_conditional_sd() |> plot()
data(us_fiscal_lsuw) # upload data set.seed(123) # set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw) # specify model burn_in = estimate(specification, 5) # run the burn-in posterior = estimate(burn_in, 5) # estimate the model # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) plot(sigma) # plot conditional sds # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 5) |> estimate(S = 5) |> compute_conditional_sd() |> plot()
The class BSVAR presents complete specification for the homoskedastic bsvar model.
p
a non-negative integer specifying the autoregressive lag order of the model.
identification
an object IdentificationBSVAR with the identifying restrictions.
prior
an object PriorBSVAR with the prior specification.
data_matrices
an object DataMatricesBSVAR with the data matrices.
starting_values
an object StartingValuesBSVAR with the starting values.
new()
Create a new specification of the homoskedastic bsvar model BSVAR.
specify_bsvar$new( data, p = 1L, B, 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.
B
a logical NxN
matrix containing value TRUE
for the elements of
the structural matrix to be estimated and value
FALSE
for exclusion restrictions
to be set to zero.
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 homoskedastic bsvar model BSVAR.
get_data_matrices()
Returns the data matrices as the DataMatricesBSVAR object.
specify_bsvar$get_data_matrices()
data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_data_matrices()
get_identification()
Returns the identifying restrictions as the IdentificationBSVARs object.
specify_bsvar$get_identification()
data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_identification()
get_prior()
Returns the prior specification as the PriorBSVAR object.
specify_bsvar$get_prior()
data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_prior()
get_starting_values()
Returns the starting values as the StartingValuesBSVAR object.
specify_bsvar$get_starting_values()
data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_starting_values()
clone()
The objects of this class are cloneable with this method.
specify_bsvar$clone(deep = FALSE)
deep
Whether to make a deep clone.
estimate
, specify_posterior_bsvar
data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) ## ------------------------------------------------ ## Method `specify_bsvar$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvar$get_identification` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvar$get_prior` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvar$get_starting_values` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_starting_values()
data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) ## ------------------------------------------------ ## Method `specify_bsvar$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvar$get_identification` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvar$get_prior` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvar$get_starting_values` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar$new( data = us_fiscal_lsuw, p = 4 ) spec$get_starting_values()
The class BSVARMIX presents complete specification for the BSVAR model with a zero-mean mixture of normals model for structural shocks.
bsvars::BSVARMSH
-> BSVARMIX
p
a non-negative integer specifying the autoregressive lag order of the model.
identification
an object IdentificationBSVARs with the identifying restrictions.
prior
an object PriorBSVARMIX with the prior specification.
data_matrices
an object DataMatricesBSVAR with the data matrices.
starting_values
an object StartingValuesBSVARMIX with the starting values.
finiteM
a logical value - if true a finite mixture model is estimated. Otherwise, a sparse mixture model is estimated in which M=20
and the number of visited states is estimated.
new()
Create a new specification of the BSVAR model with a zero-mean mixture of normals model for structural shocks, BSVARMIX.
specify_bsvar_mix$new( data, p = 1L, M = 2L, B, exogenous = NULL, stationary = rep(FALSE, ncol(data)), finiteM = TRUE )
data
a (T+p)xN
matrix with time series data.
p
a positive integer providing model's autoregressive lag order.
M
an integer greater than 1 - the number of components of the mixture of normals.
B
a logical NxN
matrix containing value TRUE
for the elements of the structural matrix to be estimated and value
FALSE
for exclusion restrictions to be set to zero.
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.
finiteM
a logical value - if true a finite mixture model is estimated. Otherwise, a sparse mixture model is estimated in which M=20
and the number of visited states is estimated.
A new complete specification for the bsvar model with a zero-mean mixture of normals model for structural shocks, BSVARMIX.
clone()
The objects of this class are cloneable with this method.
specify_bsvar_mix$clone(deep = FALSE)
deep
Whether to make a deep clone.
estimate
, specify_posterior_bsvar_mix
data(us_fiscal_lsuw) spec = specify_bsvar_mix$new( data = us_fiscal_lsuw, p = 4, M = 2 )
data(us_fiscal_lsuw) spec = specify_bsvar_mix$new( data = us_fiscal_lsuw, p = 4, M = 2 )
The class BSVARMSH presents complete specification for the BSVAR model with Markov Switching Heteroskedasticity.
p
a non-negative integer specifying the autoregressive lag order of the model.
identification
an object IdentificationBSVARs with the identifying restrictions.
prior
an object PriorBSVARMSH with the prior specification.
data_matrices
an object DataMatricesBSVAR with the data matrices.
starting_values
an object StartingValuesBSVARMSH with the starting values.
finiteM
a logical value - if true a stationary Markov switching model is estimated. Otherwise, a sparse Markov switching model is estimated in which M=20
and the number of visited states is estimated.
new()
Create a new specification of the BSVAR model with Markov Switching Heteroskedasticity, BSVARMSH.
specify_bsvar_msh$new( data, p = 1L, M = 2L, B, exogenous = NULL, stationary = rep(FALSE, ncol(data)), finiteM = TRUE )
data
a (T+p)xN
matrix with time series data.
p
a positive integer providing model's autoregressive lag order.
M
an integer greater than 1 - the number of Markov process' heteroskedastic regimes.
B
a logical NxN
matrix containing value TRUE
for the elements of the structural matrix to be estimated and value
FALSE
for exclusion restrictions to be set to zero.
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.
finiteM
a logical value - if true a stationary Markov switching model is estimated. Otherwise, a sparse Markov switching model is estimated in which M=20
and the number of visited states is estimated.
A new complete specification for the bsvar model with Markov Switching Heteroskedasticity, BSVARMSH.
get_data_matrices()
Returns the data matrices as the DataMatricesBSVAR object.
specify_bsvar_msh$get_data_matrices()
data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_data_matrices()
get_identification()
Returns the identifying restrictions as the IdentificationBSVARs object.
specify_bsvar_msh$get_identification()
data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_identification()
get_prior()
Returns the prior specification as the PriorBSVARMSH object.
specify_bsvar_msh$get_prior()
data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_prior()
get_starting_values()
Returns the starting values as the StartingValuesBSVARMSH object.
specify_bsvar_msh$get_starting_values()
data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_starting_values()
clone()
The objects of this class are cloneable with this method.
specify_bsvar_msh$clone(deep = FALSE)
deep
Whether to make a deep clone.
estimate
, specify_posterior_bsvar_msh
data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_identification` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_prior` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_starting_values` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_starting_values()
data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_identification` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_prior` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvar_msh$get_starting_values` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_msh$new( data = us_fiscal_lsuw, p = 4, M = 2 ) spec$get_starting_values()
The class BSVARSV presents complete specification for the BSVAR model with Stochastic Volatility heteroskedasticity.
p
a non-negative integer specifying the autoregressive lag order of the model.
identification
an object IdentificationBSVARs with the identifying restrictions.
prior
an object PriorBSVARSV with the prior specification.
data_matrices
an object DataMatricesBSVAR with the data matrices.
starting_values
an object StartingValuesBSVARSV with the starting values.
centred_sv
a logical value - if true a centred parameterisation of the Stochastic Volatility process is estimated. Otherwise, its non-centred parameterisation is estimated. See Lütkepohl, Shang, Uzeda, Woźniak (2022) for more info.
new()
Create a new specification of the BSVAR model with Stochastic Volatility heteroskedasticity, BSVARSV.
specify_bsvar_sv$new( data, p = 1L, B, exogenous = NULL, centred_sv = FALSE, 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.
B
a logical NxN
matrix containing value TRUE
for the elements of the structural matrix to be estimated and value
FALSE
for exclusion restrictions to be set to zero.
exogenous
a (T+p)xd
matrix of exogenous variables.
centred_sv
a logical value. If FALSE
a non-centred Stochastic Volatility processes for conditional variances are estimated. Otherwise, a centred process is estimated.
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 bsvar model with Stochastic Volatility heteroskedasticity, BSVARSV.
get_data_matrices()
Returns the data matrices as the DataMatricesBSVAR object.
specify_bsvar_sv$get_data_matrices()
data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_data_matrices()
get_identification()
Returns the identifying restrictions as the IdentificationBSVARs object.
specify_bsvar_sv$get_identification()
data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_identification()
get_prior()
Returns the prior specification as the PriorBSVARSV object.
specify_bsvar_sv$get_prior()
data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_prior()
get_starting_values()
Returns the starting values as the StartingValuesBSVARSV object.
specify_bsvar_sv$get_starting_values()
data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_starting_values()
clone()
The objects of this class are cloneable with this method.
specify_bsvar_sv$clone(deep = FALSE)
deep
Whether to make a deep clone.
estimate
, specify_posterior_bsvar_sv
data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_identification` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_prior` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_starting_values` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_starting_values()
data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_data_matrices() ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_identification` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_identification() ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_prior` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_prior() ## ------------------------------------------------ ## Method `specify_bsvar_sv$get_starting_values` ## ------------------------------------------------ data(us_fiscal_lsuw) spec = specify_bsvar_sv$new( data = us_fiscal_lsuw, p = 4 ) spec$get_starting_values()
The class BSVART presents complete specification for the BSVAR model with t-distributed structural shocks.
bsvars::BSVAR
-> BSVART
p
a non-negative integer specifying the autoregressive lag order of the model.
identification
an object IdentificationBSVARs with the identifying restrictions.
prior
an object PriorBSVART with the prior specification.
data_matrices
an object DataMatricesBSVAR with the data matrices.
starting_values
an object StartingValuesBSVART with the starting values.
adaptiveMH
a vector of two values setting the Robust Adaptive Metropolis sampler for df: target acceptance rate and adaptive rate.
new()
Create a new specification of the BSVAR model with t-distributed structural shocks, BSVART.
specify_bsvar_t$new( data, p = 1L, B, 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.
B
a logical NxN
matrix containing value TRUE
for the
elements of the structural matrix to be estimated and value
FALSE
for exclusion restrictions to be set to zero.
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 bsvar model with t-distributed structural shocks, BSVART.
clone()
The objects of this class are cloneable with this method.
specify_bsvar_t$clone(deep = FALSE)
deep
Whether to make a deep clone.
estimate
, specify_posterior_bsvar_t
data(us_fiscal_lsuw) spec = specify_bsvar_t$new( data = us_fiscal_lsuw, p = 4 )
data(us_fiscal_lsuw) spec = specify_bsvar_t$new( data = us_fiscal_lsuw, p = 4 )
The class DataMatricesBSVAR presents the data matrices of dependent variables, ,
and regressors,
, for the homoskedastic bsvar model.
Y
an NxT
matrix of dependent variables, .
X
an KxT
matrix of regressors, .
new()
Create new data matrices DataMatricesBSVAR.
specify_data_matrices$new(data, p = 1L, exogenous = NULL)
data
a (T+p)xN
matrix with time series data.
p
a positive integer providing model's autoregressive lag order.
exogenous
a (T+p)xd
matrix of exogenous variables.
This matrix should not include a constant term.
New data matrices DataMatricesBSVAR.
get_data_matrices()
Returns the data matrices DataMatricesBSVAR as a list
.
specify_data_matrices$get_data_matrices()
data(us_fiscal_lsuw) YX = specify_data_matrices$new(data = us_fiscal_lsuw, p = 4) YX$get_data_matrices()
clone()
The objects of this class are cloneable with this method.
specify_data_matrices$clone(deep = FALSE)
deep
Whether to make a deep clone.
data(us_fiscal_lsuw) YX = specify_data_matrices$new(data = us_fiscal_lsuw, p = 4) dim(YX$Y); dim(YX$X) ## ------------------------------------------------ ## Method `specify_data_matrices$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) YX = specify_data_matrices$new(data = us_fiscal_lsuw, p = 4) YX$get_data_matrices()
data(us_fiscal_lsuw) YX = specify_data_matrices$new(data = us_fiscal_lsuw, p = 4) dim(YX$Y); dim(YX$X) ## ------------------------------------------------ ## Method `specify_data_matrices$get_data_matrices` ## ------------------------------------------------ data(us_fiscal_lsuw) YX = specify_data_matrices$new(data = us_fiscal_lsuw, p = 4) YX$get_data_matrices()
The class IdentificationBSVARs presents the identifying restrictions for the bsvar models.
VB
a list of N
matrices determining the unrestricted elements of matrix .
new()
Create new identifying restrictions IdentificationBSVARs.
specify_identification_bsvars$new(N, B)
N
a positive integer - the number of dependent variables in the model.
B
a logical NxN
matrix containing value TRUE
for the elements of
the structural matrix to be estimated and value
FALSE
for exclusion restrictions
to be set to zero.
Identifying restrictions IdentificationBSVARs.
get_identification()
Returns the elements of the identification pattern IdentificationBSVARs as a list
.
specify_identification_bsvars$get_identification()
B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B spec = specify_identification_bsvars$new(N = 3, B = B) spec$get_identification()
set_identification()
Set new starting values StartingValuesBSVAR.
specify_identification_bsvars$set_identification(N, B)
N
a positive integer - the number of dependent variables in the model.
B
a logical NxN
matrix containing value TRUE
for the elements of
the structural matrix to be estimated and value
FALSE
for exclusion restrictions
to be set to zero.
spec = specify_identification_bsvars$new(N = 3) # specify a model with the default option B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B spec$set_identification(N = 3, B = B) # modify an existing specification spec$get_identification() # check the outcome
clone()
The objects of this class are cloneable with this method.
specify_identification_bsvars$clone(deep = FALSE)
deep
Whether to make a deep clone.
specify_identification_bsvars$new(N = 3) # recursive specification for a 3-variable system B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B specify_identification_bsvars$new(N = 3, B = B) # an alternative identification pattern ## ------------------------------------------------ ## Method `specify_identification_bsvars$get_identification` ## ------------------------------------------------ B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B spec = specify_identification_bsvars$new(N = 3, B = B) spec$get_identification() ## ------------------------------------------------ ## Method `specify_identification_bsvars$set_identification` ## ------------------------------------------------ spec = specify_identification_bsvars$new(N = 3) # specify a model with the default option B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B spec$set_identification(N = 3, B = B) # modify an existing specification spec$get_identification() # check the outcome
specify_identification_bsvars$new(N = 3) # recursive specification for a 3-variable system B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B specify_identification_bsvars$new(N = 3, B = B) # an alternative identification pattern ## ------------------------------------------------ ## Method `specify_identification_bsvars$get_identification` ## ------------------------------------------------ B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B spec = specify_identification_bsvars$new(N = 3, B = B) spec$get_identification() ## ------------------------------------------------ ## Method `specify_identification_bsvars$set_identification` ## ------------------------------------------------ spec = specify_identification_bsvars$new(N = 3) # specify a model with the default option B = matrix(c(TRUE,TRUE,TRUE,FALSE,FALSE,TRUE,FALSE,TRUE,TRUE), 3, 3); B spec$set_identification(N = 3, B = B) # modify an existing specification spec$get_identification() # check the outcome
The class PosteriorBSVAR contains posterior output and the specification including
the last MCMC draw for the homoskedastic bsvar model.
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 BSVAR 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 collected in elements
an NxNxS
array B
, an NxKxS
array A
, and a 5xS
matrix hyper
.
new()
Create a new posterior output PosteriorBSVAR.
specify_posterior_bsvar$new(specification_bsvar, posterior_bsvar)
specification_bsvar
an object of class BSVAR with the last draw of the current MCMC run as the starting value.
posterior_bsvar
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 PosteriorBSVAR.
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_bsvar$get_posterior()
data(us_fiscal_lsuw) specification = specify_bsvar$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 50) estimate$get_posterior()
get_last_draw()
Returns an object of class BSVAR 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()
.
specify_posterior_bsvar$get_last_draw()
data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10)
is_normalised()
Returns TRUE
if the posterior has been normalised using normalise_posterior()
and FALSE
otherwise.
specify_posterior_bsvar$is_normalised()
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
set_normalised()
Sets the private indicator normalised
to TRUE.
specify_posterior_bsvar$set_normalised(value)
value
(optional) a logical value to be passed to indicator normalised
.
# This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
clone()
The objects of this class are cloneable with this method.
specify_posterior_bsvar$clone(deep = FALSE)
deep
Whether to make a deep clone.
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) estimate = estimate(specification, 50) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 50) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10) ## ------------------------------------------------ ## Method `specify_posterior_bsvar$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) estimate = estimate(specification, 50) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 50) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10) ## ------------------------------------------------ ## Method `specify_posterior_bsvar$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
The class PosteriorBSVARMIX contains posterior output and the specification including
the last MCMC draw for the bsvar model with a zero-mean mixture of normals model for structural shocks.
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 BSVARMIX 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.
new()
Create a new posterior output PosteriorBSVARMIX.
specify_posterior_bsvar_mix$new(specification_bsvar, posterior_bsvar)
specification_bsvar
an object of class BSVARMIX with the last draw of the current MCMC run as the starting value.
posterior_bsvar
a list containing Bayesian estimation output.
A posterior output PosteriorBSVARMIX.
get_posterior()
Returns a list containing Bayesian estimation output.
specify_posterior_bsvar_mix$get_posterior()
data(us_fiscal_lsuw) specification = specify_bsvar_mix$new(us_fiscal_lsuw, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) estimate$get_posterior()
get_last_draw()
Returns an object of class BSVARMIX 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()
.
specify_posterior_bsvar_mix$get_last_draw()
data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) # run the burn-in set.seed(123) burn_in = estimate(specification, 10, thin = 2) # estimate the model posterior = estimate(burn_in, 10, thin = 2)
is_normalised()
Returns TRUE
if the posterior has been normalised using normalise_posterior()
and FALSE
otherwise.
specify_posterior_bsvar_mix$is_normalised()
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) # estimate the model set.seed(123) posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
set_normalised()
Sets the private indicator normalised
to TRUE.
specify_posterior_bsvar_mix$set_normalised(value)
value
(optional) a logical value to be passed to indicator normalised
.
# This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
clone()
The objects of this class are cloneable with this method.
specify_posterior_bsvar_mix$clone(deep = FALSE)
deep
Whether to make a deep clone.
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_mix$new(us_fiscal_lsuw, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) # run the burn-in set.seed(123) burn_in = estimate(specification, 10, thin = 2) # estimate the model posterior = estimate(burn_in, 10, thin = 2) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) # estimate the model set.seed(123) posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_mix$new(us_fiscal_lsuw, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) # run the burn-in set.seed(123) burn_in = estimate(specification, 10, thin = 2) # estimate the model posterior = estimate(burn_in, 10, thin = 2) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) # estimate the model set.seed(123) posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_mix$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
The class PosteriorBSVARMSH contains posterior output and the specification including
the last MCMC draw for the bsvar model with Markov Switching Heteroskedasticity.
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 BSVARMSH 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.
new()
Create a new posterior output PosteriorBSVARMSH.
specify_posterior_bsvar_msh$new(specification_bsvar, posterior_bsvar)
specification_bsvar
an object of class BSVARMSH with the last draw of the current MCMC run as the starting value.
posterior_bsvar
a list containing Bayesian estimation output.
A posterior output PosteriorBSVARMSH.
get_posterior()
Returns a list containing Bayesian estimation output.
specify_posterior_bsvar_msh$get_posterior()
data(us_fiscal_lsuw) specification = specify_bsvar_msh$new(us_fiscal_lsuw, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) estimate$get_posterior()
get_last_draw()
Returns an object of class BSVARMSH 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()
.
specify_posterior_bsvar_msh$get_last_draw()
data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) # run the burn-in set.seed(123) burn_in = estimate(specification, 10, thin = 2) # estimate the model posterior = estimate(burn_in, 10, thin = 2)
is_normalised()
Returns TRUE
if the posterior has been normalised using normalise_posterior()
and FALSE
otherwise.
specify_posterior_bsvar_msh$is_normalised()
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) # estimate the model set.seed(123) posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
set_normalised()
Sets the private indicator normalised
to TRUE.
specify_posterior_bsvar_msh$set_normalised(value)
value
(optional) a logical value to be passed to indicator normalised
.
# This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
clone()
The objects of this class are cloneable with this method.
specify_posterior_bsvar_msh$clone(deep = FALSE)
deep
Whether to make a deep clone.
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_msh$new(us_fiscal_lsuw, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) # run the burn-in set.seed(123) burn_in = estimate(specification, 10, thin = 2) # estimate the model posterior = estimate(burn_in, 10, thin = 2) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) # estimate the model set.seed(123) posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_msh$new(us_fiscal_lsuw, M = 2) set.seed(123) estimate = estimate(specification, 10, thin = 1) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) # run the burn-in set.seed(123) burn_in = estimate(specification, 10, thin = 2) # estimate the model posterior = estimate(burn_in, 10, thin = 2) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) # estimate the model set.seed(123) posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_msh$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 4, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
The class PosteriorBSVARSV contains posterior output and the specification including
the last MCMC draw for the bsvar model with Stochastic Volatility heteroskedasticity.
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 BSVARSV 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.
new()
Create a new posterior output PosteriorBSVARSV.
specify_posterior_bsvar_sv$new(specification_bsvar, posterior_bsvar)
specification_bsvar
an object of class BSVARSV with the last draw of the current MCMC run as the starting value.
posterior_bsvar
a list containing Bayesian estimation output.
A posterior output PosteriorBSVARSV.
get_posterior()
Returns a list containing Bayesian estimation.
specify_posterior_bsvar_sv$get_posterior()
data(us_fiscal_lsuw) specification = specify_bsvar_sv$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 5, thin = 1) estimate$get_posterior()
get_last_draw()
Returns an object of class BSVARSV 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()
.
specify_posterior_bsvar_sv$get_last_draw()
data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 5, thin = 1) # estimate the model posterior = estimate(burn_in, 5, thin = 1)
is_normalised()
Returns TRUE
if the posterior has been normalised using normalise_posterior()
and FALSE
otherwise.
specify_posterior_bsvar_sv$is_normalised()
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 5, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
set_normalised()
Sets the private indicator normalised
to TRUE.
specify_posterior_bsvar_sv$set_normalised(value)
value
(optional) a logical value to be passed to indicator normalised
.
# This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 5, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
clone()
The objects of this class are cloneable with this method.
specify_posterior_bsvar_sv$clone(deep = FALSE)
deep
Whether to make a deep clone.
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) set.seed(123) estimate = estimate(specification, 5, thin = 1) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_sv$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 5, thin = 1) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 5, thin = 1) # estimate the model posterior = estimate(burn_in, 5, thin = 1) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 5, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 5, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) set.seed(123) estimate = estimate(specification, 5, thin = 1) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_sv$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 5, thin = 1) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) set.seed(123) # run the burn-in burn_in = estimate(specification, 5, thin = 1) # estimate the model posterior = estimate(burn_in, 5, thin = 1) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 5, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_sv$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 5, thin = 1) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
The class PosteriorBSVART contains posterior output and the specification including
the last MCMC draw for the bsvar model with t-distributed structural shocks.
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 BSVART 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.
new()
Create a new posterior output PosteriorBSVART.
specify_posterior_bsvar_t$new(specification_bsvar, posterior_bsvar)
specification_bsvar
an object of class BSVART with the last draw of the current MCMC run as the starting value.
posterior_bsvar
a list containing Bayesian estimation output.
A posterior output PosteriorBSVART.
get_posterior()
Returns a list containing Bayesian estimation output.
specify_posterior_bsvar_t$get_posterior()
data(us_fiscal_lsuw) specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 10) estimate$get_posterior()
get_last_draw()
Returns an object of class BSVART 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()
.
specify_posterior_bsvar_t$get_last_draw()
data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # run the burn-in set.seed(123) burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10)
is_normalised()
Returns TRUE
if the posterior has been normalised using normalise_posterior()
and FALSE
otherwise.
specify_posterior_bsvar_t$is_normalised()
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 10) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
set_normalised()
Sets the private indicator normalised
to TRUE.
specify_posterior_bsvar_t$set_normalised(value)
value
(optional) a logical value to be passed to indicator normalised
.
# This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
clone()
The objects of this class are cloneable with this method.
specify_posterior_bsvar_t$clone(deep = FALSE)
deep
Whether to make a deep clone.
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) set.seed(123) estimate = estimate(specification, 10) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 10) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # run the burn-in set.seed(123) burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 10) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
# This is a function that is used within estimate() data(us_fiscal_lsuw) specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) set.seed(123) estimate = estimate(specification, 10) class(estimate) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$get_posterior` ## ------------------------------------------------ data(us_fiscal_lsuw) specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) estimate = estimate(specification, 10) estimate$get_posterior() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$get_last_draw` ## ------------------------------------------------ data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # run the burn-in set.seed(123) burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 10) ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$is_normalised` ## ------------------------------------------------ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) # estimate the model set.seed(123) posterior = estimate(specification, 10) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag((-1) * sign(diag(BB))) %*% BB # set negative diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised() ## ------------------------------------------------ ## Method `specify_posterior_bsvar_t$set_normalised` ## ------------------------------------------------ # This is an internal function that is run while executing normalise_posterior() # Observe its working by analysing the workflow: # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw, p = 4) set.seed(123) # estimate the model posterior = estimate(specification, 10) # check normalisation status beforehand posterior$is_normalised() # normalise the posterior BB = posterior$last_draw$starting_values$B # get the last draw of B B_hat = diag(sign(diag(BB))) %*% BB # set positive diagonal elements normalise_posterior(posterior, B_hat) # draws in posterior are normalised # check normalisation status afterwards posterior$is_normalised()
The class PriorBSVAR presents a prior specification for the homoskedastic bsvar model.
A
an NxK
matrix, the mean of the normal prior distribution for the parameter matrix .
A_V_inv
a KxK
precision matrix of the normal prior distribution for each of
the row of the parameter matrix . This precision matrix is equation invariant.
B_V_inv
an NxN
precision matrix of the generalised-normal prior distribution
for the structural matrix . This precision matrix is equation invariant.
B_nu
a positive integer greater of equal than N
, a shape parameter of
the generalised-normal prior distribution for the structural matrix .
hyper_nu_B
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_B
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_BB
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_BB
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_A
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_A
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_AA
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_AA
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
new()
Create a new prior specification PriorBSVAR.
specify_prior_bsvar$new(N, p, d = 0, stationary = rep(FALSE, N))
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
d
a positive integer - the number of exogenous
variables in the model.
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 PriorBSVAR.
# a prior for 3-variable example with one lag and stationary data prior = specify_prior_bsvar$new(N = 3, p = 1, stationary = rep(TRUE, 3)) prior$A # show autoregressive prior mean
get_prior()
Returns the elements of the prior specification PriorBSVAR as a list
.
specify_prior_bsvar$get_prior()
# a prior for 3-variable example with four lags prior = specify_prior_bsvar$new(N = 3, p = 4) prior$get_prior() # show the prior as list
clone()
The objects of this class are cloneable with this method.
specify_prior_bsvar$clone(deep = FALSE)
deep
Whether to make a deep clone.
prior = specify_prior_bsvar$new(N = 3, p = 1) # a prior for 3-variable example with one lag prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar$new` ## ------------------------------------------------ # a prior for 3-variable example with one lag and stationary data prior = specify_prior_bsvar$new(N = 3, p = 1, stationary = rep(TRUE, 3)) prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar$get_prior` ## ------------------------------------------------ # a prior for 3-variable example with four lags prior = specify_prior_bsvar$new(N = 3, p = 4) prior$get_prior() # show the prior as list
prior = specify_prior_bsvar$new(N = 3, p = 1) # a prior for 3-variable example with one lag prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar$new` ## ------------------------------------------------ # a prior for 3-variable example with one lag and stationary data prior = specify_prior_bsvar$new(N = 3, p = 1, stationary = rep(TRUE, 3)) prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar$get_prior` ## ------------------------------------------------ # a prior for 3-variable example with four lags prior = specify_prior_bsvar$new(N = 3, p = 4) prior$get_prior() # show the prior as list
The class PriorBSVARMIX presents a prior specification for the bsvar model with a zero-mean mixture of normals model for structural shocks.
bsvars::PriorBSVAR
-> bsvars::PriorBSVARMSH
-> PriorBSVARMIX
A
an NxK
matrix, the mean of the normal prior distribution for the parameter matrix .
A_V_inv
a KxK
precision matrix of the normal prior distribution for each of the row of the parameter matrix . This precision matrix is equation invariant.
B_V_inv
an NxN
precision matrix of the generalised-normal prior distribution for the structural matrix . This precision matrix is equation invariant.
B_nu
a positive integer greater of equal than N
, a shape parameter of the generalised-normal prior distribution for the structural matrix .
hyper_nu_B
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_B
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_BB
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_BB
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_A
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_A
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_AA
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_AA
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
sigma_nu
a positive scalar, the shape parameter of the inverted-gamma 2 for mixture component-dependent variances of the structural shocks, .
sigma_s
a positive scalar, the scale parameter of the inverted-gamma 2 for mixture component-dependent variances of the structural shocks, .
PR_TR
an MxM
matrix, the matrix of hyper-parameters of the row-specific Dirichlet prior distribution for the state probabilities the Markov process . Its rows must be identical.
clone()
The objects of this class are cloneable with this method.
specify_prior_bsvar_mix$clone(deep = FALSE)
deep
Whether to make a deep clone.
prior = specify_prior_bsvar_mix$new(N = 3, p = 1, M = 2) # specify the prior prior$A # show autoregressive prior mean
prior = specify_prior_bsvar_mix$new(N = 3, p = 1, M = 2) # specify the prior prior$A # show autoregressive prior mean
The class PriorBSVARMSH presents a prior specification for the bsvar model with Markov Switching Heteroskedasticity.
bsvars::PriorBSVAR
-> PriorBSVARMSH
A
an NxK
matrix, the mean of the normal prior distribution for the parameter matrix .
A_V_inv
a KxK
precision matrix of the normal prior distribution for each of the row of the parameter matrix . This precision matrix is equation invariant.
B_V_inv
an NxN
precision matrix of the generalised-normal prior distribution for the structural matrix . This precision matrix is equation invariant.
B_nu
a positive integer greater of equal than N
, a shape parameter of the generalised-normal prior distribution for the structural matrix .
hyper_nu_B
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_B
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_BB
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_BB
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_A
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_A
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_AA
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_AA
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
sigma_nu
a positive scalar, the shape parameter of the inverted-gamma 2 for MS state-dependent variances of the structural shocks, .
sigma_s
a positive scalar, the scale parameter of the inverted-gamma 2 for MS state-dependent variances of the structural shocks, .
PR_TR
an MxM
matrix, the matrix of hyper-parameters of the row-specific Dirichlet prior distribution for transition probabilities matrix of the Markov process
.
new()
Create a new prior specification PriorBSVARMSH.
specify_prior_bsvar_msh$new(N, p, d = 0, M, stationary = rep(FALSE, N))
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
d
a positive integer - the number of exogenous
variables in the model.
M
an integer greater than 1 - the number of Markov process' heteroskedastic regimes.
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 PriorBSVARMSH.
get_prior()
Returns the elements of the prior specification PriorBSVARMSH as a list
.
specify_prior_bsvar_msh$get_prior()
# a prior for 3-variable example with four lags and two regimes prior = specify_prior_bsvar_msh$new(N = 3, p = 4, M = 2) prior$get_prior() # show the prior as list
clone()
The objects of this class are cloneable with this method.
specify_prior_bsvar_msh$clone(deep = FALSE)
deep
Whether to make a deep clone.
prior = specify_prior_bsvar_msh$new(N = 3, p = 1, M = 2) # specify the prior prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar_msh$get_prior` ## ------------------------------------------------ # a prior for 3-variable example with four lags and two regimes prior = specify_prior_bsvar_msh$new(N = 3, p = 4, M = 2) prior$get_prior() # show the prior as list
prior = specify_prior_bsvar_msh$new(N = 3, p = 1, M = 2) # specify the prior prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar_msh$get_prior` ## ------------------------------------------------ # a prior for 3-variable example with four lags and two regimes prior = specify_prior_bsvar_msh$new(N = 3, p = 4, M = 2) prior$get_prior() # show the prior as list
The class PriorBSVARSV presents a prior specification for the bsvar model with Stochastic Volatility heteroskedasticity.
bsvars::PriorBSVAR
-> PriorBSVARSV
A
an NxK
matrix, the mean of the normal prior distribution for the parameter matrix .
A_V_inv
a KxK
precision matrix of the normal prior distribution for each of the row of the parameter matrix . This precision matrix is equation invariant.
B_V_inv
an NxN
precision matrix of the generalised-normal prior distribution for the structural matrix . This precision matrix is equation invariant.
B_nu
a positive integer greater of equal than N
, a shape parameter of the generalised-normal prior distribution for the structural matrix .
hyper_nu_B
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_B
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_BB
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_BB
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_A
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_A
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_AA
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_AA
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
sv_a_
a positive scalar, the shape parameter of the gamma prior in the hierarchical prior for .
sv_s_
a positive scalar, the scale parameter of the gamma prior in the hierarchical prior for .
new()
Create a new prior specification PriorBSVARSV.
specify_prior_bsvar_sv$new(N, p, d = 0, stationary = rep(FALSE, N))
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
d
a positive integer - the number of exogenous
variables in the model.
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 PriorBSVARSV.
get_prior()
Returns the elements of the prior specification PriorBSVARSV as a list
.
specify_prior_bsvar_sv$get_prior()
# a prior for 3-variable example with four lags prior = specify_prior_bsvar_sv$new(N = 3, p = 4) prior$get_prior() # show the prior as list
clone()
The objects of this class are cloneable with this method.
specify_prior_bsvar_sv$clone(deep = FALSE)
deep
Whether to make a deep clone.
prior = specify_prior_bsvar_sv$new(N = 3, p = 1) # a prior for 3-variable example with one lag prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar_sv$get_prior` ## ------------------------------------------------ # a prior for 3-variable example with four lags prior = specify_prior_bsvar_sv$new(N = 3, p = 4) prior$get_prior() # show the prior as list
prior = specify_prior_bsvar_sv$new(N = 3, p = 1) # a prior for 3-variable example with one lag prior$A # show autoregressive prior mean ## ------------------------------------------------ ## Method `specify_prior_bsvar_sv$get_prior` ## ------------------------------------------------ # a prior for 3-variable example with four lags prior = specify_prior_bsvar_sv$new(N = 3, p = 4) prior$get_prior() # show the prior as list
The class PriorBSVART presents a prior specification for the bsvar model with t-distributed structural shocks.
bsvars::PriorBSVAR
-> PriorBSVART
A
an NxK
matrix, the mean of the normal prior distribution
for the parameter matrix .
A_V_inv
a KxK
precision matrix of the normal prior
distribution for each of the row of the parameter matrix . This
precision matrix is equation invariant.
B_V_inv
an NxN
precision matrix of the generalised-normal
prior distribution for the structural matrix . This precision
matrix is equation invariant.
B_nu
a positive integer greater of equal than N
, a shape
parameter of the generalised-normal prior distribution for the structural
matrix .
hyper_nu_B
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_B
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_BB
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_BB
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_A
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the overall shrinkage parameter for matrix .
hyper_a_A
a positive scalar, the shape parameter of the gamma prior
for the second-level hierarchy for the overall shrinkage parameter for matrix .
hyper_s_AA
a positive scalar, the scale parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
hyper_nu_AA
a positive scalar, the shape parameter of the inverted-gamma 2 prior
for the third-level of hierarchy for overall shrinkage parameter for matrix .
clone()
The objects of this class are cloneable with this method.
specify_prior_bsvar_t$clone(deep = FALSE)
deep
Whether to make a deep clone.
prior = specify_prior_bsvar_t$new(N = 3, p = 1) # specify the prior prior$A # show autoregressive prior mean
prior = specify_prior_bsvar_t$new(N = 3, p = 1) # specify the prior prior$A # show autoregressive prior mean
The class StartingValuesBSVAR presents starting values for the homoskedastic bsvar model.
A
an NxK
matrix of starting values for the parameter .
B
an NxN
matrix of starting values for the parameter .
hyper
a (2*N+1)x2
matrix of starting values for the shrinkage hyper-parameters of the
hierarchical prior distribution.
new()
Create new starting values StartingValuesBSVAR.
specify_starting_values_bsvar$new(N, p, d = 0)
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
d
a positive integer - the number of exogenous
variables in the model.
Starting values StartingValuesBSVAR.
# starting values for a homoskedastic bsvar with 4 lags for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 4)
get_starting_values()
Returns the elements of the starting values StartingValuesBSVAR as a list
.
specify_starting_values_bsvar$get_starting_values()
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) sv$get_starting_values() # show starting values as list
set_starting_values()
Returns the elements of the starting values StartingValuesBSVAR as a list
.
specify_starting_values_bsvar$set_starting_values(last_draw)
last_draw
a list containing the last draw of elements B
- an NxN
matrix,
A
- an NxK
matrix, and hyper
- a vector of 5 positive real numbers.
An object of class StartingValuesBSVAR including the last draw of the current MCMC
as the starting value to be passed to the continuation of the MCMC estimation using estimate()
.
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
clone()
The objects of this class are cloneable with this method.
specify_starting_values_bsvar$clone(deep = FALSE)
deep
Whether to make a deep clone.
# starting values for a homoskedastic bsvar for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar$new` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 4 lags for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 4) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar$get_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar$set_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
# starting values for a homoskedastic bsvar for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar$new` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 4 lags for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 4) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar$get_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar$set_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
The class StartingValuesBSVARMIX presents starting values for the bsvar model with a zero-mean mixture of normals model for structural shocks.
bsvars::StartingValuesBSVAR
-> bsvars::StartingValuesBSVARMSH
-> StartingValuesBSVARMIX
A
an NxK
matrix of starting values for the parameter .
B
an NxN
matrix of starting values for the parameter .
hyper
a (2*N+1)x2
matrix of starting values for the shrinkage hyper-parameters of the
hierarchical prior distribution.
sigma2
an NxM
matrix of starting values for the MS state-specific variances of the structural shocks. Its elements sum to value M
over the rows.
PR_TR
an MxM
matrix of starting values for the probability matrix of the Markov process. Its rows must be identical and the elements of each row sum to 1 over the rows.
xi
an MxT
matrix of starting values for the Markov process indicator. Its columns are a chosen column of an identity matrix of order M
.
pi_0
an M
-vector of starting values for mixture components state probabilities. Its elements sum to 1.
new()
Create new starting values StartingValuesBSVARMIX.
specify_starting_values_bsvar_mix$new(N, p, M, T, d = 0, finiteM = TRUE)
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
M
an integer greater than 1 - the number of components of the mixture of normals.
T
a positive integer - the the time series dimension of the dependent variable matrix .
d
a positive integer - the number of exogenous
variables in the model.
finiteM
a logical value - if true a finite mixture model is estimated. Otherwise, a sparse mixture model is estimated in which M=20
and the number of visited states is estimated.
Starting values StartingValuesBSVARMIX.
clone()
The objects of this class are cloneable with this method.
specify_starting_values_bsvar_mix$clone(deep = FALSE)
deep
Whether to make a deep clone.
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_mix$new(N = 3, p = 1, M = 2, T = 100)
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_mix$new(N = 3, p = 1, M = 2, T = 100)
The class StartingValuesBSVARMSH presents starting values for the bsvar model with Markov Switching Heteroskedasticity.
bsvars::StartingValuesBSVAR
-> StartingValuesBSVARMSH
A
an NxK
matrix of starting values for the parameter .
B
an NxN
matrix of starting values for the parameter .
hyper
a (2*N+1)x2
matrix of starting values for the shrinkage hyper-parameters of the
hierarchical prior distribution.
sigma2
an NxM
matrix of starting values for the MS state-specific variances of the structural shocks. Its elements sum to value M
over the rows.
PR_TR
an MxM
matrix of starting values for the transition probability matrix of the Markov process. Its elements sum to 1 over the rows.
xi
an MxT
matrix of starting values for the Markov process indicator. Its columns are a chosen column of an identity matrix of order M
.
pi_0
an M
-vector of starting values for state probability at time t=0
. Its elements sum to 1.
new()
Create new starting values StartingValuesBSVAR-MS.
specify_starting_values_bsvar_msh$new(N, p, M, T, d = 0, finiteM = TRUE)
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
M
an integer greater than 1 - the number of Markov process' heteroskedastic regimes.
T
a positive integer - the the time series dimension of the dependent variable matrix .
d
a positive integer - the number of exogenous
variables in the model.
finiteM
a logical value - if true a stationary Markov switching model is estimated. Otherwise, a sparse Markov switching model is estimated in which M=20
and the number of visited states is estimated.
Starting values StartingValuesBSVAR-MS.
get_starting_values()
Returns the elements of the starting values StartingValuesBSVAR-MS as a list
.
specify_starting_values_bsvar_msh$get_starting_values()
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) sv$get_starting_values() # show starting values as list
set_starting_values()
Returns the elements of the starting values StartingValuesBSVARMSH as a list
.
specify_starting_values_bsvar_msh$set_starting_values(last_draw)
last_draw
a list containing the last draw.
An object of class StartingValuesBSVAR-MS including the last draw of the current MCMC as the starting value to be passed to the continuation of the MCMC estimation using estimate()
.
# starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
clone()
The objects of this class are cloneable with this method.
specify_starting_values_bsvar_msh$clone(deep = FALSE)
deep
Whether to make a deep clone.
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_msh$get_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_msh$set_starting_values` ## ------------------------------------------------ # starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_msh$get_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_msh$set_starting_values` ## ------------------------------------------------ # starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_msh$new(N = 3, p = 1, M = 2, T = 100) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
The class StartingValuesBSVARSV presents starting values for the bsvar model with Stochastic Volatility heteroskedasticity.
bsvars::StartingValuesBSVAR
-> StartingValuesBSVARSV
A
an NxK
matrix of starting values for the parameter .
B
an NxN
matrix of starting values for the parameter .
hyper
a (2*N+1)x2
matrix of starting values for the shrinkage hyper-parameters of the
hierarchical prior distribution.
h
an NxT
matrix with the starting values of the log-volatility processes.
rho
an N
-vector with values of SV autoregressive parameters.
omega
an N
-vector with values of SV process conditional standard deviations.
sigma2v
an N
-vector with values of SV process conditional variances.
S
an NxT
integer matrix with the auxiliary mixture component indicators.
sigma2_omega
an N
-vector with variances of the zero-mean normal prior for .
s_
a positive scalar with the scale of the gamma prior of the hierarchical prior for .
new()
Create new starting values StartingValuesBSVARSV.
specify_starting_values_bsvar_sv$new(N, p, T, d = 0)
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
T
a positive integer - the the time series dimension of the dependent variable matrix .
d
a positive integer - the number of exogenous
variables in the model.
Starting values StartingValuesBSVARSV.
get_starting_values()
Returns the elements of the starting values StartingValuesBSVARSV as a list
.
specify_starting_values_bsvar_sv$get_starting_values()
# starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) sv$get_starting_values() # show starting values as list
set_starting_values()
Returns the elements of the starting values StartingValuesBSVAR_SV as a list
.
specify_starting_values_bsvar_sv$set_starting_values(last_draw)
last_draw
a list containing the last draw of the current MCMC run.
An object of class StartingValuesBSVAR including the last draw of the current MCMC as the starting value to be passed to the continuation of the MCMC estimation using estimate()
.
# starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
clone()
The objects of this class are cloneable with this method.
specify_starting_values_bsvar_sv$clone(deep = FALSE)
deep
Whether to make a deep clone.
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_sv$get_starting_values` ## ------------------------------------------------ # starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_sv$set_starting_values` ## ------------------------------------------------ # starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_sv$get_starting_values` ## ------------------------------------------------ # starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_sv$set_starting_values` ## ------------------------------------------------ # starting values for a bsvar model with 1 lag for a 3-variable system sv = specify_starting_values_bsvar_sv$new(N = 3, p = 1, T = 100) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
The class StartingValuesBSVART presents starting values for the bsvar model with t-distributed structural shocks.
bsvars::StartingValuesBSVAR
-> StartingValuesBSVART
A
an NxK
matrix of starting values for the parameter .
B
an NxN
matrix of starting values for the parameter .
hyper
a (2*N+1)x2
matrix of starting values for the shrinkage hyper-parameters of the
hierarchical prior distribution.
lambda
a Tx1
vector of starting values for latent variables.
df
a positive scalar with starting values for the degrees of freedom parameter of the Student-t conditional distribution of structural shock.
new()
Create new starting values StartingValuesBSVART
specify_starting_values_bsvar_t$new(N, p, T, d = 0)
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
T
a positive integer - the the time series dimension of the dependent variable matrix .
d
a positive integer - the number of exogenous
variables in the model.
Starting values StartingValuesBSVART
get_starting_values()
Returns the elements of the starting values StartingValuesBSVAR as a list
.
specify_starting_values_bsvar_t$get_starting_values()
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) sv$get_starting_values() # show starting values as list
set_starting_values()
Returns the elements of the starting values StartingValuesBSVAR as a list
.
specify_starting_values_bsvar_t$set_starting_values(last_draw)
last_draw
a list containing the last draw of elements B
- an NxN
matrix,
A
- an NxK
matrix, and hyper
- a vector of 5 positive real numbers.
An object of class StartingValuesBSVAR including the last draw of the current MCMC
as the starting value to be passed to the continuation of the MCMC estimation using estimate()
.
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
clone()
The objects of this class are cloneable with this method.
specify_starting_values_bsvar_t$clone(deep = FALSE)
deep
Whether to make a deep clone.
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_t$new(N = 3, p = 1, T = 100) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_t$get_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_t$set_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
# starting values for a bsvar model for a 3-variable system sv = specify_starting_values_bsvar_t$new(N = 3, p = 1, T = 100) ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_t$get_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) sv$get_starting_values() # show starting values as list ## ------------------------------------------------ ## Method `specify_starting_values_bsvar_t$set_starting_values` ## ------------------------------------------------ # starting values for a homoskedastic bsvar with 1 lag for a 3-variable system sv = specify_starting_values_bsvar$new(N = 3, p = 1) # Modify the starting values by: sv_list = sv$get_starting_values() # getting them as list sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry sv$set_starting_values(sv_list) # providing to the class object
Provides posterior summary of the forecasts including their mean, standard deviations, as well as 5 and 95 percentiles.
## S3 method for class 'Forecasts' summary(object, ...)
## S3 method for class 'Forecasts' summary(object, ...)
object |
an object of class Forecasts obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95 percentiles of the forecasts for each of the variables and forecast horizons.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # forecast fore = forecast(posterior, horizon = 2) fore_summary = summary(fore) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> forecast(horizon = 2) |> summary() -> fore_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # forecast fore = forecast(posterior, horizon = 2) fore_summary = summary(fore) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> forecast(horizon = 2) |> summary() -> fore_summary
Provides posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper parameters.
## S3 method for class 'PosteriorBSVAR' summary(object, ...)
## S3 method for class 'PosteriorBSVAR' summary(object, ...)
object |
an object of class PosteriorBSVAR obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper-parameters.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
Provides posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper parameters.
## S3 method for class 'PosteriorBSVARMIX' summary(object, ...)
## S3 method for class 'PosteriorBSVARMIX' summary(object, ...)
object |
an object of class PosteriorBSVARMIX obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper-parameters.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_mix$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
Provides posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper parameters.
## S3 method for class 'PosteriorBSVARMSH' summary(object, ...)
## S3 method for class 'PosteriorBSVARMSH' summary(object, ...)
object |
an object of class PosteriorBSVARMSH obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper-parameters.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
Provides posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper parameters.
## S3 method for class 'PosteriorBSVARSV' summary(object, ...)
## S3 method for class 'PosteriorBSVARSV' summary(object, ...)
object |
an object of class PosteriorBSVARSV obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, and hyper-parameters.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
Provides posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, hyper-parameters, and Student-t degrees-of-freedom
parameter
.
## S3 method for class 'PosteriorBSVART' summary(object, ...)
## S3 method for class 'PosteriorBSVART' summary(object, ...)
object |
an object of class PosteriorBSVART obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95
percentiles of the parameters: the structural matrix , autoregressive
parameters
, hyper-parameters, and Student-t degrees-of-freedom
parameter
.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_t$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) summary(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> estimate(S = 20) |> summary()
Provides posterior means of the forecast error variance decompositions of each variable at all horizons.
## S3 method for class 'PosteriorFEVD' summary(object, ...)
## S3 method for class 'PosteriorFEVD' summary(object, ...)
object |
an object of class PosteriorFEVD obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean of the forecast error variance decompositions of each variable at all horizons.
Tomasz Woźniak [email protected]
compute_variance_decompositions
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decompositions fevd = compute_variance_decompositions(posterior, horizon = 4) fevd_summary = summary(fevd) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 4) |> summary() -> fevd_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute forecast error variance decompositions fevd = compute_variance_decompositions(posterior, horizon = 4) fevd_summary = summary(fevd) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_variance_decompositions(horizon = 4) |> summary() -> fevd_summary
Provides posterior summary of the fitted values including their mean, standard deviations, as well as 5 and 95 percentiles.
## S3 method for class 'PosteriorFitted' summary(object, ...)
## S3 method for class 'PosteriorFitted' summary(object, ...)
object |
an object of class PosteriorFitted obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95 percentiles of the fitted values for each of the shocks and periods.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute fitted values fitted = compute_fitted_values(posterior) fitted_summary = summary(fitted) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() |> summary() -> fitted_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute fitted values fitted = compute_fitted_values(posterior) fitted_summary = summary(fitted) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_fitted_values() |> summary() -> fitted_summary
Provides posterior means of the historical decompositions variable by variable.
## S3 method for class 'PosteriorHD' summary(object, ...)
## S3 method for class 'PosteriorHD' summary(object, ...)
object |
an object of class PosteriorHD obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior means of historical decompositions for each of the variables.
Tomasz Woźniak [email protected]
compute_historical_decompositions
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(diff(us_fiscal_lsuw)) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hds = compute_historical_decompositions(posterior) hds_summary = summary(hds) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() |> summary() -> hds_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(diff(us_fiscal_lsuw)) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute historical decompositions hds = compute_historical_decompositions(posterior) hds_summary = summary(hds) # workflow with the pipe |> ############################################################ set.seed(123) diff(us_fiscal_lsuw) |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_historical_decompositions() |> summary() -> hds_summary
Provides posterior summary of the impulse responses of each variable to each of the shocks at all horizons. Includes their posterior means, standard deviations, as well as 5 and 95 percentiles.
## S3 method for class 'PosteriorIR' summary(object, ...)
## S3 method for class 'PosteriorIR' summary(object, ...)
object |
an object of class PosteriorIR obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95 percentiles of the impulse responses of each variable to each of the shocks at all horizons.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irf = compute_impulse_responses(posterior, horizon = 4) irf_summary = summary(irf) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) |> summary() -> irf_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute impulse responses irf = compute_impulse_responses(posterior, horizon = 4) irf_summary = summary(irf) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_impulse_responses(horizon = 4) |> summary() -> irf_summary
Provides posterior summary of regime probabilities including their mean, standard deviations, as well as 5 and 95 percentiles.
## S3 method for class 'PosteriorRegimePr' summary(object, ...)
## S3 method for class 'PosteriorRegimePr' summary(object, ...)
object |
an object of class PosteriorRegimePr obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean and standard deviations of the regime probabilities.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute regime probabilities rp = compute_regime_probabilities(posterior) rp_summary = summary(rp) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_regime_probabilities() |> summary() -> rp_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_msh$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute regime probabilities rp = compute_regime_probabilities(posterior) rp_summary = summary(rp) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_regime_probabilities() |> summary() -> rp_summary
Provides posterior summary of the structural shocks including their mean, standard deviations, as well as 5 and 95 percentiles.
## S3 method for class 'PosteriorShocks' summary(object, ...)
## S3 method for class 'PosteriorShocks' summary(object, ...)
object |
an object of class PosteriorShocks obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95 percentiles of the structural shocks for each of the equations and periods.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) shocks_summary = summary(shocks) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() |> summary() -> shocks_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 10) # estimate the model posterior = estimate(burn_in, 20) # compute structural shocks shocks = compute_structural_shocks(posterior) shocks_summary = summary(shocks) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new() |> estimate(S = 10) |> estimate(S = 20) |> compute_structural_shocks() |> summary() -> shocks_summary
Provides posterior summary of structural shocks' conditional standard deviations including their mean, standard deviations, as well as 5 and 95 percentiles.
## S3 method for class 'PosteriorSigma' summary(object, ...)
## S3 method for class 'PosteriorSigma' summary(object, ...)
object |
an object of class PosteriorSigma obtained using the
|
... |
additional arguments affecting the summary produced. |
A list reporting the posterior mean, standard deviations, as well as 5 and 95 percentiles of the structural shocks' conditional standard deviations for each of the shocks and periods.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 5) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) sigma_summary = summary(sigma) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new() |> estimate(S = 5) |> estimate(S = 5) |> compute_conditional_sd() |> summary() -> sigma_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed set.seed(123) specification = specify_bsvar_sv$new(us_fiscal_lsuw) # run the burn-in burn_in = estimate(specification, 5) # estimate the model posterior = estimate(burn_in, 5) # compute structural shocks' conditional standard deviations sigma = compute_conditional_sd(posterior) sigma_summary = summary(sigma) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new() |> estimate(S = 5) |> estimate(S = 5) |> compute_conditional_sd() |> summary() -> sigma_summary
Provides summary of the Savage-Dickey density ratios for verification of hypotheses about autoregressive parameters.
## S3 method for class 'SDDRautoregression' summary(object, ...)
## S3 method for class 'SDDRautoregression' summary(object, ...)
object |
an object of class |
... |
additional arguments affecting the summary produced. |
A table reporting the logarithm of Bayes factors of the restriction
against no restriction posterior odds in "log(SDDR)"
,
its numerical standard error "NSE"
, and the implied posterior
probability of the restriction holding or not hypothesis,
"Pr[H0|data]"
and "Pr[H1|data]"
respectively.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) |> summary() -> sddr_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) |> summary() -> sddr_summary
Provides summary of the Savage-Dickey density ratios for verification of structural shocks normality. The outcomes can be used to make probabilistic statements about identification through non-normality.
## S3 method for class 'SDDRidMIX' summary(object, ...)
## S3 method for class 'SDDRidMIX' summary(object, ...)
object |
an object of class |
... |
additional arguments affecting the summary produced. |
A table reporting the logarithm of Bayes factors of normal to
non-normal shocks posterior odds "log(SDDR)"
for each structural shock,
their numerical standard errors "NSE"
, and the implied posterior
probability of the normality and non-normality hypothesis,
"Pr[normal|data]"
and "Pr[non-normal|data]"
respectively.
Tomasz Woźniak [email protected]
verify_identification.PosteriorBSVARMIX
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(M = 2) |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(M = 2) |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
Provides summary of the Savage-Dickey density ratios for verification of structural shocks homoskedasticity. The outcomes can be used to make probabilistic statements about identification through heteroskedasticity closely following ideas by Lütkepohl& Woźniak (2020).
## S3 method for class 'SDDRidMSH' summary(object, ...)
## S3 method for class 'SDDRidMSH' summary(object, ...)
object |
an object of class |
... |
additional arguments affecting the summary produced. |
A table reporting the logarithm of Bayes factors of homoskedastic to
heteroskedastic posterior odds "log(SDDR)"
for each structural shock,
their numerical standard errors "NSE"
, and the implied posterior
probability of the homoskedasticity and heteroskedasticity hypothesis,
"Pr[homoskedasticity|data]"
and "Pr[heteroskedasticity|data]"
respectively.
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
verify_identification.PosteriorBSVARMSH
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(M = 2) |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(M = 2) |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
Provides summary of the Savage-Dickey density ratios for verification of structural shocks homoskedasticity. The outcomes can be used to make probabilistic statements about identification through heteroskedasticity following Lütkepohl, Shang, Uzeda & Woźniak (2024).
## S3 method for class 'SDDRidSV' summary(object, ...)
## S3 method for class 'SDDRidSV' summary(object, ...)
object |
an object of class |
... |
additional arguments affecting the summary produced. |
A table reporting the logarithm of Bayes factors of homoskedastic to
heteroskedastic posterior odds "log(SDDR)"
for each structural shock,
their numerical standard errors "NSE"
, and the implied posterior
probability of the homoskedasticity and heteroskedasticity hypothesis,
"Pr[homoskedasticity|data]"
and "Pr[heteroskedasticity|data]"
respectively.
Tomasz Woźniak [email protected]
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
verify_identification.PosteriorBSVARSV
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new() |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new() |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
Provides summary of the Savage-Dickey density ratios for verification of structural shocks normality. The outcomes can be used to make probabilistic statements about identification through non-normality.
## S3 method for class 'SDDRidT' summary(object, ...)
## S3 method for class 'SDDRidT' summary(object, ...)
object |
an object of class |
... |
additional arguments affecting the summary produced. |
A table reporting the Bayes factor of normal to
Student-t shocks posterior odds "SDDR"
as well as its logarithm
"log(SDDR)"
for each structural shock, and the implied posterior
probability of the normality and Student-t hypothesis,
"Pr[normal|data]"
and "Pr[Student-t|data]"
respectively.
Tomasz Woźniak [email protected]
verify_identification.PosteriorBSVART
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> verify_identification() |> summary() -> sddr_summary
Provides summary of the Savage-Dickey density ratios for verification of structural shocks homoskedasticity.
## S3 method for class 'SDDRvolatility' summary(object, ...)
## S3 method for class 'SDDRvolatility' summary(object, ...)
object |
an object of class |
... |
additional arguments affecting the summary produced. |
A table reporting the logarithm of Bayes factors of homoskedastic to
heteroskedastic posterior odds "log(SDDR)"
for each structural shock,
their numerical standard errors "NSE"
, and the implied posterior
probability of the homoskedasticity and heteroskedasticity hypothesis,
"Pr[homoskedasticity|data]"
and "Pr[heteroskedasticity|data]"
respectively.
Tomasz Woźniak [email protected]
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_volatility() |> summary() -> sddr_summary
# upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) summary(sddr) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_volatility() |> summary() -> sddr_summary
NA
values, which implies that the future values of the corresponding
endogenous variables, namely government spending and GDP, will be forecasted
given the provided projected values of total tax revenue. The matrix includes
future values for the forecast horizon of two years for the US fiscal model
for the period 2024 Q3 – 2026 Q2.Conditional projections variables to be used in conditional forecasting of government spending and GDP given the provided projected values of total tax revenue. Last data update was implemented on 2024-10-22.
data(us_fiscal_cond_forecasts)
data(us_fiscal_cond_forecasts)
A matrix and a ts
object with time series of eight values on
3 variables:
the values are provided. This variable will not be forecasted.
not provided. This variable will be forecasted conditionally on the provided values for ttr.
not provided. This variable will be forecasted conditionally on the provided values for ttr
The series are as described by Mertens & Ravn (2014). The data was used by Lütkepohl, Shang, Uzeda, Woźniak (2024).
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Mertens, K., and Ravn, M.O. (2014) A Reconciliation of SVAR and Narrative Estimates of Tax Multipliers, Journal of Monetary Economics, 68(S), S1–S19. DOI: doi:10.1016/j.jmoneco.2013.04.004.
data(us_fiscal_cond_forecasts) # upload the data
data(us_fiscal_cond_forecasts) # upload the data
Exogenous variables used to identify the US fiscal policy shocks. Last data update was implemented on 2024-10-20.
data(us_fiscal_ex)
data(us_fiscal_ex)
A matrix and a ts
object with time series of over three hundred observations on 3 variables:
a time trend
a quadratic trend
a dummy variable taking the value of 1 for quarter 2 1975 and zero elsewhere
The series are as described by Mertens & Ravn (2014). The data was used by Lütkepohl, Shang, Uzeda, Woźniak (2024).
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Mertens, K., and Ravn, M.O. (2014) A Reconciliation of SVAR and Narrative Estimates of Tax Multipliers, Journal of Monetary Economics, 68(S), S1–S19. DOI: doi:10.1016/j.jmoneco.2013.04.004.
data(us_fiscal_ex) # upload the data plot(us_fiscal_ex) # plot the data
data(us_fiscal_ex) # upload the data plot(us_fiscal_ex) # plot the data
Exogenous variables to be used in forecasting of the US fiscal policy shocks. Last data update was implemented on 2024-10-22.
data(us_fiscal_ex_forecasts)
data(us_fiscal_ex_forecasts)
A matrix and a ts
object with time series of eight values on
3 variables:
a time trend
a quadratic trend
a dummy variable taking the value of 1 for quarter 2 1975 and zero elsewhere
The series are as described by Mertens & Ravn (2014). The data was used by Lütkepohl, Shang, Uzeda, Woźniak (2024).
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
Mertens, K., and Ravn, M.O. (2014) A Reconciliation of SVAR and Narrative Estimates of Tax Multipliers, Journal of Monetary Economics, 68(S), S1–S19. DOI: doi:10.1016/j.jmoneco.2013.04.004.
data(us_fiscal_ex_forecasts) # upload the data
data(us_fiscal_ex_forecasts) # upload the data
A system used to identify the US fiscal policy shocks. Last data update was implemented on 2024-10-20.
data(us_fiscal_lsuw)
data(us_fiscal_lsuw)
A matrix and a ts
object with time series of over three hundred observations on 3 variables:
quarterly US total tax revenue expressed in log, real, per person terms
quarterly US total government spending expressed in log, real, per person terms
quarterly US gross domestic product expressed in log, real, per person terms
The series are as described by Mertens & Ravn (2014) in footnote 3 and main body on page S3 of the paper. Differences with respect to Mertens & Ravn's data :
The sample period is from quarter 1 of 1948 to the last available observation,
The population variable is not from Francis & Ramey (2009) but from the FRED (with the same definition),
The original monthly population data is transformed to quarterly by taking monthly averages.
U.S. Bureau of Economic Analysis, National Income and Product Accounts, https://www.bea.gov/
FRED Economic Database, Federal Reserve Bank of St. Louis, https://fred.stlouisfed.org/
Francis, N., and Ramey, V.A. (2009) Measures of per capita Hours and Their Implications for the Technology‐hours Debate. Journal of Money, Credit and Banking, 41(6), 1071-1097, DOI: doi:10.1111/j.1538-4616.2009.00247.x.
Mertens, K., and Ravn, M.O. (2014) A Reconciliation of SVAR and Narrative Estimates of Tax Multipliers, Journal of Monetary Economics, 68(S), S1–S19. DOI: doi:10.1016/j.jmoneco.2013.04.004.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
data(us_fiscal_lsuw) # upload the data plot(us_fiscal_lsuw) # plot the data
data(us_fiscal_lsuw) # upload the data plot(us_fiscal_lsuw) # plot the data
Computes the logarithm of Bayes factor for the joint hypothesis,
, possibly for many autoregressive parameters represented by argument
hypothesis
via Savage-Dickey Density Ration (SDDR).
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of logarithms of the marginal posterior distribution ordinate at the restriction
less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against hypothesis. The estimation of both elements of the difference requires numerical integration.
verify_autoregression(posterior, hypothesis)
verify_autoregression(posterior, hypothesis)
posterior |
the |
hypothesis |
an |
An object of class SDDRautoregression
that is a list of three components:
logSDDR
a scalar with values of the logarithm of the Bayes factors for
the autoregressive hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the denominator
a 30
-vector containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
Computes the logarithm of Bayes factor for the joint hypothesis,
, possibly for many autoregressive parameters represented by argument
hypothesis
via Savage-Dickey Density Ration (SDDR).
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of logarithms of the marginal posterior distribution ordinate at the restriction
less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against hypothesis. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVAR' verify_autoregression(posterior, hypothesis)
## S3 method for class 'PosteriorBSVAR' verify_autoregression(posterior, hypothesis)
posterior |
the |
hypothesis |
an |
An object of class SDDRautoregression
that is a list of three components:
logSDDR
a scalar with values of the logarithm of the Bayes factors for
the autoregressive hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the denominator
a 30
-vector containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
Computes the logarithm of Bayes factor for the joint hypothesis,
, possibly for many autoregressive parameters represented by argument
hypothesis
via Savage-Dickey Density Ration (SDDR).
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of logarithms of the marginal posterior distribution ordinate at the restriction
less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against hypothesis. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARMIX' verify_autoregression(posterior, hypothesis)
## S3 method for class 'PosteriorBSVARMIX' verify_autoregression(posterior, hypothesis)
posterior |
the |
hypothesis |
an |
An object of class SDDRautoregression
that is a list of three components:
logSDDR
a scalar with values of the logarithm of the Bayes factors for
the autoregressive hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the denominator
a 30
-vector containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
Computes the logarithm of Bayes factor for the joint hypothesis,
, possibly for many autoregressive parameters represented by argument
hypothesis
via Savage-Dickey Density Ration (SDDR).
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of logarithms of the marginal posterior distribution ordinate at the restriction
less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against hypothesis. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARMSH' verify_autoregression(posterior, hypothesis)
## S3 method for class 'PosteriorBSVARMSH' verify_autoregression(posterior, hypothesis)
posterior |
the |
hypothesis |
an |
An object of class SDDRautoregression
that is a list of three components:
logSDDR
a scalar with values of the logarithm of the Bayes factors for
the autoregressive hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the denominator
a 30
-vector containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
Computes the logarithm of Bayes factor for the joint hypothesis,
, possibly for many autoregressive parameters represented by argument
hypothesis
via Savage-Dickey Density Ration (SDDR).
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of logarithms of the marginal posterior distribution ordinate at the restriction
less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against hypothesis. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARSV' verify_autoregression(posterior, hypothesis)
## S3 method for class 'PosteriorBSVARSV' verify_autoregression(posterior, hypothesis)
posterior |
the |
hypothesis |
an |
An object of class SDDRautoregression
that is a list of three components:
logSDDR
a scalar with values of the logarithm of the Bayes factors for
the autoregressive hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the denominator
a 30
-vector containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
Computes the logarithm of Bayes factor for the joint hypothesis,
, possibly for many autoregressive parameters represented by argument
hypothesis
via Savage-Dickey Density Ration (SDDR).
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of logarithms of the marginal posterior distribution ordinate at the restriction
less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against hypothesis. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVART' verify_autoregression(posterior, hypothesis)
## S3 method for class 'PosteriorBSVART' verify_autoregression(posterior, hypothesis)
posterior |
the |
hypothesis |
an |
An object of class SDDRautoregression
that is a list of three components:
logSDDR
a scalar with values of the logarithm of the Bayes factors for
the autoregressive hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the denominator
a 30
-vector containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Woźniak, T., and Droumaguet, M., (2024) Bayesian Assessment of Identifying Restrictions for Heteroskedastic Structural VARs
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify autoregression H0 = matrix(NA, ncol(us_fiscal_lsuw), ncol(us_fiscal_lsuw) + 1) H0[1,3] = 0 # a hypothesis of no Granger causality from gdp to ttr sddr = verify_autoregression(posterior, H0) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> verify_autoregression(hypothesis = H0) -> sddr
Computes the logarithm of Bayes factor(s) for the hypothesis
in which the model is not identified through heteroskedasticity of non-normality
using Savage-Dickey Density Ration (SDDR).
The hypothesis of no such identification, , is represented by
model-specific restrictions.Consult help files for individual classes of models
for details.
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of the logarithm of the marginal posterior distribution
ordinate at the restriction less the log-marginal prior distribution ordinate
at the same point:
Therefore, a negative value of the difference is the evidence against the lack of identification of the structural shock through heteroskedasticity or non-normality.
verify_identification(posterior)
verify_identification(posterior)
posterior |
the estimation outcome obtained using |
An object of class SDDRid*
that is a list with components:
logSDDR
a vector with values of the logarithm of the Bayes factors
log_SDDR_se
a vector with numerical standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed
based on 30 random sub-samples of the log-ordinates of the marginal posterior
and prior distributions.
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
verify_identification.PosteriorBSVAR
, verify_identification.PosteriorBSVARSV
,
verify_identification.PosteriorBSVARMIX
, verify_identification.PosteriorBSVARMSH
,
verify_identification.PosteriorBSVART
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_identification() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_identification() -> sddr
Displays information that the model is homoskedastic and with normal shocks.
## S3 method for class 'PosteriorBSVAR' verify_identification(posterior)
## S3 method for class 'PosteriorBSVAR' verify_identification(posterior)
posterior |
the estimation outcome obtained using |
Nothing. Just displays a message.
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
verify_identification.PosteriorBSVAR
, verify_identification.PosteriorBSVARSV
,
verify_identification.PosteriorBSVARMIX
, verify_identification.PosteriorBSVARMSH
,
verify_identification.PosteriorBSVART
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_identification() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_identification() -> sddr
Computes the logarithm of Bayes factor for the hypothesis of normality for each of the structural shocks via Savage-Dickey Density Ration (SDDR). The hypothesis of normality in this mixture of normals model is represented by restriction:
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR as the difference of logarithms of the marginal posterior distribution ordinate at the restriction less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARMIX' verify_identification(posterior)
## S3 method for class 'PosteriorBSVARMIX' verify_identification(posterior)
posterior |
the estimation outcome obtained using |
An object of class SDDRid*
that is a list with components:
logSDDR
a vector with values of the logarithm of the Bayes factors
log_SDDR_se
a vector with numerical standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed
based on 30 random sub-samples of the log-ordinates of the marginal posterior
and prior distributions.
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> verify_identification() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> verify_identification() -> sddr
Computes the logarithm of Bayes factor for the homoskedasticity hypothesis for each of the structural shocks via Savage-Dickey Density Ration (SDDR). The hypothesis of homoskedasticity is represented by restriction:
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR as the difference of logarithms of the marginal posterior distribution ordinate at the restriction less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARMSH' verify_identification(posterior)
## S3 method for class 'PosteriorBSVARMSH' verify_identification(posterior)
posterior |
the estimation outcome obtained using |
An object of class SDDRid*
that is a list with components:
logSDDR
a vector with values of the logarithm of the Bayes factors
log_SDDR_se
a vector with numerical standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed
based on 30 random sub-samples of the log-ordinates of the marginal posterior
and prior distributions.
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_identification() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_identification() -> sddr
Computes the logarithm of Bayes factor for the homoskedasticity
hypothesis for each of the structural shocks via Savage-Dickey Density Ratio
(SDDR). The hypothesis of homoskedasticity for the structural shock n
is represented by restriction:
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR as the difference of the logarithm of the marginal posterior distribution ordinate at the restriction less the log-marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARSV' verify_identification(posterior)
## S3 method for class 'PosteriorBSVARSV' verify_identification(posterior)
posterior |
the estimation outcome obtained using |
An object of class SDDRid*
that is a list with components:
logSDDR
a vector with values of the logarithm of the Bayes factors
log_SDDR_se
a vector with numerical standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed
based on 30 random sub-samples of the log-ordinates of the marginal posterior
and prior distributions.
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_identification() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_identification() -> sddr
Computes the logarithm of Bayes factor for the hypothesis of normality
of the joint conditional distribution of the structural shocks via
Savage-Dickey Density Ration (SDDR).
The hypothesis of normality in this t-distributed shocks model is represented
by restriction setting the degrees-of-freedom parameter to infinity:
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR as the difference of logarithms of the marginal posterior distribution ordinate at the restriction less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of the marginal posterior ordinate is done using truncated Gaussian kernel smoothing.
## S3 method for class 'PosteriorBSVART' verify_identification(posterior)
## S3 method for class 'PosteriorBSVART' verify_identification(posterior)
posterior |
the estimation outcome obtained using |
An object of class SDDRidT
that is a list with components:
logSDDR
the value of the logarithm of the Bayes factor
SDDR
the value of the Bayes factor
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> verify_identification() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_t$new(us_fiscal_lsuw) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_identification(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_t$new() |> estimate(S = 10) |> verify_identification() -> sddr
This function will be deprecated starting from version 4.0.
It is replaced by verify_identification
function.
Computes the logarithm of Bayes factor for the homoskedasticity hypothesis
for each of the structural shocks via Savage-Dickey Density Ration (SDDR).
The hypothesis of homoskedasticity, , is represented by model-specific restrictions.
Consult help files for individual classes of models for details.
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR
as the difference of logarithms of the marginal posterior distribution ordinate at the restriction
less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of both elements of the difference requires numerical integration.
verify_volatility(posterior)
verify_volatility(posterior)
posterior |
the |
An object of class SDDRvolatility
that is a list of three components:
logSDDR
an N
-vector with values of the logarithm of the Bayes factors for
the homoskedasticity hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an Nx30
matrix containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_volatility() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_volatility() -> sddr
This function will be deprecated starting from version 4.0.
It is replaced by verify_identification
function.
Displays information that the model is homoskedastic.
## S3 method for class 'PosteriorBSVAR' verify_volatility(posterior)
## S3 method for class 'PosteriorBSVAR' verify_volatility(posterior)
posterior |
the |
Nothing. Just displays a message: The model is homoskedastic.
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_volatility() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar$new(p = 1) |> estimate(S = 10) |> verify_volatility() -> sddr
This function will be deprecated starting from version 4.0.
It is replaced by verify_identification
function.
Computes the logarithm of Bayes factor for the homoskedasticity hypothesis for each of the structural shocks via Savage-Dickey Density Ration (SDDR). The hypothesis of homoskedasticity is represented by restriction:
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR as the difference of logarithms of the marginal posterior distribution ordinate at the restriction less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARMIX' verify_volatility(posterior)
## S3 method for class 'PosteriorBSVARMIX' verify_volatility(posterior)
posterior |
the |
An object of class SDDRvolatility
that is a list of three components:
logSDDR
an N
-vector with values of the logarithm of the Bayes factors for
the homoskedasticity hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an Nx30
matrix containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> verify_volatility() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_mix$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_mix$new(p = 1, M = 2) |> estimate(S = 10) |> verify_volatility() -> sddr
This function will be deprecated starting from version 4.0.
It is replaced by verify_identification
function.
Computes the logarithm of Bayes factor for the homoskedasticity hypothesis for each of the structural shocks via Savage-Dickey Density Ration (SDDR). The hypothesis of homoskedasticity is represented by restriction:
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR as the difference of logarithms of the marginal posterior distribution ordinate at the restriction less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARMSH' verify_volatility(posterior)
## S3 method for class 'PosteriorBSVARMSH' verify_volatility(posterior)
posterior |
the |
An object of class SDDRvolatility
that is a list of three components:
logSDDR
an N
-vector with values of the logarithm of the Bayes factors for
the homoskedasticity hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an Nx30
matrix containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_volatility() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_msh$new(us_fiscal_lsuw, p = 1, M = 2) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_msh$new(p = 1, M = 2) |> estimate(S = 10) |> verify_volatility() -> sddr
This function will be deprecated starting from version 4.0.
It is replaced by verify_identification
function.
Computes the logarithm of Bayes factor for the homoskedasticity hypothesis for each of the structural shocks via Savage-Dickey Density Ration (SDDR). The hypothesis of homoskedasticity is represented by restriction:
The logarithm of Bayes factor for this hypothesis can be computed using the SDDR as the difference of logarithms of the marginal posterior distribution ordinate at the restriction less the marginal prior distribution ordinate at the same point:
Therefore, a negative value of the difference is the evidence against homoskedasticity of the structural shock. The estimation of both elements of the difference requires numerical integration.
## S3 method for class 'PosteriorBSVARSV' verify_volatility(posterior)
## S3 method for class 'PosteriorBSVARSV' verify_volatility(posterior)
posterior |
the |
An object of class SDDRvolatility
that is a list of three components:
logSDDR
an N
-vector with values of the logarithm of the Bayes factors for
the homoskedasticity hypothesis for each of the shocks
log_SDDR_se
an N
-vector with estimation standard errors of the logarithm of
the Bayes factors reported in output element logSDDR
that are computed based on 30 random
sub-samples of the log-ordinates of the marginal posterior and prior distributions.
components
a list of three components for the computation of the Bayes factor
an N
-vector with values of the logarithm of the Bayes factor denominators
an N
-vector with values of the logarithm of the Bayes factor numerators
an NxS
matrix of the log-full conditional posterior density ordinates computed to estimate the numerator
an Nx30
matrix containing the log-Bayes factors on the basis of which the standard errors are computed
Tomasz Woźniak [email protected]
Lütkepohl, H., and Woźniak, T., (2020) Bayesian Inference for Structural Vector Autoregressions Identified by Markov-Switching Heteroskedasticity. Journal of Economic Dynamics and Control 113, 103862, doi:10.1016/j.jedc.2020.103862.
Lütkepohl, H., Shang, F., Uzeda, L., and Woźniak, T. (2024) Partial Identification of Heteroskedastic Structural VARs: Theory and Bayesian Inference. University of Melbourne Working Paper, 1–57, doi:10.48550/arXiv.2404.11057.
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_volatility() -> sddr
# simple workflow ############################################################ # upload data data(us_fiscal_lsuw) # specify the model and set seed specification = specify_bsvar_sv$new(us_fiscal_lsuw, p = 1) set.seed(123) # estimate the model posterior = estimate(specification, 10) # verify heteroskedasticity sddr = verify_volatility(posterior) # workflow with the pipe |> ############################################################ set.seed(123) us_fiscal_lsuw |> specify_bsvar_sv$new(p = 1) |> estimate(S = 10) |> verify_volatility() -> sddr