
R6 Class representing the specification of the BSVARSIGN model
Source:R/specify.R
      specify_bsvarSIGN.RdThe class BSVARSIGN presents complete specification for the Bayesian Structural VAR model with sign and narrative restrictions.
Public fields
pa non-negative integer specifying the autoregressive lag order of the model.
identificationan object IdentificationBSVARSIGN with the identifying restrictions.
prioran object PriorBSVARSIGN with the prior specification.
data_matricesan object DataMatricesBSVARSIGN with the data matrices.
starting_valuesan object StartingValuesBSVARSIGN with the starting values.
Methods
Method new()
Create a new specification of the Bayesian Structural VAR model with sign and narrative restrictions BSVARSIGN.
Usage
specify_bsvarSIGN$new(
  data,
  p = 1L,
  sign_irf,
  sign_narrative,
  sign_structural,
  max_tries = Inf,
  exogenous = NULL,
  stationary = rep(FALSE, ncol(data))
)Arguments
dataa
(T+p)xNmatrix with time series data.pa positive integer providing model's autoregressive lag order.
sign_irfa
NxNxHarray - sign and zero restrictions on the impulse response functions, ±1 for positive/negative sign restriction 0 for zero restrictions and NA for no restrictions, theh-th sliceNxNmatrix contains the restrictions on theh-1horizon.sign_narrativea list of objects of class "narrative" - narrative sign restrictions.
sign_structurala
NxNmatrix with entries ±1 or NA - sign restrictions on the contemporaneous relationsBbetween reduced-form errorsEand structural shocksUwhereBE=U.max_triesa positive integer with the maximum number of iterations for finding a rotation matrix \(Q\) that would satisfy sign restrictions
exogenousa
(T+p)xdmatrix of exogenous variables.stationaryan
Nlogical vector - its element set toFALSEsets the prior mean for the autoregressive parameters of theNth equation to the white noise process, otherwise to random walk.
Method get_data_matrices()
Returns the data matrices as the DataMatricesBSVAR object.
Examples
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the data matrices
spec$get_data_matrices()
Method get_identification()
Returns the identifying restrictions as the IdentificationBSVARSIGN object.
Examples
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the identifying restrictions
spec$get_identification()
Method get_prior()
Returns the prior specification as the PriorBSVAR object.
Examples
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the prior specification
spec$get_prior()
Method get_starting_values()
Returns the starting values as the StartingValuesBSVAR object.
Examples
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the starting values
spec$get_starting_values()
Examples
# specify a model with the optimism data and 4 lags
data(optimism)
specification = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
## ------------------------------------------------
## Method `specify_bsvarSIGN$get_data_matrices`
## ------------------------------------------------
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the data matrices
spec$get_data_matrices()
#> <DataMatricesBSVAR>
#>   Public:
#>     X: 0.200390767 -11.08316654 -4.301382328 0.012867114 -7.572 ...
#>     Y: 0.194524324 -11.02210681 -4.293947793 0.024503568 -7.577 ...
#>     clone: function (deep = FALSE) 
#>     get_data_matrices: function () 
#>     initialize: function (data, p = 1L, exogenous = NULL) 
## ------------------------------------------------
## Method `specify_bsvarSIGN$get_identification`
## ------------------------------------------------
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the identifying restrictions
spec$get_identification()
#> <IdentificationBSVARSIGN>
#>   Public:
#>     VB: list
#>     clone: function (deep = FALSE) 
#>     get_identification: function () 
#>     initialize: function (N, sign_irf, sign_narrative, sign_structural, max_tries = Inf) 
#>     max_tries: Inf
#>     set_identification: function (N, sign_irf, sign_narrative, sign_structural) 
#>     sign_irf: NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA ...
#>     sign_narrative: list
#>     sign_structural: 1 NA NA NA NA NA 1 NA NA NA NA NA 1 NA NA NA NA NA 1 NA  ...
## ------------------------------------------------
## Method `specify_bsvarSIGN$get_prior`
## ------------------------------------------------
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the prior specification
spec$get_prior()
#> <PriorBSVARSIGN>
#>   Public:
#>     A: 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0  ...
#>     S: 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
#>     V: 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0  ...
#>     X: 0.200390767 -11.08316654 -4.301382328 0.012867114 -7.572 ...
#>     Xsoc: 0.201757572 0 0 0 0 0.201757572 0 0 0 0 0.201757572 0 0  ...
#>     Xsur: 0.201757572 -11.0726542625 -4.2879895105 0.00226154775 - ...
#>     Y: 0.194524324 -11.02210681 -4.293947793 0.024503568 -7.577 ...
#>     Ysoc: 0.201757572 0 0 0 0 0 -11.0726542625 0 0 0 0 0 -4.287989 ...
#>     Ysur: 0.201757572 -11.0726542625 -4.2879895105 0.00226154775 - ...
#>     clone: function (deep = FALSE) 
#>     data: NA
#>     delta.scale: 0.618033988749895
#>     delta.shape: 2.61803398874989
#>     estimate_hyper: function (S = 10000, burn_in = S/2, mu = FALSE, delta = FALSE, 
#>     get_prior: function () 
#>     hyper: 1 1 0.2 6.63317874235789e-05 0.00655120654453227 1.68010 ...
#>     initialize: function (data, p, exogenous = NULL, stationary = rep(FALSE, 
#>     lambda.scale: 0.540312423743285
#>     lambda.shape: 1.37015621187164
#>     mu.scale: 0.618033988749895
#>     mu.shape: 2.61803398874989
#>     nu: 7
#>     p: 4
#>     psi.scale: 0.000799362037821841
#>     psi.shape: 0.998405094554603
## ------------------------------------------------
## Method `specify_bsvarSIGN$get_starting_values`
## ------------------------------------------------
# specify a model with the optimism data and 4 lags
data(optimism)
spec = specify_bsvarSIGN$new(
   data = optimism,
   p = 4
)
# get the starting values
spec$get_starting_values()
#> <StartingValuesBSVAR>
#>   Public:
#>     A: 0.492827306268737 0 0 0 0 0 0.616342768538743 0 0 0 0 0  ...
#>     B: 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1
#>     clone: function (deep = FALSE) 
#>     get_starting_values: function () 
#>     hyper: 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...
#>     initialize: function (N, p, d = 0) 
#>     set_starting_values: function (last_draw)