R6 Class Representing StartingValuesBSVAR
Source:R/specify_bsvar.R
specify_starting_values_bsvar.Rd
The class StartingValuesBSVAR presents starting values for the homoskedastic bsvar model.
Public fields
A
an
NxK
matrix of starting values for the parameter \(A\).B
an
NxN
matrix of starting values for the parameter \(B\).hyper
a
(2*N+1)x2
matrix of starting values for the shrinkage hyper-parameters of the hierarchical prior distribution.
Methods
Method new()
Create new starting values StartingValuesBSVAR.
Usage
specify_starting_values_bsvar$new(N, p, d = 0)
Arguments
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 a homoskedastic bsvar with 4 lags for a 3-variable system
sv = specify_starting_values_bsvar$new(N = 3, p = 4)
Method get_starting_values()
Returns the elements of the starting values StartingValuesBSVAR as a list
.
Examples
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bsvar$new(N = 3, p = 1)
sv$get_starting_values() # show starting values as list
Method set_starting_values()
Returns the elements of the starting values StartingValuesBSVAR as a list
.
Arguments
last_draw
a list containing the last draw of elements
B
- anNxN
matrix,A
- anNxK
matrix, andhyper
- a vector of 5 positive real numbers.
Returns
An object of class StartingValuesBSVAR including the last draw of the current MCMC
as the starting value to be passed to the continuation of the MCMC estimation using estimate()
.
Examples
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bsvar$new(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 homoskedastic bsvar for a 3-variable system
sv = specify_starting_values_bsvar$new(N = 3, p = 1)
## ------------------------------------------------
## Method `specify_starting_values_bsvar$new`
## ------------------------------------------------
# starting values for a homoskedastic bsvar with 4 lags for a 3-variable system
sv = specify_starting_values_bsvar$new(N = 3, p = 4)
## ------------------------------------------------
## Method `specify_starting_values_bsvar$get_starting_values`
## ------------------------------------------------
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bsvar$new(N = 3, p = 1)
sv$get_starting_values() # show starting values as list
#> $B
#> [,1] [,2] [,3]
#> [1,] 1 0 0
#> [2,] 0 1 0
#> [3,] 0 0 1
#>
#> $A
#> [,1] [,2] [,3] [,4]
#> [1,] 0.001944602 0.0000000 0.00000000 0
#> [2,] 0.000000000 0.4801926 0.00000000 0
#> [3,] 0.000000000 0.0000000 0.06342184 0
#>
#> $hyper
#> [,1] [,2]
#> [1,] 10 10
#> [2,] 10 10
#> [3,] 10 10
#> [4,] 10 10
#> [5,] 10 10
#> [6,] 10 10
#> [7,] 10 10
#>
## ------------------------------------------------
## Method `specify_starting_values_bsvar$set_starting_values`
## ------------------------------------------------
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bsvar$new(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