
R6 Class Representing StartingValuesBVARGROUPPRIORPANEL
Source:R/specify_bvargrouppriorpanel.R
specify_starting_values_bvarGroupPriorPANEL.RdThe class StartingValuesBVARGROUPPRIORPANEL presents starting values for the Bayesian hierarchical panel VAR model with country grouping
Public fields
group_allocationa numeric vector with integer numbers denoting group allocations
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\).A_gan
KxNxGarray of starting values for the group parameter \(\mathbf{A}_g\).Sigma_gan
NxNxGarray of starting values for the group parameter \(\mathbf{\Sigma}_g\).Van
KxKmatrix of starting values for the global parameter \(\mathbf{V}\).nua positive scalar with starting values for the global parameter \(\nu\).
ma positive scalar with starting values for the global hyper-parameter \(m\).
wa positive scalar with starting values for the global hyper-parameter \(w\).
sa positive scalar with starting values for the global hyper-parameter \(s\).
Methods
Method new()
Create new starting values StartingValuesBVARGROUPPRIORPANEL
Usage
specify_starting_values_bvarGroupPriorPANEL$new(
group_allocation = 1:C,
C,
G = C,
N,
p,
d = 0
)Arguments
group_allocationa numeric vector with integer numbers denoting group allocations
Ca positive integer - the number of countries in the data.
Ga positive integer specifying the number of country groups.
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 Panel VAR 2-country model with 4 lags for a 3-variable system.
sv = specify_starting_values_bvarGroupPriorPANEL$new(C = 2, N = 3, p = 1)
Method get_starting_values()
Returns the elements of the starting values StartingValuesBVARGROUPPRIORPANEL as
a list.
Examples
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bvarGroupPriorPANEL$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 StartingValuesBVARGROUPPRIORPANEL as a list.
Returns
An object of class StartingValuesBVARGROUPPRIORPANEL 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_bvarGroupPriorPANEL$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_bvarGroupPriorPANEL$new(rep(1,2), C = 2, G = 1, N = 3, p = 1)
## ------------------------------------------------
## Method `specify_starting_values_bvarGroupPriorPANEL$new`
## ------------------------------------------------
# starting values for Bayesian Panel VAR 2-country model with 4 lags for a 3-variable system.
sv = specify_starting_values_bvarGroupPriorPANEL$new(C = 2, N = 3, p = 1)
## ------------------------------------------------
## Method `specify_starting_values_bvarGroupPriorPANEL$get_starting_values`
## ------------------------------------------------
# starting values for a homoskedastic bsvar with 1 lag for a 3-variable system
sv = specify_starting_values_bvarGroupPriorPANEL$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.0020451393 0.0004965037 -0.0003728032
#> [2,] -0.0002702563 0.0005020127 0.0002422922
#> [3,] -0.0012768255 -0.0010399399 -0.0015184510
#> [4,] 0.0010613305 0.0007793300 0.0004250963
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 6.051461e-05 0.0016199643 -0.0008788840
#> [2,] -5.377549e-04 0.0005606681 -0.0003193911
#> [3,] 1.040491e-03 0.0006994739 -0.0008213249
#> [4,] 4.905058e-04 0.0010812325 -0.0010326295
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 4.1966385 2.385857 0.6460942
#> [2,] 2.3858567 4.070663 3.0261089
#> [3,] 0.6460942 3.026109 7.6673435
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 0.5311315 -0.6671718 -0.4060376
#> [2,] -0.6671718 2.8605027 2.2119050
#> [3,] -0.4060376 2.2119050 4.2589574
#>
#>
#> $A_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] -0.0004480547 0.0007083164 0.0002119796
#> [2,] 0.0004254906 0.0010679395 -0.0006597962
#> [3,] 0.0000553545 0.0006219025 -0.0005489873
#> [4,] 0.0004392436 -0.0008161045 -0.0003616569
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] -0.0014430809 0.0005596102 8.019185e-04
#> [2,] -0.0000949583 -0.0004392130 -2.594575e-04
#> [3,] -0.0009551923 -0.0006336498 -5.050476e-05
#> [4,] -0.0009121014 0.0009825083 4.811193e-04
#>
#>
#> $Sigma_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 0.9462163 0.5908122 0.1122672
#> [2,] 0.5908122 6.3230897 2.3585968
#> [3,] 0.1122672 2.3585968 1.8201840
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 13.9082802 -5.410356 -0.7909062
#> [2,] -5.4103565 4.137030 2.7725416
#> [3,] -0.7909062 2.772542 3.5125537
#>
#>
#> $V
#> [,1] [,2] [,3] [,4]
#> [1,] 7.0078101 3.774476 -1.7438346 -0.7689369
#> [2,] 3.7744760 14.561875 4.0742435 1.0099462
#> [3,] -1.7438346 4.074243 2.9695319 0.6613022
#> [4,] -0.7689369 1.009946 0.6613022 1.4923635
#>
#> $nu
#> [1] 4.1
#>
#> $m
#> [1] 0.0006998389
#>
#> $w
#> [1] 0.22463
#>
#> $s
#> [1] 0.4051467
#>
## ------------------------------------------------
## Method `specify_starting_values_bvarGroupPriorPANEL$set_starting_values`
## ------------------------------------------------
sv = specify_starting_values_bvarGroupPriorPANEL$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