GHAR.1step.rolling.VaR.forecast: Compute the GHAR model with a rolling window and compute the...

View source: R/GHAR_1step_rolling.R

GHAR.1step.rolling.VaR.forecastR Documentation

Compute the GHAR model with a rolling window and compute the 1-step-ahead VaR forecasts

Description

This function computes the GHAR model with a rolling window and compute the 1-step-ahead VaR forecasts

Usage

GHAR.1step.rolling.VaR.forecast(
  cleaned.rc,
  daily_ret,
  weights,
  quantiles = c(0.05, 0.1),
  es.alpha = 0.025,
  roll.window = 250
)

Arguments

cleaned.rc

is a list containing the realized covariances

daily_ret

is an xts object containing the cryptocurrency daily returns. It should be compatible with the list containing the realized covariances

weights

is a vector of weights for the rolling porfolio VaR forecasts

quantiles

are the desidered probability levels for the 1-step-ahead VaR estimates

es.alpha

is the desidered probability level for the 1-step-ahead ES estimate

roll.window

a numerical scalar specifying the dimension of the rolling estimation window

Details

This function computes the GHAR model by Cech and BarunĂ­k (2017) with a rolling window and compute the 1-step VaR forecasts

Value

data_to_plot a (zoo object) matrix containing the realized portfolio returns, and the relative 1-day-ahead VaR forecasts

References

Cech, Frantisek, and Jozef BarunĂ­k (2017). On the Modelling and Forecasting of Multivariate Realized Volatility: Generalized Heterogeneous Autoregressive (GHAR) Model. Journal of Forecasting 36(2), 181-206.

Examples

## Not run: 
library(highfrequency)
localbtcMXN <-bitcoincharts_single_download(name = "localbtcMXN.csv.gz")
btcdeEUR <-bitcoincharts_single_download(name = "btcdeEUR.csv.gz")
krakenEUR <-bitcoincharts_single_download(name = "krakenEUR.csv.gz")
localbtcINR <-bitcoincharts_single_download(name = "localbtcINR.csv.gz")
coinbaseUSD <-bitcoincharts_single_download(name = "coinbaseUSD.csv.gz")
data5<-list(localbtcMXN =localbtcMXN, btcdeEUR=btcdeEUR, krakenEUR=krakenEUR,
             localbtcINR=localbtcINR, coinbaseUSD=coinbaseUSD)
data_clean<-aggregate_merge_bictoincharts_data(data_list=data5)
cleaned.rc <- rc_pd(data_clean$price_ts)
GHAR_roll <- GHAR.1step.rolling.VaR.forecast(cleaned.rc, data_clean$daily_returns,
         weights =rep(0.2,5), quantiles = c(0.05, 0.1), roll.window = 250, es.alpha=0.025)
library(xts)
ggplot2::autoplot(as.xts(GHAR_roll), facet = NULL)

## End(Not run)


deanfantazzini/bitcoinFinance documentation built on June 12, 2024, 4:10 p.m.