Title: | Methods and Tools for Bayesian Dynamic Conditional Correlation GARCH(1,1) Model |
---|---|
Description: | Bayesian estimation of dynamic conditional correlation GARCH model for multivariate time series volatility (Fioruci, J.A., Ehlers, R.S. and Andrade-Filho, M.G., (2014). <doi:10.1080/02664763.2013.839635>. |
Authors: | Jose Augusto Fiorucci [aut, cre, cph]
|
Maintainer: | Jose Augusto Fiorucci <[email protected]> |
License: | GPL (>= 2) |
Version: | 3.0.4 |
Built: | 2025-02-05 03:40:08 UTC |
Source: | https://github.com/jafiorucci/bayesdccgarch |
In this package we implemented functions for Bayesian analysis of DCC-GARCH(1,1) Model using the same modelling of Fioruci et al (2014a). Several probabilities distributions are available for the errors which can model both skewness and heavy tails. See Fioruci et al (2014b) for more details about the package.
Package: | bayesDccGarch |
Type: | Package |
Version: | 3.0.4 |
Date: | 2023-04-21 |
License: | GPL (>=2.14) |
bayesDccGarch(mY, n_sim = 10000)
Jose Augusto Fiorucci, Ricardo Sandes Ehlers and Francisco Louzada. Maintainer: Jose Augusto Fiorucci <[email protected]>
Fioruci, J.A., Ehlers, R.S., Andrade Filho, M.G. Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions, Journal of Applied Statistics, 41(2), 320–331, 2014a, <doi:10.1080/02664763.2013.839635>.
Fioruci, J.A., Ehlers, R.S., Louzada, F. BayesDccGarch - An Implementation of Multivariate GARCH DCC Models, ArXiv e-prints, 2014b. https://ui.adsabs.harvard.edu/abs/2014arXiv1412.2967F/abstract
Available functions:
bayesDccGarch
, update
, predict
, plot
, logLikDccGarch
, dssnorm
, dsst
, dssged
, plotVol
data(DaxCacNik) out = bayesDccGarch(DaxCacNik) summary(out) plot(out)
data(DaxCacNik) out = bayesDccGarch(DaxCacNik) summary(out) plot(out)
Performs a Markov Chain for all parameters of the DCC-GARCH(1,1) Model.
bayesDccGarch(mY, nSim = 10000, tail_ini = 8, omega_ini=0.1*diag(var(mY)), alpha_ini=rep(0.05, ncol(mY)), beta_ini=rep(0.85, ncol(mY)), a_ini = 0.04, b_ini = 0.8, gamma_ini = rep(1, ncol(mY)), errorDist = 2, control = list()) increaseSim(x, nSim=10000) ## S3 method for class 'bayesDccGarch' update(object, ..., mY_new) ## S3 method for class 'bayesDccGarch' window(x, start = NULL, end = NULL, thin = NULL, ...)
bayesDccGarch(mY, nSim = 10000, tail_ini = 8, omega_ini=0.1*diag(var(mY)), alpha_ini=rep(0.05, ncol(mY)), beta_ini=rep(0.85, ncol(mY)), a_ini = 0.04, b_ini = 0.8, gamma_ini = rep(1, ncol(mY)), errorDist = 2, control = list()) increaseSim(x, nSim=10000) ## S3 method for class 'bayesDccGarch' update(object, ..., mY_new) ## S3 method for class 'bayesDccGarch' window(x, start = NULL, end = NULL, thin = NULL, ...)
mY |
a matrix of the data ( |
nSim |
length of Markov chain. Default: |
tail_ini |
initial value of |
omega_ini |
a numeric vector ( |
alpha_ini |
a numeric vector ( |
beta_ini |
a numeric vector ( |
a_ini |
a numeric value of the initial values of |
b_ini |
a numeric value of the initial values of |
gamma_ini |
a numeric vector ( |
errorDist |
a probability distribution for errors. Use |
control |
list of control arguments (See *Details*). |
x , object
|
an object of |
mY_new |
a matrix of new data ( |
start |
the first iteration of interest from Markov chain. |
end |
the last iteration of interest from Markov chain. |
thin |
the required interval between successive samples. |
... |
additional arguments for S3 generic |
The bayesDccGarch()
function performs a Markov Chain for all parameters of the model DCC-GARCH(1,1) (or GARCH(1,1) in the univariate case).
There are three options of probability distributions for the error
component. These are the standardized skew versions of normal, t-student and ged distributions. See Fioruci et al (2014a) and Fioruci et al (2014b) for any detail.
The control
argument can be used for define the prior hyper-parameters and the simulation algorithm parameters.
It is a list that can supply any of the following components:
the value of hyper-parameter if
errorDist=2
or the hyper-parameter if
errorDist=3
. Default: 8
a vector with the hyper-parameters . Default:
rep(0,ncol(mY)
a vector with the hyper-parameters . Default:
rep(0,ncol(mY)
a vector with the hyper-parameters . Default:
rep(0,ncol(mY)
a vector with the hyper-parameters . Default:
rep(0,ncol(mY)
the value of the hyper-parameter . Default: 0
the value of the hyper-parameter . Default: 0
the value of hyper-parameter if
errorDist=2
or the hyper-parameter if
errorDist=3
. Default: 10
a vector with the hyper-parameters . Default:
rep(1.25,ncol(mY)
a vector with the hyper-parameters . Default:
rep(10,ncol(mY)
a vector with the hyper-parameters . Default:
rep(10,ncol(mY)
a vector with the hyper-parameters . Default:
rep(10,ncol(mY)
the value of the hyper-parameter . Default: 10
the value of the hyper-parameter . Default: 10
the random walk Metropolis-Hasting algorithm update. Use 1
for update all parameters as one block,
use 2
for update one parameter for each time and use 3
for an automatic choice.
number of simulation for pilot sample if control$simAlg=3
. Default:1000
the cholesky decomposition matrix of the covariance matrix for simulation by one-block Metropolis-Hasting. It must to be passed if control$simAlg=1
.
a vector with the standard deviations for simulation by one-dimensional Metropolis-Hasting. It must to be passed if control$simAlg=2
.
a logical variable for if the function should report the number of interactions in each 100 interactions or not. Default: TRUE
The function increaseSim()
can be used to increase the length of Markov chain simulation.
The function window()
can be used to filter the Markov chain simulation. In this case, all statistics are recomputed.
An object of bayesDccGarch
class, which contains a list with elements:
$control |
a list with the used |
$MC |
an objetic of |
$H |
a matrix with the Bayesian estimates of volatilities and co-volatilities. |
$R |
a matrix with the estimates of the dynamic coditional correlation. |
$H_n1 |
Bayesian prediction of volatilities and co-volatilities for y_n+1. |
$R_n1 |
Bayesian prediction of coditional correlation for y_n+1. |
$IC |
the Bayesian estimate of Akaike Information Criterion, Bayesian Information Criterion and Deviance Information Criterion. |
$elapsedTime |
an object of class |
Jose Augusto Fiorucci, Ricardo Sandes Ehlers and Francisco Louzada
Fioruci, J.A., Ehlers, R.S., Andrade Filho, M.G. Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions, Journal of Applied Statistics, 41(2), 320–331, 2014a. <doi:10.1080/02664763.2013.839635>
Fioruci, J.A., Ehlers, R.S., Louzada, F. BayesDccGarch - An Implementation of Multivariate GARCH DCC Models, ArXiv e-prints, 2014b. https://ui.adsabs.harvard.edu/abs/2014arXiv1412.2967F/abstract.
bayesDccGarch-package
, logLikDccGarch
, plot
, plotVol
data(DaxCacNik) ### Bayes DCC-GARCH(1,1) ### mY = head(DaxCacNik, 1500) out1 = bayesDccGarch(mY) # more 50000 simulations out2 = increaseSim(out1, 50000) # remove first 10000 simulations and take at intervals of 20 out3 = window(out2, start=10000, thin = 20) summary(out3) # Plotting volatilities plot(out3) # Plotting Markov Chain plot(out3$MC) # Forecast volatility H_pred = predict(out3, n_ahead=200)$H plot.ts(rbind(out3$H, H_pred), main="volatility: historical and forecast") # New data out4 = update(out3, mY_new=DaxCacNik[1501:1628,]) plot(out4) ### Bayes univariate GARCH(1,1) ### Dax = DaxCacNik[,1] out = bayesDccGarch(Dax) summary(out) plot(out)
data(DaxCacNik) ### Bayes DCC-GARCH(1,1) ### mY = head(DaxCacNik, 1500) out1 = bayesDccGarch(mY) # more 50000 simulations out2 = increaseSim(out1, 50000) # remove first 10000 simulations and take at intervals of 20 out3 = window(out2, start=10000, thin = 20) summary(out3) # Plotting volatilities plot(out3) # Plotting Markov Chain plot(out3$MC) # Forecast volatility H_pred = predict(out3, n_ahead=200)$H plot.ts(rbind(out3$H, H_pred), main="volatility: historical and forecast") # New data out4 = update(out3, mY_new=DaxCacNik[1501:1628,]) plot(out4) ### Bayes univariate GARCH(1,1) ### Dax = DaxCacNik[,1] out = bayesDccGarch(Dax) summary(out) plot(out)
The matrix DaxCacNik
contains daily observations of the
hundredfold log-returns of daily indices of stock markets in Frankfurt (DAX),
Paris (CAC40) and Tokyo (NIKKEI), from 10 October 1991 until 30 December 1997
(a total of 1627 days). The stock market data is freely available at
https://robjhyndman.com/tsdldata/data/FVD1.dat.
data(DaxCacNik)
data(DaxCacNik)
Jose Augusto Fiorucci, Ricardo Sandes Ehlers and Francisco Louzada
Fioruci, J.A., Ehlers, R.S. Andrade Filho, M.G. Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions, Journal of Applied Statistics, 41(2), 320–331, 2014. <doi:10.1080/02664763.2013.839635>
Compute the density function of Standard Skew Normal distribution (SSNORM) or density function of Standard Skew t-Student distribution (SST) or density function of Standard Skew GED distribution (SSGED)
dssnorm(x, gamma=rep(1,length(x)), log=FALSE) dsst(x, gamma=rep(1,length(x)), nu=10, log=FALSE) dssged(x, gamma=rep(1,length(x)), delta=2, log=FALSE)
dssnorm(x, gamma=rep(1,length(x)), log=FALSE) dsst(x, gamma=rep(1,length(x)), nu=10, log=FALSE) dssged(x, gamma=rep(1,length(x)), delta=2, log=FALSE)
x |
a numeric vector for the point which the density will be computed. |
gamma |
a numeric vector for skew parameters. Must be positive. |
nu |
a numeric value of shape parameter of the multivariate Standard Skew t-Student distribution. Must be greater than 2. |
delta |
a numeric value of shape parameter of GED distribution. Must be positive. |
log |
logical; if TRUE, densities |
Returns the computed value of the density.
Jose Augusto Fiorucci, Ricardo Sandes Ehlers and Francisco Louzada
Fioruci, J.A., Ehlers, R.S. Andrade Filho, M.G. Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions, Journal of Applied Statistics, 41(2), 320–331, 2014. <doi:10.1080/02664763.2013.839635>
### Univariate symmetric standard norm distributions ### dssnorm(x=0) dsst(x=0, nu=100) dssged(x=0, delta=2) ### Univariate standard skew norm distributions ### dssnorm(x=0, gamma=1.5) dsst(x=0, gamma=1.5, nu=100) dssged(x=0, gamma=1.5, delta=2) ### Multivariate standard skew norm distributions ### dssnorm(x=c(0,0), gamma=c(1.5,0.7)) dsst(x=c(0,0), gamma=c(1.5,0.7), nu=100) dssged(x=c(0,0), gamma=c(1.5,0.7), delta=2)
### Univariate symmetric standard norm distributions ### dssnorm(x=0) dsst(x=0, nu=100) dssged(x=0, delta=2) ### Univariate standard skew norm distributions ### dssnorm(x=0, gamma=1.5) dsst(x=0, gamma=1.5, nu=100) dssged(x=0, gamma=1.5, delta=2) ### Multivariate standard skew norm distributions ### dssnorm(x=c(0,0), gamma=c(1.5,0.7)) dsst(x=c(0,0), gamma=c(1.5,0.7), nu=100) dssged(x=c(0,0), gamma=c(1.5,0.7), delta=2)
Compute the logarithm of likelihood function of DCC-GARCH(1,1) Model if mY
is a matrix or the logarithm of likelihood function of GARCH(1,1) Model if mY
is numeric vector.
logLikDccGarch(mY, omega = rep(0.03, ncol(mY)), alpha = rep(0.03, ncol(mY)), beta = rep(0.8, ncol(mY)), a = 0.03, b = 0.8, gamma = rep(1, ncol(mY)), tail = 10, errorDist = 2)
logLikDccGarch(mY, omega = rep(0.03, ncol(mY)), alpha = rep(0.03, ncol(mY)), beta = rep(0.8, ncol(mY)), a = 0.03, b = 0.8, gamma = rep(1, ncol(mY)), tail = 10, errorDist = 2)
mY |
a matrix of the data ( |
omega |
a numeric vector ( |
alpha |
a numeric vector ( |
beta |
a numeric vector ( |
a |
a numeric value of the |
b |
a numeric value of the |
gamma |
a numeric vector ( |
tail |
a numeric value of |
errorDist |
a probability distribution for errors. Use |
The log-likelihood of the model GARCH(1,1) is computed if mY
has just one column. The arguments a
and b
are not consider in this case.
Return a list with the elements:
$H |
a matrix where the lines are the |
$value |
the value of the logarithm of likelihood function. |
Jose Augusto Fiorucci, Ricardo Sandes Ehlers and Francisco Louzada
Fioruci, J.A., Ehlers, R.S., Andrade Filho, M.G. Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions, Journal of Applied Statistics, 41(2), 320–331, 2014a. <doi:10.1080/02664763.2013.839635>
Fioruci, J.A., Ehlers, R.S., Louzada, F. BayesDccGarch - An Implementation of Multivariate GARCH DCC Models, ArXiv e-prints, 2014b. https://ui.adsabs.harvard.edu/abs/2014arXiv1412.2967F/abstract.
bayesDccGarch-package
, bayesDccGarch
data(DaxCacNik) Dax = DaxCacNik[,1] ###### log-likelihood function of GARCH(1,1) model with SST innovations #### logLikDccGarch(Dax, omega=0.03, alpha=0.03, beta=0.8, gamma=0.7)$value ###### log-likelihood function of DCC-GARCH(1,1) model with SST innovations #### logLikDccGarch(DaxCacNik, beta=c(0.82,0.91,0.85), gamma=c(0.7, 1.3, 1.7), tail=10)$value
data(DaxCacNik) Dax = DaxCacNik[,1] ###### log-likelihood function of GARCH(1,1) model with SST innovations #### logLikDccGarch(Dax, omega=0.03, alpha=0.03, beta=0.8, gamma=0.7)$value ###### log-likelihood function of DCC-GARCH(1,1) model with SST innovations #### logLikDccGarch(DaxCacNik, beta=c(0.82,0.91,0.85), gamma=c(0.7, 1.3, 1.7), tail=10)$value
Produces a plot of time series and the volatilities. This is a particular case of plotVol
function.
## S3 method for class 'bayesDccGarch' plot(x, ts.names=NULL, colors = c("grey","red"), ...)
## S3 method for class 'bayesDccGarch' plot(x, ts.names=NULL, colors = c("grey","red"), ...)
x |
Object of class “bayesDccGarch”. |
ts.names |
a vector of length |
colors |
a vector with the colors for plotting the returns and volatilities. |
... |
additional arguments for |
No return value
Ricardo Sandes Ehlers, Jose Augusto Fiorucci and Francisco Louzada
Fioruci, J.A., Ehlers, R.S., Andrade Filho, M.G. Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions, Journal of Applied Statistics, 41(2), 320–331, 2014a. <doi:10.1080/02664763.2013.839635>
Fioruci, J.A., Ehlers, R.S., Louzada, F. BayesDccGarch - An Implementation of Multivariate GARCH DCC Models, ArXiv e-prints, 2014b. https://ui.adsabs.harvard.edu/abs/2014arXiv1412.2967F/abstract.
bayesDccGarch-package
, bayesDccGarch
, plotVol
data(DaxCacNik) mY = DaxCacNik out = bayesDccGarch(mY, nSim=1000) plot(out)
data(DaxCacNik) mY = DaxCacNik out = bayesDccGarch(mY, nSim=1000) plot(out)
Plotting method for volatilities of time series.
plotVol(mY, vol, ts.names=paste("TS_", 1:ncol(mY), sep=""), colors = c("grey","red"), ...)
plotVol(mY, vol, ts.names=paste("TS_", 1:ncol(mY), sep=""), colors = c("grey","red"), ...)
mY |
a matrix of the data ( |
vol |
a matrix ( |
ts.names |
a vector of length |
colors |
a vector with name of the colors for plotting the returns and volatilities. |
... |
additional arguments for |
No return value
Ricardo Sandes Ehlers, Jose Augusto Fiorucci and Francisco Louzada
Fioruci, J.A., Ehlers, R.S., Andrade Filho, M.G. Bayesian multivariate GARCH models with dynamic correlations and asymmetric error distributions, Journal of Applied Statistics, 41(2), 320–331, 2014a. <doi:10.1080/02664763.2013.839635>
Fioruci, J.A., Ehlers, R.S., Louzada, F. BayesDccGarch - An Implementation of Multivariate GARCH DCC Models, ArXiv e-prints, 2014b. https://ui.adsabs.harvard.edu/abs/2014arXiv1412.2967F/abstract.
bayesDccGarch-package
, bayesDccGarch
, plot.bayesDccGarch
data(DaxCacNik) mY = DaxCacNik out = bayesDccGarch(mY) ## The code plotVol(mY, out$H[,c("H_1,1","H_2,2","H_3,3")], c("DAX","CAC40","NIKKEI")) ## gives the result of ## plot(out)
data(DaxCacNik) mY = DaxCacNik out = bayesDccGarch(mY) ## The code plotVol(mY, out$H[,c("H_1,1","H_2,2","H_3,3")], c("DAX","CAC40","NIKKEI")) ## gives the result of ## plot(out)
Bayesian forecast for volatilities and coditional correlations
## S3 method for class 'bayesDccGarch' predict(object, ..., n_ahead = 5, bayes = T)
## S3 method for class 'bayesDccGarch' predict(object, ..., n_ahead = 5, bayes = T)
object |
a bayesDccGarch object |
... |
default argument of predict function, not used |
n_ahead |
number of steps ahead forecast |
bayes |
a boolean. If True, then the forecast is calculated as being the average of the forecasts across all states in the Markov chain (much slower). If False then predictions are calculated using estimation parameters (much faster). |
A list with elements H
and R
Engle, R.F. and Sheppard, K. Theoretical and empirical properties of dynamic conditional correlation multivariate GARCH, 2001, NBER Working Paper.
out = bayesDccGarch(DaxCacNik) predict.bayesDccGarch(out, n_ahead=5)
out = bayesDccGarch(DaxCacNik) predict.bayesDccGarch(out, n_ahead=5)