forecast_volume {intradayModel}R Documentation

Forecast One-bin-ahead Intraday Volume

Description

This function forecasts one-bin-ahead intraday volume. Its mathematical expression is \hat{y}_{\tau+1} = E[y_{\tau+1}|\{y_{j}\}_{j=1}^{\tau}]. It is a wrapper of decompose_volume() with purpose = "forecast".

Usage

forecast_volume(model, data, burn_in_days = 0)

Arguments

model

A model object of class "volume_model" from fit_volume().

data

An n_bin * n_day matrix or an xts object storing intraday volume.

burn_in_days

Number of initial days in the burn-in period. Samples from the first burn_in_days are used to warm up the model and then are discarded.

Value

A list containing the following elements:

Author(s)

Shengjie Xiu, Yifan Yu and Daniel P. Palomar

References

Chen, R., Feng, Y., and Palomar, D. (2016). Forecasting intraday trading volume: A Kalman filter approach. Available at SSRN 3101695.

Examples

library(intradayModel)
data(volume_aapl)
volume_aapl_training <- volume_aapl[, 1:20]
volume_aapl_testing <- volume_aapl[, 21:50]
model_fit <- fit_volume(volume_aapl_training, fixed_pars = list(a_mu = 0.5, var_mu = 0.05),
                        init_pars = list(a_eta = 0.5))
                        
# forecast testing volume
forecast_result <- forecast_volume(model_fit, volume_aapl_testing)

# forecast testing volume with burn-in
forecast_result <- forecast_volume(model_fit, volume_aapl[, 1:50], burn_in_days = 20)


[Package intradayModel version 0.0.1 Index]