
R6 Class Representing StartingValuesBVARs
Source:R/specify_bvars.R
specify_starting_values_bvars.RdThe class StartingValuesBVARs presents starting values for the Bayesian hierarchical panel VAR model.
Public fields
A_can
KxNxCarray of starting values for the local parameter \(\mathbf{A}_c\).Sigma_can
NxNxCarray of starting values for the local parameter \(\mathbf{\Sigma}_c\).nua
C-vector of positive starting values for the parameter \(\nu\).ma
C-vector of starting values for the parameter \(m\).wa
C-vector of positive starting values for the parameter \(w\).sa
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
Ca positive integer - the number of countries in the data.
Na positive integer - the number of dependent variables in the model.
pa positive integer - the autoregressive lag order of the SVAR model.
da positive integer - the number of
exogenousvariables 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.0008439452 -0.0007882124 0.0001943920
#> [2,] -0.0003762337 0.0003822045 -0.0010544180
#> [3,] -0.0009723747 0.0005832566 0.0002652598
#> [4,] 0.0003887593 -0.0008468751 -0.0007845331
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 0.0002853872 -0.0006962775 -0.0007984509
#> [2,] -0.0012866067 -0.0015543635 -0.0003771572
#> [3,] -0.0007154793 -0.0022001920 -0.0008928337
#> [4,] -0.0007581746 -0.0007670535 -0.0012432983
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 13.439611 -1.11358127 -3.15303610
#> [2,] -1.113581 3.25161200 -0.03968527
#> [3,] -3.153036 -0.03968527 4.14559302
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 5.6932944 8.183204 -0.9675549
#> [2,] 8.1832045 12.081936 -1.2255126
#> [3,] -0.9675549 -1.225513 2.9932015
#>
#>
#> $nu
#> [1] 4.1 4.1
#>
#> $m
#> [1] -0.0008362471 -0.0010932186
#>
#> $w
#> [1] 2.6617484 0.4549631
#>
#> $s
#> [1] 2.729605 2.342323
#>
## ------------------------------------------------
## 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