Skip to contents

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 the forecast() 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

# specify the model
specification = specify_bvarPANEL$new(
      ilo_dynamic_panel, 
      exogenous = ilo_exogenous_variables)
burn_in       = estimate(specification, 10)             # run the burn-in
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  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
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  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)
#> **************************************************|
#>  bpvars: Forecasting with Bayesian Panel VARs     |
#> **************************************************|
#>  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.20572 0.01713435    27.17839     27.22276
#> 2 27.23621 0.02471803    27.19926     27.26745
#> 3 27.26906 0.03790437    27.20663     27.31474
#> 4 27.30356 0.05125057    27.23776     27.37668
#> 5 27.33231 0.06035702    27.25292     27.41278
#> 6 27.35248 0.06526581    27.26065     27.43027
#> 
#> $variable2
#>       mean       sd 5% quantile 95% quantile
#> 1 2.657395 1.296731   0.8322561     4.304127
#> 2 3.371238 2.385561   0.6838957     6.542516
#> 3 3.778699 3.424897  -1.0569508     8.345179
#> 4 2.991731 3.938224  -1.4595711     8.444515
#> 5 2.315362 4.819355  -3.6906717     9.105023
#> 6 2.071746 4.199494  -3.5932886     7.217697
#> 
#> $variable3
#>       mean        sd 5% quantile 95% quantile
#> 1 57.13529 0.7046672    56.17041     58.00444
#> 2 56.85915 1.5330654    54.71749     58.62135
#> 3 56.77072 1.9419717    54.21948     59.63737
#> 4 57.41043 2.3975274    54.45045     60.23617
#> 5 57.77458 3.0246026    53.61735     61.00221
#> 6 58.08162 2.8383532    54.34007     61.65279
#> 
#> $variable4
#>       mean        sd 5% quantile 95% quantile
#> 1 58.75354 0.4534078    58.13107     59.38133
#> 2 58.91937 0.6032468    57.87655     59.42175
#> 3 59.08754 0.6026798    58.19990     59.82331
#> 4 59.31735 0.6232068    58.41958     60.01503
#> 5 59.32579 0.8421962    58.04522     60.39250
#> 6 59.52576 1.1836941    57.69693     61.04103
#> 

# workflow with the pipe |>
############################################################
ilo_dynamic_panel |>
  specify_bvarPANEL$new() |>
  estimate(S = 10) |> 
  estimate(S = 20) |> 
  forecast(horizon = 2) |> 
  summary(which_c = "POL")
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  Progress of the MCMC simulation for 10 draws
#>     Every draw is saved via MCMC thinning
#>  Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  Progress of the MCMC simulation for 20 draws
#>     Every draw is saved via MCMC thinning
#>  Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#>  bpvars: Forecasting with Bayesian Panel VARs     |
#> **************************************************|
#>  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.21471 0.02654923    27.17621     27.25369
#> 2 27.25864 0.04002221    27.20596     27.32313
#> 
#> $variable2
#>       mean       sd 5% quantile 95% quantile
#> 1 2.912610 1.793348  0.01351445     5.542122
#> 2 2.599017 2.808424 -1.55231303     6.862643
#> 
#> $variable3
#>       mean       sd 5% quantile 95% quantile
#> 1 56.93790 0.866412    55.57193     58.15785
#> 2 57.04864 1.471670    55.23364     59.03791
#> 
#> $variable4
#>       mean        sd 5% quantile 95% quantile
#> 1 58.69016 0.4247980    58.09202     59.40445
#> 2 58.64120 0.5487356    57.97211     59.63082
#> 

# conditional forecasting 6 years ahead conditioning on 
#  provided future values for the Gross Domestic Product 
#  growth rate
############################################################
specification = specify_bvarPANEL$new(ilo_dynamic_panel)    # specify the model
burn_in       = estimate(specification, 10)               # run the burn-in
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  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
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  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)
#> **************************************************|
#>  bpvars: Forecasting with Bayesian Panel VARs     |
#> **************************************************|
#>  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 3.381242 1.697315  0.93017247     5.548099
#> 2 3.494060 3.018412 -0.07421561     7.755544
#> 3 3.431616 3.978301 -0.61876448     9.497034
#> 4 3.406686 4.385033 -1.25295177     9.741378
#> 5 3.233877 4.697363 -2.83257460     8.956343
#> 6 2.634449 5.042335 -3.80131918     8.387920
#> 
#> $variable3
#>       mean        sd 5% quantile 95% quantile
#> 1 56.67397 0.8637966    55.59580     57.98038
#> 2 56.73316 1.6669955    54.17275     58.96951
#> 3 56.66879 2.3019324    52.98519     59.34358
#> 4 56.52904 2.7428799    52.40603     59.64295
#> 5 56.83278 2.8990082    52.51661     60.06281
#> 6 57.14279 3.0047746    53.47715     61.03857
#> 
#> $variable4
#>       mean        sd 5% quantile 95% quantile
#> 1 58.69842 0.6033508    57.83911     59.46098
#> 2 58.87325 0.7829074    57.62750     59.69134
#> 3 58.79514 0.9327940    57.39489     59.83575
#> 4 58.62168 1.0188026    57.02006     59.94763
#> 5 58.83143 1.3528214    56.83283     60.36296
#> 6 58.83097 1.3459496    56.55677     60.12602
#> 

# workflow with the pipe |>
############################################################
ilo_dynamic_panel |>
  specify_bvarPANEL$new() |>
  estimate(S = 10) |> 
  estimate(S = 20) |> 
  forecast(
    horizon = 6, 
    conditional_forecast = ilo_conditional_forecasts
  ) |> 
  summary(which_c = "POL")
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  Progress of the MCMC simulation for 10 draws
#>     Every draw is saved via MCMC thinning
#>  Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#> bpvars: Forecasting with Bayesian Panel VARs      |
#> **************************************************|
#>  Progress of the MCMC simulation for 20 draws
#>     Every draw is saved via MCMC thinning
#>  Press Esc to interrupt the computations
#> **************************************************|
#> **************************************************|
#>  bpvars: Forecasting with Bayesian Panel VARs     |
#> **************************************************|
#>  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 2.626172 1.511814   0.4110344     4.502724
#> 2 2.977185 2.410963  -2.2871937     6.046909
#> 3 2.729622 2.973580  -2.0413994     6.756203
#> 4 2.627761 4.121769  -3.5702656     7.347993
#> 5 2.635623 4.607727  -2.6762139     8.886457
#> 6 2.737346 4.990901  -3.5267335     8.468564
#> 
#> $variable3
#>       mean        sd 5% quantile 95% quantile
#> 1 57.26719 0.7281697    56.03709     58.29942
#> 2 57.26437 1.1980792    55.67203     59.87396
#> 3 57.50356 1.5251371    55.37847     60.27276
#> 4 57.72876 2.1272563    55.13855     60.82074
#> 5 57.82116 2.4933866    54.34246     61.36448
#> 6 57.97642 2.7872370    54.44538     62.09246
#> 
#> $variable4
#>       mean        sd 5% quantile 95% quantile
#> 1 58.88447 0.4399017    58.23702     59.50339
#> 2 59.12074 0.4756367    58.49965     59.82913
#> 3 59.24966 0.8035938    58.11454     60.39495
#> 4 59.44956 0.9388350    58.33534     60.78632
#> 5 59.56611 0.7763338    58.79451     60.41785
#> 6 59.80011 0.8984679    58.72104     61.06092
#>