
R6 Class Representing StartingValuesBVARGROUPPRIORPANEL
Source:R/specify_bvargrouppriorpanel.R
specify_starting_values_bvarGroupPriorPANEL.Rd
The class StartingValuesBVARGROUPPRIORPANEL 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\).V
an
KxK
matrix of starting values for the global parameter \(\mathbf{V}\).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 StartingValuesBVARGROUPPRIORPANEL
Usage
specify_starting_values_bvarGroupPriorPANEL$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_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,] 1.114515e-03 -0.0003533794 5.838406e-05
#> [2,] 1.251217e-03 0.0005911322 6.617383e-04
#> [3,] 6.596357e-05 0.0013302549 -1.001868e-03
#> [4,] 2.218166e-03 -0.0007671495 -2.256738e-04
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] -0.0013802821 -0.0009673269 -0.0007649193
#> [2,] -0.0012905383 0.0003638539 0.0032668982
#> [3,] 0.0009896022 -0.0010200314 0.0005849369
#> [4,] 0.0003846026 0.0013062056 0.0010230719
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 4.0767008 -0.8155517 -1.4807864
#> [2,] -0.8155517 3.9857398 0.2788689
#> [3,] -1.4807864 0.2788689 1.7903693
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 2.795002 1.377769 -1.506457
#> [2,] 1.377769 4.493589 -1.894984
#> [3,] -1.506457 -1.894984 3.875533
#>
#>
#> $A_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] -9.926901e-05 -0.0008329126 0.0004736181
#> [2,] -1.845907e-04 -0.0010961735 -0.0004832081
#> [3,] -3.862775e-04 0.0000325702 0.0007234020
#> [4,] 2.108102e-04 0.0010216043 0.0014178012
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] -0.0019769875 -0.0001416479 0.0020124466
#> [2,] 0.0016993314 -0.0014085652 -0.0012799339
#> [3,] -0.0009386552 0.0026355546 0.0007588856
#> [4,] -0.0005087893 -0.0010518730 0.0001754743
#>
#>
#> $Sigma_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 6.952252 -1.709008 2.771885
#> [2,] -1.709008 1.420044 1.493825
#> [3,] 2.771885 1.493825 7.925652
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 10.510129 -4.319628 1.389456
#> [2,] -4.319628 15.502644 2.400801
#> [3,] 1.389456 2.400801 1.441138
#>
#>
#> $V
#> [,1] [,2] [,3] [,4]
#> [1,] 2.036343 -1.2935302 -1.9438950 -2.218065
#> [2,] -1.293530 5.6095845 0.8652247 1.236719
#> [3,] -1.943895 0.8652247 8.7412812 3.239101
#> [4,] -2.218065 1.2367188 3.2391008 2.615652
#>
#> $nu
#> [1] 4.1
#>
#> $m
#> [1] 0.001111239
#>
#> $w
#> [1] 2.131777
#>
#> $s
#> [1] 0.2635627
#>
## ------------------------------------------------
## 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