View source: R/HARRV_recursive_forecast.R
HARRV.recursive.forecast | R Documentation |
This function computes the recursive forecasts for the HAR-RV model
HARRV.recursive.forecast(
dat,
periods = c(1, 5, 22),
type = "HAR",
transform = NULL,
roll.window = 1621,
h = 1
)
dat |
is a xts object containing intraday 5-minute regularly spaces prices (see example below) |
periods |
is a vector of integers indicating over how days the realized measures in the model should be aggregated.
By default periods = c(1,5,22). It is needed for the computation of the HARmodel of the |
type |
is a string referring to the type of HAR model you would like to estimate using HARmodel. By default type = "HAR". |
transform |
optionally a string referring to a function that transforms both the dependent and explanatory variables in the HARmodel. By default transform=NULL, so no transformation is done. Typical other choices in this context would be "log" or "sqrt". |
roll.window |
is the rolling window size used for estimating the HAR-RV model |
h |
is the desired forecasting horizon. Default is 1 (that is, 1-step-ahead recursive forecasts) |
This function computes the recursive forecasts for the HAR-RV model. See Chevillon (2007, 2016) for a discussion about direct and recursive forecasts.
roll.fore a xts object containing the h-day-ahead RV forecasts and the realized RV forecasts.
Chevillon, G. (2007). Direct multi-step estimation and forecasting. Journal of Economic Surveys,21(4),746-785.
Chevillon, G. (2016). Multistep forecasting in the presence of location shifts. International Journal of Forecasting, 32(1), 121-137.
## Not run:
library(highfrequency)
aa <-bitcoincharts_single_download(name = "bitstampUSD.csv.gz", save_data=TRUE)
data_clean<-aggregate_merge_bictoincharts_data(data_list=list(aa=aa), aggregate_every = 5)
dat<-data_clean$price_ts
dat<- dat["2013-01-02/2017-07-12"]
bb<-HARRV.recursive.forecast(dat=dat)
tail(bb)
# realized predicted
#2017-07-07 0.0008078943 0.003320551
#2017-07-08 0.0010431969 0.002369109
#2017-07-09 0.0008631436 0.002488993
#2017-07-10 0.0021875888 0.002373416
#2017-07-11 0.0039407938 0.003152035
#2017-07-12 0.0025053951 0.004210418
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.