
R6 Class Representing StartingValuesBVARs
Source:R/specify_bvars.R
specify_starting_values_bvars.Rd
The class StartingValuesBVARs presents starting values for the Bayesian hierarchical panel VAR model.
Public fields
A_c
an
KxNxC
array of starting values for the local parameter \(\mathbf{A}_c\).Sigma_c
an
NxNxC
array of starting values for the local parameter \(\mathbf{\Sigma}_c\).nu
a
C
-vector of positive starting values for the parameter \(\nu\).m
a
C
-vector of starting values for the parameter \(m\).w
a
C
-vector of positive starting values for the parameter \(w\).s
a
C
-vector of positive starting values for the parameter \(s\).
Methods
Method new()
Create new starting values StartingValuesBVARs
Usage
specify_starting_values_bvars$new(C, N, p, d = 0)
Arguments
C
a positive integer - the number of countries in the data.
N
a positive integer - the number of dependent variables in the model.
p
a positive integer - the autoregressive lag order of the SVAR model.
d
a positive integer - the number of
exogenous
variables in the model.
Examples
# starting values for Bayesian VARs 2-country model with 4 lags for a 3-variable system.
sv = specify_starting_values_bvars$new(C = 2, N = 3, p = 4)
Method get_starting_values()
Returns the elements of the starting values StartingValuesBVARs as
a list
.
Examples
# starting values for bvars with 1 lag for a 3-variable system
sv = specify_starting_values_bvars$new(C = 2, N = 3, p = 1)
sv$get_starting_values() # show starting values as list
Method set_starting_values()
Returns the elements of the starting values StartingValuesBVARs as a list
.
Returns
An object of class StartingValuesBVARs including the last draw of the current MCMC as the starting value to be passed to the continuation of the MCMC estimation.
Examples
sv = specify_starting_values_bvars$new(C = 2, N = 3, p = 1)
# Modify the starting values by:
sv_list = sv$get_starting_values() # getting them as list
sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry
sv$set_starting_values(sv_list) # providing to the class object
Examples
# starting values for a Bayesian Panel VAR
sv = specify_starting_values_bvars$new(C = 2, N = 3, p = 1)
## ------------------------------------------------
## Method `specify_starting_values_bvars$new`
## ------------------------------------------------
# starting values for Bayesian VARs 2-country model with 4 lags for a 3-variable system.
sv = specify_starting_values_bvars$new(C = 2, N = 3, p = 4)
## ------------------------------------------------
## Method `specify_starting_values_bvars$get_starting_values`
## ------------------------------------------------
# starting values for bvars with 1 lag for a 3-variable system
sv = specify_starting_values_bvars$new(C = 2, N = 3, p = 1)
sv$get_starting_values() # show starting values as list
#> $A_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] -0.0010024581 -0.0010707982 0.0017753185
#> [2,] 0.0008821220 -0.0020482645 -0.0016375782
#> [3,] -0.0008983295 0.0031665772 -0.0008477375
#> [4,] -0.0012736552 0.0007317187 -0.0004198311
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 0.0014022355 -0.0003363294 0.0005682050
#> [2,] -0.0011602870 0.0007689071 0.0009147492
#> [3,] 0.0018721340 -0.0003636009 -0.0007173053
#> [4,] -0.0005298107 -0.0003380236 0.0002174968
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 4.194525 2.990488 1.888987
#> [2,] 2.990488 2.581446 1.791845
#> [3,] 1.888987 1.791845 2.958865
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 2.7775959 -1.1154045 -0.9249686
#> [2,] -1.1154045 0.7529706 -0.8119075
#> [3,] -0.9249686 -0.8119075 5.2813963
#>
#>
#> $nu
#> [1] 4.1 4.1
#>
#> $m
#> [1] 0.0006660262 -0.0010253000
#>
#> $w
#> [1] 1.546962 1.050858
#>
#> $s
#> [1] 0.2322738 1.5703606
#>
## ------------------------------------------------
## Method `specify_starting_values_bvars$set_starting_values`
## ------------------------------------------------
sv = specify_starting_values_bvars$new(C = 2, N = 3, p = 1)
# Modify the starting values by:
sv_list = sv$get_starting_values() # getting them as list
sv_list$A <- matrix(rnorm(12), 3, 4) # modifying the entry
sv$set_starting_values(sv_list) # providing to the class object