lassovar.RC.1step.rolling.VaR.forecast: Compute a Lasso-VAR model for realized covariance matrices...

View source: R/lassovar_1step_rolling.R

lassovar.RC.1step.rolling.VaR.forecastR Documentation

Compute a Lasso-VAR model for realized covariance matrices with a rolling window and compute 1-step-ahead VaR forecasts

Description

This function computes a Lasso-VAR model for realized covariance matrices with a rolling window and computes 1-step-ahead VaR forecasts

Usage

lassovar.RC.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

the desidered quantiles 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 Lasso-VAR model for realized covariance matrices by Callot et al. (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

Callot, Laurent AF, Anders B. Kock, and Marcelo C. Medeiros. "Modeling and Forecasting Large Realized Covariance Matrices and Portfolio Choice." Journal of Applied Econometrics 32.1 (2017): 140-158.

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)
lassovar_roll <- lassovar.RC.1step.rolling.VaR.forecast(cleaned.rc, data_clean$daily_returns,
             weights =rep(0.2,5), quantiles = c(0.05, 0.1), roll.window = 662, es.alpha=0.025)
library(xts)
ggplot2::autoplot(as.xts(lassovar_roll), facet = NULL)

## End(Not run)


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