forecast_volume | R Documentation |
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"
.
forecast_volume(model, data, burn_in_days = 0)
model |
A model object of class " |
data |
An n_bin * n_day matrix or an |
burn_in_days |
Number of initial days in the burn-in period. Samples from the first |
A list containing the following elements:
original_signal
: A vector of original intraday volume;
forecast_signal
: A vector of forecast intraday volume;
forecast_components
: A list of the three forecast components: daily, seasonal, intraday dynamic, and residual components.
error
: A list of three error measures: mae, mape, and rmse.
Shengjie Xiu, Yifan Yu and Daniel P. Palomar
Chen, R., Feng, Y., and Palomar, D. (2016). Forecasting intraday trading volume: A Kalman filter approach. Available at SSRN 3101695.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.