
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.0004222043 0.0006501080 0.0012499903
#> [2,] -0.0009718499 -0.0010486317 -0.0008307542
#> [3,] 0.0005009054 -0.0016539865 -0.0006067960
#> [4,] -0.0002200551 0.0005205827 -0.0016297165
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] -0.0004222043 0.0006501080 0.0012499903
#> [2,] -0.0009718499 -0.0010486317 -0.0008307542
#> [3,] 0.0005009054 -0.0016539865 -0.0006067960
#> [4,] -0.0002200551 0.0005205827 -0.0016297165
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 11.054583 -6.452089 -2.738560
#> [2,] -6.452089 5.181829 2.640022
#> [3,] -2.738560 2.640022 4.015721
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 11.054583 -6.452089 -2.738560
#> [2,] -6.452089 5.181829 2.640022
#> [3,] -2.738560 2.640022 4.015721
#>
#>
#> $A_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] -0.0004222043 0.0006501080 0.0012499903
#> [2,] -0.0009718499 -0.0010486317 -0.0008307542
#> [3,] 0.0005009054 -0.0016539865 -0.0006067960
#> [4,] -0.0002200551 0.0005205827 -0.0016297165
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] -0.0003545664 -0.0005990713 0.0012128407
#> [2,] -0.0009351309 0.0009833790 -0.0001310420
#> [3,] -0.0011016376 -0.0003252651 -0.0005967342
#> [4,] 0.0010563334 -0.0009807718 -0.0002770626
#>
#>
#> $Sigma_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 11.054583 -6.452089 -2.738560
#> [2,] -6.452089 5.181829 2.640022
#> [3,] -2.738560 2.640022 4.015721
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 3.6664234 -0.5456039 0.6481999
#> [2,] -0.5456039 5.8577783 -2.5316815
#> [3,] 0.6481999 -2.5316815 1.1928924
#>
#>
#> $A
#> [,1] [,2] [,3]
#> [1,] 1.0011027251 0.0003457896 -0.0014171642
#> [2,] 0.0004408114 0.9998159577 -0.0008317081
#> [3,] 0.0007753801 -0.0011149413 0.9987718053
#> [4,] 0.0005554824 -0.0002991252 0.0008651155
#>
#> $V
#> [,1] [,2] [,3] [,4]
#> [1,] 2.43659762 -0.5668973 0.04993978 1.161918
#> [2,] -0.56689731 7.6209162 -0.27326484 -4.762355
#> [3,] 0.04993978 -0.2732648 5.91882013 -4.537300
#> [4,] 1.16191781 -4.7623554 -4.53730001 10.328448
#>
#> $Sigma
#> [,1] [,2] [,3]
#> [1,] 3.7529676 -0.3712154 -1.837243
#> [2,] -0.3712154 2.7486511 -1.711033
#> [3,] -1.8372431 -1.7110334 2.317283
#>
#> $nu
#> [1] 4.1
#>
#> $m
#> [1] -0.001477999
#>
#> $w
#> [1] 0.9307829
#>
#> $s
#> [1] 2.486871
#>
## ------------------------------------------------
## 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