
R6 Class representing the specification of the BVARPANEL model
Source:R/specify_bvarpanel.R
specify_bvarPANEL.Rd
The class BVARPANEL presents complete specification for the Bayesian Panel Vector Autoregression.
References
Jarocinski (2010). Responses to monetary policy shocks in the east and the west of Europe: a comparison. Journal of Applied Econometrics, 25(5), 833-868, doi:10.1002/jae.1082 .
Dieppe, Legrand, Roye (2016). The BEAR toolbox, ECB Working Papers, 1934, doi:10.2866/292952 .
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.
prior
an object PriorBSVAR with the prior specification.
data_matrices
an object DataMatricesBVARPANEL with the data matrices.
starting_values
an object StartingValuesBVARPANEL 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 BVARPANEL.
Usage
specify_bvarPANEL$new(
data,
p = 1L,
exogenous = NULL,
stationary = rep(FALSE, ncol(data[[1]])),
type = rep("real", ncol(data[[1]]))
)
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.
Method set_to_Jarocinski()
Sets the model in line with the specification by Jarocinski (2010) as presented by Dieppe, Legrand, Roye (2016).
Examples
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$set_to_Jarocinski()
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_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
## ------------------------------------------------
## Method `specify_bvarPANEL$set_to_Jarocinski`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$set_to_Jarocinski()
#> Setting the model in line with the specification by Jarocinski (2010).
## ------------------------------------------------
## Method `specify_bvarPANEL$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_bvarPANEL$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_bvarPANEL$get_starting_values`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_starting_values()
#> <StartingValuesBVARPANEL>
#> Public:
#> A: 1.00027546094615 -0.00104396782773321 -0.000451125086876 ...
#> A_c: 0.000176713630489803 0.00119982467116132 9.1880175624384 ...
#> Sigma: 2.9677896769255 1.41175494060745 0.744473509708274 2.002 ...
#> Sigma_c: 6.57724226160291 0.642526063494252 5.04414606561116 3.95 ...
#> V: 14.9111724758742 -0.751041521591868 1.86234784221944 -0. ...
#> clone: function (deep = FALSE)
#> get_starting_values: function ()
#> initialize: function (C, N, p, d = 0)
#> m: -0.000417243251157751
#> nu: 5.1
#> s: 0.61375219715645
#> set_starting_values: function (last_draw)
#> w: 0.661147977591415
## ------------------------------------------------
## Method `specify_bvarPANEL$get_type`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$get_type()
#> [1] "wozniak"
## ------------------------------------------------
## Method `specify_bvarPANEL$set_global2pooled`
## ------------------------------------------------
data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
data = ilo_dynamic_panel,
p = 4
)
spec$set_global2pooled()
## ------------------------------------------------
## Method `specify_bvarPANEL$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))