
R6 Class Representing StartingValuesBVARGROUPPANEL
Source:R/specify_bvargrouppanel.R
specify_starting_values_bvarGroupPANEL.Rd
The class StartingValuesBVARGROUPPANEL presents starting values for the Bayesian hierarchical panel VAR model with country grouping
Public fields
group_allocation
a numeric vector with integer numbers denoting group allocations
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\).A_g
an
KxNxG
array of starting values for the group parameter \(\mathbf{A}_g\).Sigma_g
an
NxNxG
array of starting values for the group parameter \(\mathbf{\Sigma}_g\).A
an
KxN
matrix of starting values for the global parameter \(\mathbf{A}\).V
an
KxK
matrix of starting values for the global parameter \(\mathbf{V}\).Sigma
an
NxN
matrix of starting values for the global parameter \(\mathbf{\Sigma}\).nu
a positive scalar with starting values for the global parameter \(\nu\).
m
a positive scalar with starting values for the global hyper-parameter \(m\).
w
a positive scalar with starting values for the global hyper-parameter \(w\).
s
a positive scalar with starting values for the global hyper-parameter \(s\).
Methods
Method new()
Create new starting values StartingValuesBVARGROUPPANEL
Usage
specify_starting_values_bvarGroupPANEL$new(
group_allocation = 1:C,
C,
G = C,
N,
p,
d = 0
)
Arguments
group_allocation
a numeric vector with integer numbers denoting group allocations
C
a positive integer - the number of countries in the data.
G
a positive integer specifying the number of country groups.
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 Panel VAR 2-country model with 4 lags for a 3-variable system.
sv = specify_starting_values_bvarGroupPANEL$new(C = 2, N = 3, p = 1)
Method get_starting_values()
Returns the elements of the starting values StartingValuesBVARGROUPPANEL as
a list
.
Examples
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bvarGroupPANEL$new(rep(1,2), 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 StartingValuesBVARGROUPPANEL as a list
.
Returns
An object of class StartingValuesBVARGROUPPANEL 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_bvarGroupPANEL$new(rep(1,2), 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_bvarGroupPANEL$new(rep(1,2), C = 2, G = 1, N = 3, p = 1)
## ------------------------------------------------
## Method `specify_starting_values_bvarGroupPANEL$new`
## ------------------------------------------------
# starting values for Bayesian Panel VAR 2-country model with 4 lags for a 3-variable system.
sv = specify_starting_values_bvarGroupPANEL$new(C = 2, N = 3, p = 1)
## ------------------------------------------------
## Method `specify_starting_values_bvarGroupPANEL$get_starting_values`
## ------------------------------------------------
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bvarGroupPANEL$new(rep(1,2), C = 2, N = 3, p = 1)
sv$get_starting_values() # show starting values as list
#> $group_allocation
#> [1] 1 1
#>
#> $A_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 0.0022169531 0.0005244152 -0.0001294337
#> [2,] -0.0008536692 0.0009905186 0.0010225674
#> [3,] -0.0001992421 0.0001747587 -0.0009377588
#> [4,] -0.0007353139 0.0014288056 0.0002044613
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 0.0022169531 0.0005244152 -0.0001294337
#> [2,] -0.0008536692 0.0009905186 0.0010225674
#> [3,] -0.0001992421 0.0001747587 -0.0009377588
#> [4,] -0.0007353139 0.0014288056 0.0002044613
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 7.1530495 0.3852697 -0.5724674
#> [2,] 0.3852697 1.3694771 1.1149584
#> [3,] -0.5724674 1.1149584 9.7154034
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 7.1530495 0.3852697 -0.5724674
#> [2,] 0.3852697 1.3694771 1.1149584
#> [3,] -0.5724674 1.1149584 9.7154034
#>
#>
#> $A_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 0.0022169531 0.0005244152 -0.0001294337
#> [2,] -0.0008536692 0.0009905186 0.0010225674
#> [3,] -0.0001992421 0.0001747587 -0.0009377588
#> [4,] -0.0007353139 0.0014288056 0.0002044613
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] -0.0004448028 7.679883e-04 2.973849e-04
#> [2,] -0.0004546452 4.811032e-04 1.486436e-07
#> [3,] 0.0003704734 1.344689e-05 5.058221e-06
#> [4,] -0.0020134380 -2.934444e-04 7.167765e-05
#>
#>
#> $Sigma_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 7.1530495 0.3852697 -0.5724674
#> [2,] 0.3852697 1.3694771 1.1149584
#> [3,] -0.5724674 1.1149584 9.7154034
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 7.025458 -2.0539160 4.419272
#> [2,] -2.053916 0.6853985 -1.148069
#> [3,] 4.419272 -1.1480688 5.525203
#>
#>
#> $A
#> [,1] [,2] [,3]
#> [1,] 0.999239076 2.741030e-03 0.0007697757
#> [2,] -0.001173978 1.000426e+00 0.0009615553
#> [3,] 0.001064278 1.964475e-04 0.9989422323
#> [4,] -0.001592186 -9.387424e-05 -0.0008444011
#>
#> $V
#> [,1] [,2] [,3] [,4]
#> [1,] 6.4619624 2.7086960 -2.875977 0.7136854
#> [2,] 2.7086960 1.6152750 -1.235379 -0.4378362
#> [3,] -2.8759766 -1.2353787 4.027357 -1.8932154
#> [4,] 0.7136854 -0.4378362 -1.893215 6.4823345
#>
#> $Sigma
#> [,1] [,2] [,3]
#> [1,] 5.522574 2.3843202 1.4956507
#> [2,] 2.384320 2.3078554 0.7623362
#> [3,] 1.495651 0.7623362 1.0844285
#>
#> $nu
#> [1] 4.1
#>
#> $m
#> [1] -0.0006687873
#>
#> $w
#> [1] 2.405269
#>
#> $s
#> [1] 0.803955
#>
## ------------------------------------------------
## Method `specify_starting_values_bvarGroupPANEL$set_starting_values`
## ------------------------------------------------
sv = specify_starting_values_bvarGroupPANEL$new(rep(1,2), 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