Fitting Bayesian VHAR of Minnesota Prior
Source:R/bvhar-minnesota.R
, R/print-bvharmn.R
bvhar_minnesota.Rd
This function fits BVHAR with Minnesota prior.
Arguments
- y
Time series data of which columns indicate the variables
- har
Numeric vector for weekly and monthly order. By default,
c(5, 22)
.- bayes_spec
A BVHAR model specification by
set_bvhar()
(default) orset_weight_bvhar()
.- include_mean
Add constant term (Default:
TRUE
) or not (FALSE
)- x
bvarmn
object- digits
digit option to print
- ...
not used
Value
bvhar_minnesota()
returns an object bvharmn
class. It is a list with the following components:
- coefficients
Posterior Mean matrix of Matrix Normal distribution
- fitted.values
Fitted values
- residuals
Residuals
- mn_prec
Posterior precision matrix of Matrix Normal distribution
- iw_scale
Posterior scale matrix of posterior inverse-wishart distribution
- iw_shape
Posterior shape of inverse-Wishart distribution (\(\nu_0\) - obs + 2). \(\nu_0\): nrow(Dummy observation) - k
- df
Numer of Coefficients: 3m + 1 or 3m
- p
3, this element exists to run the other functions
- week
Order for weekly term
- month
Order for monthly term
- m
Dimension of the time series
- obs
Sample size used when training =
totobs
- 22- totobs
Total number of the observation
- call
Matched call
- process
Process string in the
bayes_spec
:"BVHAR_MN_VAR"
(BVHAR-S) or"BVHAR_MN_VHAR"
(BVHAR-L)- spec
Model specification (
bvharspec
)- type
include constant term (
"const"
) or not ("none"
)- prior_mean
Prior mean matrix of Matrix Normal distribution: \(M_0\)
- prior_precision
Prior precision matrix of Matrix Normal distribution: \(\Omega_0^{-1}\)
- prior_scale
Prior scale matrix of inverse-Wishart distribution: \(\Psi_0\)
- prior_shape
Prior shape of inverse-Wishart distribution: \(\nu_0\)
- HARtrans
VHAR linear transformation matrix: \(C_{HAR}\)
- y0
\(Y_0\)
- design
\(X_0\)
- y
Raw input (
matrix
)
It is also normaliw
and bvharmod
class.
Details
Apply Minnesota prior to Vector HAR: \(\Phi\) (VHAR matrices) and \(\Sigma_e\) (residual covariance).
$$\Phi \mid \Sigma_e \sim MN(M_0, \Omega_0, \Sigma_e)$$ $$\Sigma_e \sim IW(\Psi_0, \nu_0)$$ (MN: matrix normal, IW: inverse-wishart)
There are two types of Minnesota priors for BVHAR:
VAR-type Minnesota prior specified by
set_bvhar()
, so-called BVHAR-S model.VHAR-type Minnesota prior specified by
set_weight_bvhar()
, so-called BVHAR-L model.
Two types of Minnesota priors builds different dummy variables for Y0. See var_design_formulation.
References
Kim, Y. G., and Baek, C. (2023). Bayesian vector heterogeneous autoregressive modeling. Journal of Statistical Computation and Simulation.
See also
set_bvhar()
to specify the hyperparameters of BVHAR-Sset_weight_bvhar()
to specify the hyperparameters of BVHAR-Lsummary.normaliw()
to summarize BVHAR modelpredict.bvharmn()
to forecast the BVHAR process
Examples
# Perform the function using etf_vix dataset
fit <- bvhar_minnesota(y = etf_vix[,1:3])
class(fit)
#> [1] "bvharmn" "normaliw" "bvharmod"
# Extract coef, fitted values, and residuals
coef(fit)
#> GVZCLS OVXCLS VXFXICLS
#> GVZCLS_day 0.7239591235 0.030141906 0.0334224930
#> OVXCLS_day 0.0021163564 0.718324835 0.0094789827
#> VXFXICLS_day 0.0294772930 0.035320583 0.7377164885
#> GVZCLS_week 0.1251766305 -0.002704810 -0.0024006869
#> OVXCLS_week -0.0030211395 0.144436818 -0.0010429118
#> VXFXICLS_week 0.0028666589 0.009321449 0.1206325735
#> GVZCLS_month 0.0482747164 0.005220543 0.0008392191
#> OVXCLS_month -0.0022599110 0.058987040 0.0007463012
#> VXFXICLS_month 0.0007727524 0.005768089 0.0298913283
#> const 1.1216988711 0.382866382 1.9279431742
head(residuals(fit))
#> [,1] [,2] [,3]
#> [1,] 0.2011463 -0.03569196 0.2373614
#> [2,] -0.5979335 0.15122959 -0.2782346
#> [3,] -0.3466428 0.50804209 3.3657096
#> [4,] -0.8431968 0.52911348 -0.2492212
#> [5,] -0.1001249 0.54094522 0.3884998
#> [6,] -0.1407253 1.48033862 0.8978522
head(fitted(fit))
#> GVZCLS OVXCLS VXFXICLS
#> [1,] 20.48885 32.35569 29.22264
#> [2,] 20.62793 32.27877 28.94823
#> [3,] 20.07664 32.32196 28.36429
#> [4,] 19.91320 32.77089 30.71922
#> [5,] 19.34012 33.09905 29.80150
#> [6,] 19.42073 33.36966 29.61215