Fitting Bayesian VAR(p) of Minnesota Prior
Source:R/bvar-minnesota.R
, R/print-bvarmn.R
, R/criteria.R
, and 1 more
bvar_minnesota.Rd
This function fits BVAR(p) with Minnesota prior.
Usage
bvar_minnesota(
y,
p = 1,
num_chains = 1,
num_iter = 1000,
num_burn = floor(num_iter/2),
thinning = 1,
bayes_spec = set_bvar(),
scale_variance = 0.05,
include_mean = TRUE,
parallel = list(),
verbose = FALSE,
num_thread = 1
)
# S3 method for class 'bvarmn'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
# S3 method for class 'bvarhm'
print(x, digits = max(3L, getOption("digits") - 3L), ...)
# S3 method for class 'bvarmn'
logLik(object, ...)
# S3 method for class 'bvarmn'
AIC(object, ...)
# S3 method for class 'bvarmn'
BIC(object, ...)
is.bvarmn(x)
# S3 method for class 'bvarmn'
knit_print(x, ...)
# S3 method for class 'bvarhm'
knit_print(x, ...)
Arguments
- y
Time series data of which columns indicate the variables
- p
VAR lag (Default: 1)
- num_chains
Number of MCMC chains
- num_iter
MCMC iteration number
- num_burn
Number of burn-in (warm-up). Half of the iteration is the default choice.
- thinning
Thinning every thinning-th iteration
- bayes_spec
A BVAR model specification by
set_bvar()
.- scale_variance
Proposal distribution scaling constant to adjust an acceptance rate
- include_mean
Add constant term (Default:
TRUE
) or not (FALSE
)- parallel
List the same argument of
optimParallel::optimParallel()
. By default, this is empty, and the function does not execute parallel computation.- verbose
Print the progress bar in the console. By default,
FALSE
.- num_thread
Number of threads
- x
bvarhm
object- digits
digit option to print
- ...
not used
- object
A
bvarmn
object
Value
bvar_minnesota()
returns an object bvarmn
class.
It is a list with the following components:
- coefficients
Posterior Mean
- fitted.values
Fitted values
- residuals
Residuals
- mn_mean
Posterior mean matrix of Matrix Normal distribution
- 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 (\(alpha_0\) - obs + 2). \(\alpha_0\): nrow(Dummy observation) - k
- df
Numer of Coefficients: mp + 1 or mp
- m
Dimension of the time series
- obs
Sample size used when training =
totobs
-p
- prior_mean
Prior mean matrix of Matrix Normal distribution: \(A_0\)
- prior_precision
Prior precision matrix of Matrix Normal distribution: \(\Omega_0^{-1}\)
- prior_scale
Prior scale matrix of inverse-Wishart distribution: \(S_0\)
- prior_shape
Prior shape of inverse-Wishart distribution: \(\alpha_0\)
- y0
\(Y_0\)
- design
\(X_0\)
- p
Lag of VAR
- totobs
Total number of the observation
- type
include constant term (
const
) or not (none
)- y
Raw input (
matrix
)- call
Matched call
- process
Process string in the
bayes_spec
:BVAR_Minnesota
- spec
Model specification (
bvharspec
)
It is also normaliw
and bvharmod
class.
Details
Minnesota prior gives prior to parameters \(A\) (VAR matrices) and \(\Sigma_e\) (residual covariance).
$$A \mid \Sigma_e \sim MN(A_0, \Omega_0, \Sigma_e)$$ $$\Sigma_e \sim IW(S_0, \alpha_0)$$ (MN: matrix normal, IW: inverse-wishart)
References
Bańbura, M., Giannone, D., & Reichlin, L. (2010). Large Bayesian vector auto regressions. Journal of Applied Econometrics, 25(1).
Giannone, D., Lenza, M., & Primiceri, G. E. (2015). Prior Selection for Vector Autoregressions. Review of Economics and Statistics, 97(2).
Litterman, R. B. (1986). Forecasting with Bayesian Vector Autoregressions: Five Years of Experience. Journal of Business & Economic Statistics, 4(1), 25.
KADIYALA, K.R. and KARLSSON, S. (1997), NUMERICAL METHODS FOR ESTIMATION AND INFERENCE IN BAYESIAN VAR-MODELS. J. Appl. Econ., 12: 99-132.
Karlsson, S. (2013). Chapter 15 Forecasting with Bayesian Vector Autoregression. Handbook of Economic Forecasting, 2, 791-897.
Sims, C. A., & Zha, T. (1998). Bayesian Methods for Dynamic Multivariate Models. International Economic Review, 39(4), 949-968.
See also
set_bvar()
to specify the hyperparameters of Minnesota prior.summary.normaliw()
to summarize BVAR model
Examples
# Perform the function using etf_vix dataset
fit <- bvar_minnesota(y = etf_vix[,1:3], p = 2)
class(fit)
#> [1] "bvarmn" "bvharmod" "normaliw"
# Extract coef, fitted values, and residuals
coef(fit)
#> GVZCLS OVXCLS VXFXICLS
#> GVZCLS_1 0.9687374922 0.003277859 -2.127158e-03
#> OVXCLS_1 -0.0006560685 0.995091728 1.835137e-03
#> VXFXICLS_1 0.0005525222 -0.010547068 9.692097e-01
#> GVZCLS_2 -0.0063751732 0.005301266 5.301308e-03
#> OVXCLS_2 -0.0015610550 -0.001598387 1.827248e-05
#> VXFXICLS_2 0.0035974867 -0.002866207 -4.303821e-03
#> const 0.6384546093 0.355905198 7.620063e-01
head(residuals(fit))
#> [,1] [,2] [,3]
#> [1,] 0.9565672 0.1633277 0.2936904
#> [2,] -0.5842806 1.1471284 -0.4752438
#> [3,] -0.2615766 -0.8953073 1.1790744
#> [4,] 0.3237965 -0.7384529 -0.3004217
#> [5,] 0.3217985 -0.7440802 -0.3050897
#> [6,] -0.3306978 -1.3119988 -0.5944614
head(fitted(fit))
#> GVZCLS OVXCLS VXFXICLS
#> [1,] 21.38343 35.35667 28.76631
#> [2,] 22.18428 35.44287 28.93524
#> [3,] 21.46158 36.51531 28.36093
#> [4,] 21.07620 35.53345 29.40542
#> [5,] 21.27820 34.71408 28.97509
#> [6,] 21.47070 33.90200 28.55446