
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.0009264790 0.0004239207 -0.0010126058
#> [2,] 0.0006523921 -0.0000440565 0.0002226111
#> [3,] 0.0004231408 0.0008209945 -0.0010010239
#> [4,] -0.0008625480 -0.0003605169 0.0003202384
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] -0.0009029412 -0.0002930912 -0.0013827853
#> [2,] 0.0009080859 0.0002653011 0.0002053105
#> [3,] -0.0003150738 -0.0019554789 0.0004125065
#> [4,] 0.0015206106 -0.0007476931 0.0007379095
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 4.518844 -2.748561 2.616351
#> [2,] -2.748561 2.697226 -1.434866
#> [3,] 2.616351 -1.434866 4.323841
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 2.5354358 -1.045453 0.1227443
#> [2,] -1.0454531 13.291854 -2.2304913
#> [3,] 0.1227443 -2.230491 1.9353094
#>
#>
#> $nu
#> [1] 4.1 4.1
#>
#> $m
#> [1] 0.0018590713 0.0001393031
#>
#> $w
#> [1] 0.08409662 0.14187185
#>
#> $s
#> [1] 0.4747519 0.8827887
#>
## ------------------------------------------------
## 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