Skip to contents

The class BVARPANEL presents complete specification for the Bayesian Panel Vector Autoregression.

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 to FALSE sets the prior mean for the autoregressive parameters of the Nth 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.

Returns

A new complete specification for the Bayesian Panel VAR model BVARPANEL.


Method get_data_matrices()

Returns the data matrices as the DataMatricesBVARPANEL object.

Usage

specify_bvarPANEL$get_data_matrices()

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.

Usage

specify_bvarPANEL$get_prior()

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.

Usage

specify_bvarPANEL$get_starting_values()

Examples

data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
   data = ilo_dynamic_panel,
   p = 4
)
spec$get_starting_values()


Method set_adaptiveMH()

Sets the parameters of adaptive Metropolis-Hastings sampler for the parameter nu.

Usage

specify_bvarPANEL$set_adaptiveMH(x)

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))


Method clone()

The objects of this class are cloneable with this method.

Usage

specify_bvarPANEL$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

data(ilo_dynamic_panel)
spec = specify_bvarPANEL$new(
   data = ilo_dynamic_panel,
   p = 4
)


## ------------------------------------------------
## 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: 0.999193846313155 -0.000176656804944019 0.00027292916346 ...
#>     A_c: 0.0013106177317252 0.00092094690910458 -0.00041990974783 ...
#>     Sigma: 3.29530850908816 0.241564500407962 1.85251180626374 0.01 ...
#>     Sigma_c: 11.0168069833002 7.41486560775783 1.86343803664628 -0.75 ...
#>     V: 17.1443865864033 -1.03052365852677 -8.1551584086238 3.21 ...
#>     clone: function (deep = FALSE) 
#>     get_starting_values: function () 
#>     initialize: function (C, N, p, d = 0) 
#>     m: 0.000867367925420229
#>     nu: 5.1
#>     s: 1.84851436961589
#>     set_starting_values: function (last_draw) 
#>     w: 0.205986636798871


## ------------------------------------------------
## 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))