Estimates the Bayesian Hierarchical Panel VAR with fixed or estimated country grouping for global prior parameters using the Gibbs sampler proposed by Sanchez-Martinez & Woźniak (2024).
# S3 method for BVARGROUPPRIORPANEL
estimate(specification, S, thin = 1L, show_progress = TRUE)An object of class PosteriorBVARGROUPPRIORPANEL containing the Bayesian
estimation output and containing two elements:
posteriora list with a collection of S draws from the
posterior distribution generated via Gibbs sampler. Elements of the list
correspond to the parameters of the model listed in section Details
and are named respectively:
A_c, Sigma_c, A_g, Sigma_g,
V, nu, m, w, s.
last_drawan object of class BVARGROUPPRIORPANEL with the last draw of the
current MCMC run as the starting value to be passed to the continuation of
the MCMC estimation using the estimate() method.
an object of class BVARGROUPPRIORPANEL generated using the
specify_bvarGroupPriorPANEL$new() function.
a positive integer, the number of posterior draws to be generated
a positive integer, specifying the frequency of MCMC output thinning
a logical value, if TRUE the estimation progress
bar is visible
Tomasz Woźniak wozniak.tom@pm.me
The Bayesian Hierarchical Panel Vector Autoregressive model with fixed or estimated country grouping for global prior parametrs is estimated using the Gibbs sampler. In this estimation procedure all the parameters of the model are estimated jointly. The list of parameters of the model includes:
a KxN country-specific autoregressive
parameters matrix for each of the countries \(c = 1,\dots,C\)
an NxN country-specific covariance
matrix for each of the countries \(c = 1,\dots,C\)
a KxNxG group-specific global autoregressive parameters matrix
an NxN group-specific global covariance matrix
a KxK covariance matrix of prior for global autoregressive parameters
prior degrees of freedom parameter
prior average global persistence parameter
prior scaling parameter
prior scaling parameter
Parameters \(\mathbf{A}_c\) and \(\mathbf{\Sigma}_c\) have prior expected values determined by the group-specific prior parameters \(\mathbf{A}_g\) and \(\mathbf{\Sigma}_g\).
Gibbs sampler is an algorithm to sample random draws from the posterior distribution of the parameters of the model given the data. The algorithm is briefly explained on an example of a two-parameter model with parameters \(\theta_1\) and \(\theta_2\). In order to sample from the joint posterior distribution \(p(\theta_1,\theta_2|\mathbf{Y})\) the Gibbs sampler proceeds by sampling from full-conditional posterior distributions of each parameter given data and all the other parameters, denoted by \(p(\theta_1|\theta_2,\mathbf{Y})\) and \(p(\theta_2|\theta_1,\mathbf{Y})\). These distributions are available from derivations and should be in a form of distributions that are easy to sample random numbers from.
To obtain S draws from the posterior distribution:
Set the initial values of the parameters \(\theta_2^{(0)}\)
At each of the s iterations:
Sample \(\theta_1^{(s)}\) from \(p(\theta_1|\theta_2^{(s-1)},\mathbf{Y})\)
Sample \(\theta_2^{(s)}\) from \(p(\theta_2|\theta_1^{(s)},\mathbf{Y})\)
Repeat step 2. S times. Return \(\{\theta_1^{(s)},\theta_2^{(s)}\}_{s=1}^{S}\)
as a sample drawn from the posterior distribution \(p(\theta_1,\theta_2|\mathbf{Y})\).
The estimate() function returns the draws from the posterior distribution
of the parameters of the hierarchical panel VAR model listed above.
Thinning.
Thinning is a procedure to reduce the dependence in the returned sample from
the posterior distribution. It is obtained by returning every thin
draw in the final sample. This procedure reduces the number of draws returned
by the estimate() function.
bpvars, specify_bvarGroupPriorPANEL,
specify_posterior_bvarGroupPriorPANEL, summary.PosteriorBVARGROUPPRIORPANEL,
forecast.PosteriorBVARGROUPPRIORPANEL
# specify the model
specification = specify_bvarGroupPriorPANEL$new(
data = ilo_dynamic_panel[1:5],
exogenous = ilo_exogenous_variables[1:5],
group_allocation = country_grouping_region[1:5]
)
burn_in = estimate(specification, 10) # run the burn-in; use say S = 10000
posterior = estimate(burn_in, 10) # estimate the model; use say S = 10000
Run the code above in your browser using DataLab