
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.87515 0.02025745 0.06437922 0.04020933
#> 2 99.66863 0.05381938 0.17097034 0.10657629
#> 3 99.43001 0.09263695 0.29420042 0.18315551
#> 4 99.18411 0.13265342 0.42120808 0.26202634
#>
#> $variable2
#> shock1 shock2 shock3 shock4
#> 0 88.12376 11.876236 0.00000 0.00000
#> 1 40.88596 9.421648 30.55782 19.13457
#> 2 39.75722 9.623252 31.09809 19.52143
#> 3 40.33802 9.544033 30.77057 19.34738
#> 4 41.35228 9.388295 30.22801 19.03141
#>
#> $variable3
#> shock1 shock2 shock3 shock4
#> 0 84.91026 2.596507 12.49324 0.00000
#> 1 42.23550 9.441414 30.78883 17.53426
#> 2 38.10358 10.072567 32.83968 18.98417
#> 3 33.83180 10.711499 34.83403 20.62267
#> 4 32.68206 10.866973 35.18553 21.26544
#>
#> $variable4
#> shock1 shock2 shock3 shock4
#> 0 12.23352 13.033412 42.06767 32.66540
#> 1 22.85796 11.748637 37.67648 27.71693
#> 2 29.82657 10.881674 34.80590 24.48586
#> 3 34.81591 10.201594 32.59457 22.38792
#> 4 39.59240 9.500662 30.33161 20.57532
#>
# 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.84170 3.331830 19.77031 0.05615810
#> 2 60.84646 5.617367 33.44195 0.09422069
#> 3 51.83992 6.901681 41.14293 0.11547298
#> 4 46.49314 7.663984 45.71484 0.12803912
#>
#> $variable2
#> shock1 shock2 shock3 shock4
#> 0 1.7402995 98.25970 0.00000 0.0000000
#> 1 0.2495607 17.44331 82.05617 0.2509605
#> 2 0.1546671 13.15761 86.42411 0.2636108
#> 3 0.1347491 12.35343 87.24494 0.2668775
#> 4 0.1335267 12.22089 87.37772 0.2678607
#>
#> $variable3
#> shock1 shock2 shock3 shock4
#> 0 0.27805015 2.54906 97.17289 0.0000000
#> 1 0.01529335 14.22832 85.52940 0.2269904
#> 2 0.02904369 14.47348 85.26584 0.2316301
#> 3 0.04924045 14.58606 85.13136 0.2333370
#> 4 0.07540629 14.64846 85.04203 0.2341075
#>
#> $variable4
#> shock1 shock2 shock3 shock4
#> 0 0.0006177073 13.09857 86.61211 0.2887102
#> 1 0.0132675315 13.59381 86.11595 0.2769717
#> 2 0.0329920407 14.38525 85.32457 0.2571929
#> 3 0.0544750657 14.71926 84.97774 0.2485228
#> 4 0.0802603874 14.84012 84.83452 0.2451078
#>