Title: | Robust Bootstrap Forecast Densities for GARCH Models |
---|---|
Description: | Bootstrap forecast densities for GARCH (Generalized Autoregressive Conditional Heteroskedastic) returns and volatilities using the robust residual-based bootstrap procedure of Trucios, Hotta and Ruiz (2017) <DOI:10.1080/00949655.2017.1359601>. |
Authors: | Carlos Trucios |
Maintainer: | Carlos Trucios <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.2.0 |
Built: | 2024-11-03 06:06:47 UTC |
Source: | https://github.com/ctruciosm/robgarchboot |
Bootstrap forecast densities for returns and volatilities using the robust residual-based bootstrap procedure of Trucíos et at. (2017). The package also includes the robust GARCH (Generalized Autoregressive Conditional Heteroskedastic) estimator of Boudt et al. (2013) with the modification introduced by Trucíos et at. (2017). The robust cDCC estimator used in Trucíos et al. (2018) is also implemented.
This package provides a robust bootstrap procedure to obtain forecast densities for both return and volatilities in a GARCH context. The forecast densities are useful to obtain forecast intervals as well as to estimate risk measures such as Value-at-Risk (VaR) and Expected Shortfall (ES). We also provide the robust GARCH estimator of Boudt et al. (2013) with the modification introduced by Trucíos et at. (2017). This procedure has shown good finite sample properties in both Monte Carlo experiments and empirical data. See; Trucíos et al. (2017), Trucíos (2019) and Trucíos et al. (2020) for recent implementations.
Carlos Trucíos <[email protected]>
Boudt, Kris, Jon Danielsson, and Sébastien Laurent. Robust forecasting of dynamic conditional correlation GARCH models. International Journal of Forecasting 29.2 (2013): 244-257.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap forecast densities for GARCH returns and volatilities. Journal of Statistical Computation and Simulation 87.16 (2017): 3152-3174.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap densities for dynamic conditional correlations: implications for portfolio selection and value-at-risk. Journal of Statistical Computation and Simulation 88.10 (2018): 1976-2000.
Trucíos, Carlos. Forecasting Bitcoin risk measures: A robust approach. International Journal of Forecasting 35.3 (2019): 836-847.
Trucíos, Carlos, Aviral K. Tiwari, and Faisal Alqahtani. Value-at-risk and expected shortfall in cryptocurrencies' portfolio: a vine copula–based approach. Applied Economics 52.24 (2020): 2580-2593.
Using the robust estimated parameters of Boudt et al. (2013) with the modification introduced by Trucíos et at. (2017), we obtain the estimated volatility.
fitted_Vol(theta,r)
fitted_Vol(theta,r)
theta |
Vector of robust estimated parameters obtained from ROBUSTGARCH function. |
r |
Vector of time series returns. |
More details can be found in Boudt et al. (2013) and Trucíos et at. (2017).
The function returns the estimated volatility from 1 to T+1.
Carlos Trucíos
Boudt, Kris, Jon Danielsson, and Sébastien Laurent. Robust forecasting of dynamic conditional correlation GARCH models. International Journal of Forecasting 29.2 (2013): 244-257.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap forecast densities for GARCH returns and volatilities. Journal of Statistical Computation and Simulation 87.16 (2017): 3152-3174.
# Using the Bitcoin daily returns, we estimate the parameter of the GARCH model in a robust way param = ROBUSTGARCH(returnsexample) # With the estimated parameters, we estimate the volatiltiy in a robust way vol = fitted_Vol(param, returnsexample)
# Using the Bitcoin daily returns, we estimate the parameter of the GARCH model in a robust way param = ROBUSTGARCH(returnsexample) # With the estimated parameters, we estimate the volatiltiy in a robust way vol = fitted_Vol(param, returnsexample)
Loss function used in cDCC robust estimation.
loglik_cDCC(par, Qb, s, sigma)
loglik_cDCC(par, Qb, s, sigma)
par |
teste |
Qb |
teste |
s |
teste |
sigma |
teste |
This function is used in the robust estimation. We can use it to evaluate the value of the robust cDCC loss function using several values of the vector parameters.
Returns the value of the loss function.
Carlos Trucíos
Boudt, Kris, Jon Danielsson, and Sébastien Laurent. Robust forecasting of dynamic conditional correlation GARCH models. International Journal of Forecasting 29.2 (2013): 244-257.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap densities for dynamic conditional correlations: implications for portfolio selection and value-at-risk. Journal of Statistical Computation and Simulation 88.10 (2018): 1976-2000.
# Estimating the parameters of the cDCC model in a robust way. cDCC = Robust_cDCC(returns3) param = cDCC[[1]] Qbar = cDCC[[2]] vol1 = fitted_Vol(param[1:3],returns3[,1]) vol2 = fitted_Vol(param[4:6],returns3[,2]) vol3 = fitted_Vol(param[7:9],returns3[,3]) e = matrix(c(returns3[,1]/vol1[1:nrow(returns3)], returns3[,2]/vol2[1:nrow(returns3)], returns3[,3]/vol3[1:nrow(returns3)]), ncol=3) loglik_cDCC(param[10:11],Qbar,e, 0.8309765)
# Estimating the parameters of the cDCC model in a robust way. cDCC = Robust_cDCC(returns3) param = cDCC[[1]] Qbar = cDCC[[2]] vol1 = fitted_Vol(param[1:3],returns3[,1]) vol2 = fitted_Vol(param[4:6],returns3[,2]) vol3 = fitted_Vol(param[7:9],returns3[,3]) e = matrix(c(returns3[,1]/vol1[1:nrow(returns3)], returns3[,2]/vol2[1:nrow(returns3)], returns3[,3]/vol3[1:nrow(returns3)]), ncol=3) loglik_cDCC(param[10:11],Qbar,e, 0.8309765)
Three-variate time series returns for illustrative purposes
Cryptocurrencies report large returns over time. In this sense and with illustrative purposes, we use Bitcoin daily returns from July 2014 to February 2017.
Robust GARCH (Generalized Autoregressive Conditional Heteroskedastic) Bootstrap procedure of Trucíos et al. (2017)
RobGARCHBoot(data, n.boot = 1000, n.ahead = 1, ins = FALSE)
RobGARCHBoot(data, n.boot = 1000, n.ahead = 1, ins = FALSE)
data |
Vector of time series returns. |
n.boot |
Number of bootsrap replications. By default n.boot = 1000 |
n.ahead |
Numbers of steps-ahead. By default n.ahead = 1 |
ins |
If TRUE in-sample bootstrap returns are calculated. By default ins = FALSE |
More details can be found in Trucíos et at. (2017), Hotta and Trucíos (2018), and Trucíos (2019).
The function returns two lists with the empirical H-steps-ahead bootstrap densities for returns and squared volatilities. If ins = TRUE, a third list with in-sample bootstrap returns is also provided.
Carlos Trucíos
Hotta, Luiz Koodi, and Carlos Trucíos. Inference in (M)GARCH models in the presence of additive outliers: Specification, estimation, and prediction. Advances in Mathematics and Applications. Springer, Cham, 2018. 179-202.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap forecast densities for GARCH returns and volatilities. Journal of Statistical Computation and Simulation 87.16 (2017): 3152-3174.
Trucíos, Carlos. Forecasting Bitcoin risk measures: A robust approach. International Journal of Forecasting 35.3 (2019): 836-847.
# Robust bootstrap forecast densities for returns and volatilities boot = RobGARCHBoot(returnsexample, n.boot = 1000, n.ahead = 1) # Obtaining the forecast intervals for returns (95%) quantile(boot[[1]], prob = c(0.025, 0.975)) # Obtaining the forecast intervals for volatilities (95%) quantile(boot[[2]], prob = c(0.025, 0.975)) # Risk measures can also be obtained VaR1 = quantile(boot[[1]], prob = 0.01)
# Robust bootstrap forecast densities for returns and volatilities boot = RobGARCHBoot(returnsexample, n.boot = 1000, n.ahead = 1) # Obtaining the forecast intervals for returns (95%) quantile(boot[[1]], prob = c(0.025, 0.975)) # Obtaining the forecast intervals for volatilities (95%) quantile(boot[[2]], prob = c(0.025, 0.975)) # Risk measures can also be obtained VaR1 = quantile(boot[[1]], prob = 0.01)
Robust GARCH (Generalized Autoregressive Conditional Heteroskedastic) Bootstrap procedure of Trucíos et al. (2017)
RobGARCHBootParallel(data, n.boot = 1000, n.ahead = 1, ncl = 2)
RobGARCHBootParallel(data, n.boot = 1000, n.ahead = 1, ncl = 2)
data |
Vector of time series returns. |
n.boot |
Number of bootsrap replications. By default n.boot = 1000 |
n.ahead |
Numbers of steps-ahead. By default n.ahead = 1 |
ncl |
Numbers of parallel processes. By default ncl = 2 |
More details can be found in Trucíos et at. (2017), Hotta and Trucíos (2018), and Trucíos (2019).
The function returns two lists with the empirical H-steps-ahead bootstrap densities for returns and squared volatilities.
Carlos Trucíos
Hotta, Luiz Koodi, and Carlos Trucíos. Inference in (M)GARCH models in the presence of additive outliers: Specification, estimation, and prediction. Advances in Mathematics and Applications. Springer, Cham, 2018. 179-202.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap forecast densities for GARCH returns and volatilities. Journal of Statistical Computation and Simulation 87.16 (2017): 3152-3174.
Trucíos, Carlos. Forecasting Bitcoin risk measures: A robust approach. International Journal of Forecasting 35.3 (2019): 836-847.
# Robust bootstrap forecast densities for returns and volatilities boot = RobGARCHBootParallel(returnsexample, n.boot = 1000, n.ahead = 1) # Obtaining the forecast intervals for returns (95%) quantile(boot[[1]], prob = c(0.025, 0.975)) # Obtaining the forecast intervals for volatilities (95%) quantile(boot[[2]], prob = c(0.025, 0.975)) # Risk measures can also be obtained VaR1 = quantile(boot[[1]], prob = 0.01)
# Robust bootstrap forecast densities for returns and volatilities boot = RobGARCHBootParallel(returnsexample, n.boot = 1000, n.ahead = 1) # Obtaining the forecast intervals for returns (95%) quantile(boot[[1]], prob = c(0.025, 0.975)) # Obtaining the forecast intervals for volatilities (95%) quantile(boot[[2]], prob = c(0.025, 0.975)) # Risk measures can also be obtained VaR1 = quantile(boot[[1]], prob = 0.01)
Robust cDCC estimator as in Trucíos et at. (2018), which is a slight modification of the procedure of Boud et al. (2013).
Robust_cDCC(r)
Robust_cDCC(r)
r |
Matrix of time series returns. |
More details can be found in Boudt et al. (2013) and Trucíos et at. (2018).
The function returns the estimated parameters and the Qbar matrix.
Carlos Trucíos
Boudt, Kris, Jon Danielsson, and Sébastien Laurent. Robust forecasting of dynamic conditional correlation GARCH models. International Journal of Forecasting 29.2 (2013): 244-257.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap densities for dynamic conditional correlations: implications for portfolio selection and Value-at-Risk. Journal of Statistical Computation and Simulation 88.10 (2018): 1976-2000.
# Estimating the parameters of the cDCC model in a robust way. cDCC = Robust_cDCC(returns3) #parameters cDCC[[1]] #Qbar cDCC[[2]]
# Estimating the parameters of the cDCC model in a robust way. cDCC = Robust_cDCC(returns3) #parameters cDCC[[1]] #Qbar cDCC[[2]]
Robust GARCH (Generalized Autoregressive Conditional Heteroskedastic) estimator of Boudt et al. (2013) with the modification introduced by Trucíos et at. (2017).
ROBUSTGARCH(y)
ROBUSTGARCH(y)
y |
Vector of time series returns. |
More details can be found in Boudt et al. (2013) and Trucíos et at. (2017).
The function returns the estimated parameters.
Carlos Trucíos
Boudt, Kris, Jon Danielsson, and Sébastien Laurent. Robust forecasting of dynamic conditional correlation GARCH models. International Journal of Forecasting 29.2 (2013): 244-257.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap forecast densities for GARCH returns and volatilities. Journal of Statistical Computation and Simulation 87.16 (2017): 3152-3174.
# Estimating the parameters of the GARCH model in a robust way. ROBUSTGARCH(returnsexample*100)
# Estimating the parameters of the GARCH model in a robust way. ROBUSTGARCH(returnsexample*100)
Loss function used in GARCH (Generalized Autoregressive Conditional Heteroskedastic) robust estimation.
ROBUSTGARCHloss_RCPP(theta, r, sigma2)
ROBUSTGARCHloss_RCPP(theta, r, sigma2)
theta |
Vector of robust estimated (or initial values) parameters obtained from ROBUSTGARCH function. |
r |
Vector of time series returns. |
sigma2 |
robust squared volatility estimation (or initial value of squared volatility) |
This function is used in the robust estimation. We can use it to evaluate the value of the loss function using several values of the vector parameters (theta)
Returns the value of the loss function
Carlos Trucíos
Boudt, Kris, Jon Danielsson, and Sébastien Laurent. Robust forecasting of dynamic conditional correlation GARCH models. International Journal of Forecasting 29.2 (2013): 244-257.
Trucíos, Carlos, Luiz K. Hotta, and Esther Ruiz. Robust bootstrap forecast densities for GARCH returns and volatilities. Journal of Statistical Computation and Simulation 87.16 (2017): 3152-3174.
# Using the Bitcoin daily returns, we estimate the parameter of the GARCH model in a robust way param = ROBUSTGARCH(returnsexample) # We can evaluate the loss function using the estimated parameters ROBUSTGARCHloss_RCPP(param[2:3], returnsexample, param[1]/(1-param[2]-param[3]))
# Using the Bitcoin daily returns, we estimate the parameter of the GARCH model in a robust way param = ROBUSTGARCH(returnsexample) # We can evaluate the loss function using the estimated parameters ROBUSTGARCHloss_RCPP(param[2:3], returnsexample, param[1]/(1-param[2]-param[3]))