Forecasting Labour Market Indicators

Using the R Package bpvars

\[ \]

\[ \]

\[ \]

\[ \]

\[ \]

\[ \]

Tomasz Woźniak

Coming up next

\[ \]

modelling and forecasting framework

the R package bpvars

Materials

\[ \]

Presentation Slides as a website

GitHub repo to reproduce the slides and results

bpvars website and CRAN profile

vignette and manual

bsvars.org website

\[ \]

\[ \]

\[ \]

\[ \]

\[ \]

\[ \]

\[ \]

This research was funded by the International Labour Organization.

The bpvars package, vignette, and other outputs are copyrighted by the ILO.

Thank you!

modelling and forecasting framework

modelling and forecasting framework

data

  • annual country-level time series
  • \(\begin{bmatrix} gdp_{c.t} & UR_{c.t} & EPR_{c.t} & LFPR_{c.t} \end{bmatrix}\)
  • sampling period 1991-2024
  • 189 countries
  • illustrations for Ghana, ISO code: GHA

modelling and forecasting framework

data

modelling and forecasting framework

characterisation

  • contemporary Bayesian modelling and institutional setup
  • incorporates best knowledge and practices
  • a balance between model size, flexibility, and its capacity to extract signal from data
  • highly computational, application-specific modelling
  • inspirations: UN, IPCC, ECB, FED, Christopher Sims

modelling and forecasting framework

modelling features

  • Bayesian nonstationary variables handling
  • system modelling
  • dynamic approach
  • country-specific vector autoregression
  • global vector autoregression for prior mean
  • hierarchical modelling
  • model-coherent missing observation handling
  • parameter grouping
  • parameter estimation risk accountability

modelling and forecasting framework

country-specific vector autoregression

\[\begin{align} &\\ \mathbf{y}_{c.t} &= \mathbf{A}_{c.1} \mathbf{y}_{c.t-1} + \mathbf{A}_{d.c}\mathbf{x}_{c.t} + \boldsymbol\epsilon_{c.t}\\[1ex] \boldsymbol\epsilon_{c.t}\mid \mathbf{y}_{c.t-1} & \sim N_4\left(\mathbf{0}_4, \boldsymbol\Sigma_c\right)\\[2ex] \end{align}\]

  • subscript \(c\) is for country, and \(t\) is for time
  • captures country-specific dynamics, uncertainty and heterogeneity
  • parameters \(\mathbf{A}_{c.1}\), \(\mathbf{A}_{d.c}\) and \(\boldsymbol\Sigma_c\) are estimated

modelling and forecasting framework

global model for the prior mean

  • prior expectations are parameters

