
Provides posterior summary of country-specific Forecasts
Source:R/summary.R
summary.ForecastsPANEL.Rd
Provides posterior summary of the forecasts including their mean, standard deviations, as well as 5 and 95 percentiles.
Usage
# S3 method for class 'ForecastsPANEL'
summary(object, which_c, ...)
Arguments
- object
an object of class
ForecastsPANEL
obtained using theforecast()
function containing draws the predictive density.- 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, standard deviations, as well as 5 and 95 percentiles of the forecasts for each of the variables and forecast horizons.
Author
Tomasz Woźniak wozniak.tom@pm.me
Examples
data(ilo_dynamic_panel) # load the data
data(ilo_exogenous_variables) # load the exogenous variables
data(ilo_exogenous_forecasts) # load the exogenous forecast
set.seed(123)
# specify the model
specification = specify_bvarPANEL$new(ilo_dynamic_panel, exogenous = ilo_exogenous_variables)
burn_in = estimate(specification, 10) # run the burn-in
#> **************************************************|
#> 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
#> **************************************************|
posterior = estimate(burn_in, 10) # estimate the model
#> **************************************************|
#> 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
#> **************************************************|
# forecast 6 years ahead
predictive = forecast(posterior, 6, exogenous_forecast = ilo_exogenous_forecasts)
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of sampling 10 draws from
#> the predictive density for 189 countries
#> Press Esc to interrupt the computations
#> **************************************************|
summary(predictive, which_c = "POL")
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Posterior summary of forecasts |
#> **************************************************|
#> $variable1
#> mean sd 5% quantile 95% quantile
#> 1 27.21313 0.02408779 27.17925 27.24678
#> 2 27.26328 0.02872232 27.22303 27.30292
#> 3 27.30317 0.03551064 27.25306 27.34854
#> 4 27.32994 0.04919399 27.24869 27.37955
#> 5 27.36593 0.05945156 27.26911 27.43259
#> 6 27.38928 0.07178596 27.26398 27.45590
#>
#> $variable2
#> mean sd 5% quantile 95% quantile
#> 1 2.40807736 2.781028 -0.4527158 6.624900
#> 2 1.24496724 4.152930 -4.1800817 6.866877
#> 3 0.32751712 4.873760 -5.5563806 7.803907
#> 4 -0.02704467 5.287953 -5.5903267 9.019138
#> 5 -0.69687307 6.522109 -7.9415887 10.391245
#> 6 -0.96770355 7.034244 -8.3263700 11.054763
#>
#> $variable3
#> mean sd 5% quantile 95% quantile
#> 1 57.16352 1.354577 55.11696 58.91706
#> 2 57.91711 2.418081 54.78912 61.27896
#> 3 58.24751 2.905088 54.08554 61.98561
#> 4 58.65433 3.447800 53.53754 63.14947
#> 5 59.19849 4.233077 52.57258 64.33293
#> 6 59.35829 4.384696 52.35733 64.62232
#>
#> $variable4
#> mean sd 5% quantile 95% quantile
#> 1 58.59896 0.5860690 57.89977 59.48806
#> 2 58.76046 0.7259160 57.75604 59.62976
#> 3 58.58593 0.5770199 57.94370 59.47961
#> 4 58.83867 1.2018172 57.17197 60.42921
#> 5 59.04460 1.0839648 57.37658 60.27974
#> 6 59.04860 1.1254583 57.43019 60.35866
#>
# workflow with the pipe |>
############################################################
set.seed(123)
ilo_dynamic_panel |>
specify_bvarPANEL$new() |>
estimate(S = 10) |>
estimate(S = 20) |>
forecast(horizon = 2) |>
summary(which_c = "POL")
#> **************************************************|
#> 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
#> **************************************************|
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of sampling 20 draws from
#> the predictive density for 189 countries
#> Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Posterior summary of forecasts |
#> **************************************************|
#> $variable1
#> mean sd 5% quantile 95% quantile
#> 1 27.20833 0.02293060 27.17483 27.24610
#> 2 27.24256 0.04283552 27.19347 27.31345
#>
#> $variable2
#> mean sd 5% quantile 95% quantile
#> 1 2.997389 2.162353 -0.2098005 6.847710
#> 2 2.917226 2.761776 -1.2939859 6.878136
#>
#> $variable3
#> mean sd 5% quantile 95% quantile
#> 1 57.07879 1.023305 55.62354 58.51224
#> 2 57.32821 1.475303 55.56415 59.32992
#>
#> $variable4
#> mean sd 5% quantile 95% quantile
#> 1 58.90945 0.4655718 58.26047 59.50511
#> 2 59.14221 0.6197496 58.12689 59.89945
#>
# conditional forecasting 6 years ahead conditioning on
# provided future values for the Gross Domestic Product
# growth rate
############################################################
data(ilo_conditional_forecasts) # load the conditional forecasts of dgdp
specification = specify_bvarPANEL$new(ilo_dynamic_panel) # specify the model
burn_in = estimate(specification, 10) # run the burn-in
#> **************************************************|
#> 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
#> **************************************************|
posterior = estimate(burn_in, 10) # estimate the model
#> **************************************************|
#> 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
#> **************************************************|
# forecast 6 years ahead
predictive = forecast(posterior, 6, conditional_forecast = ilo_conditional_forecasts)
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of sampling 10 draws from
#> the predictive density for 189 countries
#> Press Esc to interrupt the computations
#> **************************************************|
summary(predictive, which_c = "POL")
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Posterior summary of forecasts |
#> **************************************************|
#> $variable1
#> mean sd 5% quantile 95% quantile
#> 1 27.20126 0 27.20126 27.20126
#> 2 27.23543 0 27.23543 27.23543
#> 3 27.26786 0 27.26786 27.26786
#> 4 27.29738 0 27.29738 27.29738
#> 5 27.32664 0 27.32664 27.32664
#> 6 27.35630 0 27.35630 27.35630
#>
#> $variable2
#> mean sd 5% quantile 95% quantile
#> 1 2.973681 1.227588 1.1772623 4.507469
#> 2 2.635529 2.036198 0.6161675 5.906620
#> 3 2.000218 2.867367 -1.6123705 6.304890
#> 4 2.164576 3.533547 -3.0422035 6.899920
#> 5 2.129936 4.321618 -3.2759184 8.574320
#> 6 1.546426 4.708485 -4.6358375 8.523238
#>
#> $variable3
#> mean sd 5% quantile 95% quantile
#> 1 56.81393 0.8889243 55.73624 58.14803
#> 2 57.13270 1.0675554 55.86331 58.84959
#> 3 57.72576 1.3029900 55.97061 59.32348
#> 4 57.92379 1.5463203 55.63394 59.65388
#> 5 58.13444 1.8713668 55.16681 60.16263
#> 6 58.62768 2.2360629 55.00036 61.28873
#>
#> $variable4
#> mean sd 5% quantile 95% quantile
#> 1 58.58999 0.6262652 57.68080 59.22840
#> 2 58.75514 0.8353337 57.47879 59.67241
#> 3 59.04369 1.0280341 57.75008 60.50436
#> 4 59.36662 1.0051528 58.06321 60.77461
#> 5 59.58966 1.3872397 57.71167 61.37391
#> 6 59.74832 1.2667655 57.72392 61.17365
#>
# workflow with the pipe |>
############################################################
set.seed(123)
ilo_dynamic_panel |>
specify_bvarPANEL$new() |>
estimate(S = 10) |>
estimate(S = 20) |>
forecast(
horizon = 6,
conditional_forecast = ilo_conditional_forecasts
) |>
summary(which_c = "POL")
#> **************************************************|
#> 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
#> **************************************************|
#> **************************************************|
#> bvarPANELs: Forecasting with Bayesian Hierarchical|
#> Panel Vector Autoregressions |
#> **************************************************|
#> Progress of sampling 20 draws from
#> the predictive density for 189 countries
#> Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#> bsvars: Bayesian Structural Vector Autoregressions|
#> **************************************************|
#> Posterior summary of forecasts |
#> **************************************************|
#> $variable1
#> mean sd 5% quantile 95% quantile
#> 1 27.20126 0 27.20126 27.20126
#> 2 27.23543 0 27.23543 27.23543
#> 3 27.26786 0 27.26786 27.26786
#> 4 27.29738 0 27.29738 27.29738
#> 5 27.32664 0 27.32664 27.32664
#> 6 27.35630 0 27.35630 27.35630
#>
#> $variable2
#> mean sd 5% quantile 95% quantile
#> 1 3.007181 1.187988 1.5496527 4.550825
#> 2 2.941522 1.411298 0.5284924 4.905178
#> 3 3.262790 1.177452 1.3270715 4.720625
#> 4 3.607690 1.851331 0.6629180 5.905330
#> 5 3.782451 2.074489 0.8252096 7.410627
#> 6 4.649671 2.701390 1.0471496 8.424909
#>
#> $variable3
#> mean sd 5% quantile 95% quantile
#> 1 56.87378 0.7395947 55.72311 58.08833
#> 2 57.11138 0.8707632 55.93119 58.67562
#> 3 57.25478 0.6116271 56.38091 58.11049
#> 4 57.26768 0.7615292 55.96141 58.59629
#> 5 57.23646 0.9094884 55.89277 58.62619
#> 6 56.84628 1.7019902 54.56704 59.33068
#>
#> $variable4
#> mean sd 5% quantile 95% quantile
#> 1 58.68085 0.6007517 57.77775 59.60772
#> 2 58.94667 0.9403155 57.85677 60.67299
#> 3 59.31391 0.7256510 58.33254 60.67604
#> 4 59.53577 0.9282604 58.16218 60.93928
#> 5 59.60014 0.8710675 58.28617 61.00968
#> 6 59.71788 1.0181446 58.28245 61.45037
#>