
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,] 0.0009516969 -0.0004839806 9.522224e-04
#> [2,] -0.0010578822 0.0009116711 -9.269967e-05
#> [3,] -0.0008119860 -0.0006659013 6.149023e-04
#> [4,] 0.0004236362 0.0016799581 -1.072839e-05
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 0.0011246474 0.0013300215 0.0008047053
#> [2,] -0.0001163289 0.0015508744 0.0006972936
#> [3,] -0.0010611993 -0.0010496180 0.0003998124
#> [4,] -0.0007123259 0.0004184763 -0.0009744530
#>
#>
#> $Sigma_c
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 2.071706 2.088356 1.314567
#> [2,] 2.088356 3.190384 1.881287
#> [3,] 1.314567 1.881287 1.424532
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 1.2026356 0.5276133 1.052760
#> [2,] 0.5276133 3.0746944 2.040217
#> [3,] 1.0527599 2.0402165 2.614561
#>
#>
#> $A_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 0.001973602 -0.0001667780 -0.0001753330
#> [2,] -0.001814809 0.0008185745 0.0004401300
#> [3,] 0.001537602 -0.0008551797 0.0002216969
#> [4,] -0.001689502 0.0014115359 -0.0015646329
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 0.0007870134 0.0006765234 -0.0025230834
#> [2,] -0.0007820800 -0.0015770998 -0.0003815315
#> [3,] -0.0005905670 -0.0019586248 0.0010958642
#> [4,] -0.0008504963 -0.0002324324 0.0013143496
#>
#>
#> $Sigma_g
#> , , 1
#>
#> [,1] [,2] [,3]
#> [1,] 3.6565958 1.770333 -0.8926708
#> [2,] 1.7703333 9.780122 -1.7661075
#> [3,] -0.8926708 -1.766107 1.5614421
#>
#> , , 2
#>
#> [,1] [,2] [,3]
#> [1,] 5.2522653 -3.0385587 0.4072828
#> [2,] -3.0385587 4.5849846 0.6895483
#> [3,] 0.4072828 0.6895483 3.8742097
#>
#>
#> $V
#> [,1] [,2] [,3] [,4]
#> [1,] 5.062006 -1.643539 -1.419713 3.486022
#> [2,] -1.643539 6.845176 -2.099033 -3.301909
#> [3,] -1.419713 -2.099033 2.660305 1.118797
#> [4,] 3.486022 -3.301909 1.118797 5.234399
#>
#> $nu
#> [1] 4.1
#>
#> $m
#> [1] 0.0003402156
#>
#> $w
#> [1] 0.1868016
#>
#> $s
#> [1] 0.5079061
#>
## ------------------------------------------------
## 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