\[\begin{align} E_\pi\left[\mathbf{A}_{c}\right] &= \mathbf{A}, \qquad \mathbf{A}_{c} = \begin{bmatrix} \mathbf{A}_{c.1} & \mathbf{A}_{d.c} \end{bmatrix}'\\[1ex] E_\pi\left[\boldsymbol\Sigma_c\right] &= \boldsymbol\Sigma\\ \end{align}\]

  • parameters \(\mathbf{A}_{1}\), \(\mathbf{A}_{d}\) and \(\boldsymbol\Sigma\) are estimated
  • panel data efficiency gains and interpretations

modelling and forecasting framework

forecasting features

  • original non-stationary variables
  • point and density forecasting
  • forecasting for models with exogenous variables
  • restricted forecasting of rates
  • marginal forecasts of labour market indicators
  • expanding-window recursive forecasting
  • forecast performance evaluation
  • forecast error variance decomposition

modelling and forecasting framework

one-period-ahead conditional predictive density

\[\begin{align} &\\ {\color{lig}p\left(\mathbf{y}_{c.t+1}\mid \mathbf{y}_{c.t},\mathbf{A}_{c},\boldsymbol\Sigma_c\right)} & = N_4\left(\mathbf{A}_{c.1} \mathbf{y}_{c.t} + \mathbf{A}_{d.c}\mathbf{x}_{c.t+1}, \boldsymbol\Sigma_c\right)\\[5ex] \end{align}\]

  • implied by the model
  • equivalent to the frequentist predictive density

predictive density

\[\begin{align} p\left(\mathbf{y}_{c.t+1}\mid \mathbf{y}_{c.t}\right) &= \int p\left(\mathbf{y}_{c.t+1}\mid \mathbf{y}_{c.t},\mathbf{A}_{c},\boldsymbol\Sigma_c\right)p\left(\mathbf{A}_{c},\boldsymbol\Sigma_c\mid \mathbf{y}_{c.t}\right)d\left(\mathbf{A}_{c},\boldsymbol\Sigma_c\right) \end{align}\]

  • accounts for parameter uncertainty
  • used to generate forecast summaries

the model

missing observation handling

  • derived model-coherent joint density of missing observations \(\mathbf{y}_{c.m}\) given observed data \(\mathbf{y}_{c.o}\) and parameters \(\mathbf{A}_{c},\boldsymbol\Sigma_c\)

\[\begin{align} p\left(\mathbf{y}_{c.m}\mid \mathbf{y}_{c.o},\mathbf{A}_{c},\boldsymbol\Sigma_c\right) \end{align}\]

  • based on model’s likelihood function
  • sampled like other parameters during estimation
  • parameter estimation and forecasting embed uncertainty about missing observations

modelling and forecasting framework

missing data

the R package bpvars

the R package bpvars

features

  • precise estimation and forecasting
  • simple workflows in R
  • excellent computational speed
    • frontier econometric and numerical techniques
    • algorithms written in C++
  • extensive documentation
  • meeting all CRAN standards
  • to install the package run
install.packages("bpvars")
  • upload it in R using
library(bpvars)

the R package bpvars

the R package bpvars

the R package bpvars

inspect the data

library(bpvars)                                   # load the package
class(ilo_dynamic_panel)                          # input data is a list
[1] "list"
names(ilo_dynamic_panel)[1:72]                    # including multivariate time series for 189 countries
 [1] "AFG" "AGO" "ALB" "ARE" "ARG" "ARM" "AUS" "AUT" "AZE" "BDI" "BEL" "BEN"
[13] "BFA" "BGD" "BGR" "BHR" "BHS" "BIH" "BLR" "BLZ" "BOL" "BRA" "BRB" "BRN"
[25] "BTN" "BWA" "CAF" "CAN" "CHA" "CHE" "CHL" "CHN" "CIV" "CMR" "COD" "COG"
[37] "COL" "COM" "CPV" "CRI" "CUB" "CYP" "CZE" "DEU" "DJI" "DNK" "DOM" "DZA"
[49] "ECU" "EGY" "ERI" "ESH" "ESP" "EST" "ETH" "FIN" "FJI" "FRA" "GAB" "GBR"
[61] "GEO" "GHA" "GIN" "GMB" "GNB" "GNQ" "GRC" "GTM" "GUM" "GUY" "HKG" "HND"
tail(ilo_dynamic_panel$GHA, 8)                    # inspect Ghanian data
Time Series:
Start = 2017 
End = 2024 
Frequency = 1 
          gdp   UR      EPR LFPR
2017 24.73604 3.37 64.60284 66.9
2018 24.79571 3.20 63.19104 65.3
2019 24.85843 3.07 61.75763 63.7
2020 24.86322 3.18 59.65647 61.6
2021 24.91292 3.20 58.45631 60.4
2022 24.95010 2.87 57.40441 59.1
2023 24.98171 2.83 57.39665 59.1
2024 25.03675 2.82 57.39092 59.1

the R package bpvars

specify and estimate the model

spec = specify_bvarPANEL$new(                          # specify the model
  ilo_dynamic_panel,                                   # data
  exogenous = ilo_exogenous_variables                  # exogenous variables
)

burn = estimate(spec, S = 5000, show_progress = FALSE) # run the burn-in
post = estimate(burn, S = 5000)                        # estimate the model
**************************************************|
bpvars: Forecasting with Bayesian Panel VARs      |
**************************************************|
 Progress of the MCMC simulation for 5000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

the R package bpvars

forecast labour market outcomes

fore = forecast(                                    # forecast the model
  post,                                             # estimation output
  horizon = 3,                                      # forecast horizon
  exogenous_forecast = ilo_exogenous_forecasts,     # forecasts for exogenous variables
) 
plot(fore, "GHA", main = "Forecasts for Ghana")     # plot the forecasts

the R package bpvars

report the forecasts

summ = summary(fore, "GHA")                       # compute forecast summaries
 **************************************************|
 bsvars: Bayesian Structural Vector Autoregressions|
 **************************************************|
   Posterior summary of forecasts                  |
 **************************************************|
summ$variable2                                    # report forecasts for UR
      mean        sd 5% quantile 95% quantile
1 2.551846 0.9990947  0.94483619     4.202418
2 2.291787 1.4024042  0.04532671     4.621018
3 2.065867 1.6966899 -0.68005895     4.855773

the R package bpvars

forecast error variance decomposition

post |>                                              # estimation output
  compute_variance_decompositions(horizon = 5) |>    # compute variance decompositions
  plot(which_c = "GHA")                              # plot variance decompositions 

the R package bpvars

specify a model with rates restrictions

specr = specify_bvarPANEL$new(                           # specify the model
  ilo_dynamic_panel,                                     # data
  exogenous = ilo_exogenous_variables,                   # exogenous variables
  type = c("real","rate","rate","rate")                  # set variable type
)

burnr = estimate(specr, S = 5000, show_progress = FALSE) # run the burn-in
postr = estimate(burnr, S = 5000)                        # estimate the model
**************************************************|
bpvars: Forecasting with Bayesian Panel VARs      |
**************************************************|
 Progress of the MCMC simulation for 5000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

the R package bpvars

forecast with restrictions

forer = forecast(                                   # forecast the model
  postr,                                            # estimation output
  horizon = 3,                                      # forecast horizon
  exogenous_forecast = ilo_exogenous_forecasts,     # forecasts for exogenous variables
) 
plot(forer, "GHA", main = "Forecasts for Ghana")    # plot the forecasts

the R package bpvars

specify a model with missing data

specm = specify_bvarPANEL$new(                           # specify the model
  ilo_dynamic_panel_missing                              # data with missing observations
)

burnm = estimate(specm, S = 5000, show_progress = FALSE) # run the burn-in
postm = estimate(burnm, S = 5000)                        # estimate the model
**************************************************|
bpvars: Forecasting with Bayesian Panel VARs      |
**************************************************|
 Progress of the MCMC simulation for 5000 draws
    Every draw is saved via MCMC thinning
 Press Esc to interrupt the computations
**************************************************|

the R package bpvars

forecast with missing data

forem = forecast(                                   # forecast the model
  postm,                                            # estimation output
  horizon = 3                                       # forecast horizon
) 
plot(forem, "GHA", main = "Forecasts for Ghana")    # plot the forecasts