
R6 Class representing the specification of the BVARGROUPPRIORPANEL model
Source:R/specify_bvargrouppriorpanel.R
specify_bvarGroupPriorPANEL.Rd
The class BVARGROUPPRIORPANEL presents complete specification for the Bayesian Panel
Vector Autoregression with county grouping for global prior parameters. The groups can be pre-specified,
which requires the argument group_allocation
to be provided, or estimated,
which requires the argument G
for the number of groups to be provided
and the argument group_allocation
to be left empty.
References
Zellner, Hong (1989). Forecasting international growth rates using Bayesian shrinkage and other procedures. Journal of Econometrics, 40(1), 183–202, doi:10.1016/0304-4076(89)90036-5 .
Public fields
p
a non-negative integer specifying the autoregressive lag order of the model.
G
a non-negative integer specifying the number of country groupings.
estimate_groups
a logical value denoting whether the groups are to be estimated.
prior
an object PriorBSVAR with the prior specification.
data_matrices
an object DataMatricesBVARPANEL with the data matrices.
starting_values
an object StartingValuesBVARGROUPPRIORPANEL with the starting values.
adaptiveMH
a vector of four values setting the adaptive MH sampler for nu: adaptive rate, target acceptance rate, the iteration at which to start adapting, the initial scaling rate
Methods
Method new()
Create a new specification of the Bayesian Panel VAR model with country
grouping for global prior parameters BVARGROUPPRIORPANEL. The groups can be pre-specified,
which requires the argument group_allocation
to be provided, or estimated,
which requires the argument G
for the number of groups to be provided
and the argument group_allocation
to be left empty.
Usage
specify_bvarGroupPriorPANEL$new(
data,
p = 1L,
exogenous = NULL,
stationary = rep(FALSE, ncol(data[[1]])),
type = rep("real", ncol(data[[1]])),
G = NULL,
group_allocation = NULL
)
Arguments
data
a list with
C
elements of(T_c+p)xN
matrices with time series data.p
a positive integer providing model's autoregressive lag order.
exogenous
a
(T+p)xd
matrix of exogenous variables.stationary
an
N
logical vector - its element set toFALSE
sets the prior mean for the autoregressive parameters of theN
th equation to the white noise process, otherwise to random walk.type
an
N
character vector with elements set to "rate" or "real" determining the truncation of the predictive density to[0, 100]
and(-Inf, Inf)
(no truncation) for each of the variables.G
a positive integer specifying the number of country groups. Its specification is required if
group_allocation
is not provided and the country groups to be estimated.group_allocation
an argument that can be provided as a numeric vector with integer numbers denoting group allocations to pre-specify the the country groups, in which case they are not estimated, or left empty if the country groups are to be estimated.
Method get_data_matrices()
Returns the data matrices as the DataMatricesBVARPANEL object.
Examples
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_data_matrices()
Method get_prior()
Returns the prior specification as the PriorBVARPANEL object.
Examples
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_prior()
Method get_starting_values()
Returns the starting values as the StartingValuesBVARPANEL object.
Examples
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_starting_values()
Method get_type()
Returns the type of the model.
Examples
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_type()
Method set_global2pooled()
Sets the prior mean of the global autoregressive parameters to the OLS pooled panel estimator following Zellner, Hong (1989).
Arguments
x
a vector of four values setting the adaptive MH sampler for nu: adaptive rate, target acceptance rate, the iteration at which to start adapting, the initial scaling rate
Examples
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$set_global2pooled()
Method set_adaptiveMH()
Sets the parameters of adaptive Metropolis-Hastings sampler for the parameter nu.
Arguments
x
a vector of four values setting the adaptive MH sampler for nu: adaptive rate, target acceptance rate, the iteration at which to start adapting, the initial scaling rate
Examples
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$set_adaptiveMH(c(0.6, 0.4, 10, 0.1))
Examples
data(ilo_dynamic_panel)
spec = specify_bvarGroupPriorPANEL$new(
data = ilo_dynamic_panel,
p = 4,
G = 2
)
#> Country groupings will be estimated.
## ------------------------------------------------
## Method `specify_bvarGroupPriorPANEL$get_data_matrices`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_data_matrices()
#> <DataMatricesBVARPANEL>
#> Public:
#> X: list
#> Y: list
#> clone: function (deep = FALSE)
#> get_data_matrices: function ()
#> initialize: function (data, p = 1L, exogenous = NULL, type = rep("real",
#> type: real real real real
## ------------------------------------------------
## Method `specify_bvarGroupPriorPANEL$get_prior`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_prior()
#> <PriorBVARPANEL>
#> Public:
#> M: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ...
#> S_Sigma_inv: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
#> S_inv: 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
#> W: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 ...
#> a_w: 1
#> clone: function (deep = FALSE)
#> eta: 5
#> get_prior: function ()
#> initialize: function (C, N, p, d = 0, stationary = rep(FALSE, N))
#> lambda: 72
#> mu_Sigma: 5
#> mu_m: 1
#> nu_s: 3
#> s_s: 1
#> s_w: 1
#> sigma2_m: 1
## ------------------------------------------------
## Method `specify_bvarGroupPriorPANEL$get_starting_values`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_starting_values()
#> <StartingValuesBVARPANEL>
#> Public:
#> A: 0.998658549704844 -0.000719659043776375 0.00047824296095 ...
#> A_c: -0.000646674632486275 0.00266780731315677 -0.00045436796 ...
#> Sigma: 6.10134500198224 2.36586229815875 0.121378355577619 -1.2 ...
#> Sigma_c: 7.36836732265444 -0.0500727537113589 -3.76010557288262 0 ...
#> V: 12.2250943216527 -6.83704689315007 -2.05237337702113 -2. ...
#> clone: function (deep = FALSE)
#> get_starting_values: function ()
#> initialize: function (C, N, p, d = 0)
#> m: -0.00179692181464839
#> nu: 5.1
#> s: 0.307035920842831
#> set_starting_values: function (last_draw)
#> w: 2.28017548314471
## ------------------------------------------------
## Method `specify_bvarGroupPriorPANEL$get_type`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_type()
#> [1] "wozniak"
## ------------------------------------------------
## Method `specify_bvarGroupPriorPANEL$set_global2pooled`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$set_global2pooled()
## ------------------------------------------------
## Method `specify_bvarGroupPriorPANEL$set_adaptiveMH`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$set_adaptiveMH(c(0.6, 0.4, 10, 0.1))