
Provides posterior summary of forecast error variance decompositions
Source:R/summary.R
summary.PosteriorFEVDPANEL.Rd
Provides posterior means of the forecast error variance decompositions of each variable at all horizons.
Usage
# S3 method for class 'PosteriorFEVDPANEL'
summary(object, which_c, ...)
Arguments
- object
an object of class
PosteriorFEVDPANEL
obtained using thecompute_variance_decompositions()
function containing draws from the posterior distribution of the forecast error variance decompositions.- which_c
a positive integer or a character string specifying the country for which the forecast should be plotted.
- ...
additional arguments affecting the summary produced.
Value
A list reporting the posterior mean of the forecast error variance decompositions of each variable at all horizons.
Author
Tomasz Woźniak wozniak.tom@pm.me
Examples
# upload data
data(ilo_dynamic_panel)
# specify the model and set seed
set.seed(123)
specification = specify_bvarPANEL$new(ilo_dynamic_panel, p = 1)
# run the burn-in
burn_in = estimate(specification, 10)
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of the MCMC simulation for 10 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
# estimate the model
posterior = estimate(burn_in, 20)
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of the MCMC simulation for 20 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
# compute forecast error variance decomposition 4 years ahead
fevd = compute_variance_decompositions(posterior, horizon = 4)
summary(fevd, which_c = "POL")
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Posterior means of forecast error |
#> variance decompositions |
#> **************************************************|
#> $variable1
#> shock1 shock2 shock3 shock4
#> 0 100.00000 0.00000000 0.00000000 0.00000000
#> 1 99.87520 0.02025046 0.06435945 0.04019284
#> 2 99.66875 0.05380019 0.17091587 0.10653117
#> 3 99.43021 0.09260470 0.29410918 0.18307935
#> 4 99.18438 0.13261038 0.42108745 0.26192362
#>
#> $variable2
#> shock1 shock2 shock3 shock4
#> 0 88.07813 11.921872 0.00000 0.00000
#> 1 40.91810 9.416751 30.54249 19.12266
#> 2 39.78874 9.618410 31.08323 19.50962
#> 3 40.36919 9.539218 30.75594 19.33565
#> 4 41.38344 9.383471 30.21342 19.01967
#>
#> $variable3
#> shock1 shock2 shock3 shock4
#> 0 84.95448 2.589048 12.45647 0.00000
#> 1 42.27044 9.435627 30.77234 17.52159
#> 2 38.11884 10.070042 32.83467 18.97645
#> 3 33.84094 10.710014 34.83107 20.61797
#> 4 32.69893 10.864301 35.17831 21.25846
#>
#> $variable4
#> shock1 shock2 shock3 shock4
#> 0 12.26223 13.02934 42.05568 32.65274
#> 1 22.90051 11.74252 37.65813 27.69884
#> 2 29.86792 10.87556 34.78762 24.46891
#> 3 34.85410 10.19585 32.57744 22.37261
#> 4 39.62917 9.49505 30.31480 20.56099
#>
# workflow with the pipe |>
############################################################
set.seed(123)
ilo_dynamic_panel |>
specify_bvarPANEL$new(p = 1) |>
estimate(S = 10) |>
estimate(S = 20) |>
compute_variance_decompositions(horizon = 4) |>
summary(which_c = "global")
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of the MCMC simulation for 10 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of the MCMC simulation for 20 draws
#> Every draw is saved via MCMC thinning
#> Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Posterior means of forecast error |
#> variance decompositions |
#> **************************************************|
#> $variable1
#> shock1 shock2 shock3 shock4
#> 0 100.00000 0.000000 0.00000 0.00000000
#> 1 76.88083 3.329383 19.73358 0.05620561
#> 2 60.90550 5.614300 33.38588 0.09431903
#> 3 51.90604 6.898875 41.07948 0.11560990
#> 4 46.56159 7.661608 45.64859 0.12820338
#>
#> $variable2
#> shock1 shock2 shock3 shock4
#> 0 1.7320586 98.26794 0.00000 0.0000000
#> 1 0.2488363 17.49225 82.00743 0.2514877
#> 2 0.1545592 13.19875 86.38249 0.2642010
#> 3 0.1348588 12.39459 87.20308 0.2674783
#> 4 0.1337254 12.26282 87.33500 0.2684576
#>
#> $variable3
#> shock1 shock2 shock3 shock4
#> 0 0.27715954 2.535163 97.18768 0.0000000
#> 1 0.01533266 14.239824 85.51727 0.2275753
#> 2 0.02911994 14.485230 85.25343 0.2322184
#> 3 0.04937324 14.597882 85.11882 0.2339261
#> 4 0.07561271 14.660281 85.02941 0.2346965
#>
#> $variable4
#> shock1 shock2 shock3 shock4
#> 0 0.0006227468 13.11156 86.59834 0.2894691
#> 1 0.0133042648 13.60966 86.09942 0.2776195
#> 2 0.0330340060 14.40078 85.30842 0.2577682
#> 3 0.0545407787 14.73296 84.96339 0.2491063
#> 4 0.0803771191 14.85286 84.82107 0.2457008
#>