Package 'ARMALSTM'

Title: Fitting of Hybrid ARMA-LSTM Models
Description: The real-life time series data are hardly pure linear or nonlinear. Merging a linear time series model like the autoregressive moving average (ARMA) model with a nonlinear neural network model such as the Long Short-Term Memory (LSTM) model can be used as a hybrid model for more accurate modeling purposes. Both the autoregressive integrated moving average (ARIMA) and autoregressive fractionally integrated moving average (ARFIMA) models can be implemented. Details can be found in Box et al. (2015, ISBN: 978-1-118-67502-1) and Hochreiter and Schmidhuber (1997) <doi:10.1162/neco.1997.9.8.1735>.
Authors: Debopam Rakshit [aut, cre], Ritwika Das [aut], Dwaipayan Bardhan [aut]
Maintainer: Debopam Rakshit <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2024-12-25 06:34:16 UTC
Source: CRAN

Help Index


Hybrid ARMA-LSTM Model for Time Series Forecasting

Description

The linear ARMA model is fitted to the time series. The significant number of PACF values of ARMA residuals are considered as the lag. The LSTM model is fitted to the ARMA residuals setting the lag value as the time step. User needs to install keras, tensorflow and reticulate packages as the prerequisite to implement this package.

Usage

ARMA.LSTM(X, p, q, arfima = FALSE, dist.model= "ged", out.sample, LSTM.units,
ACTIVATION.function = "tanh", DROPOUT = 0.2, Optimizer ="adam", Epochs = 100,
LSTM.loss = "mse", LSTM.metrics = "mae")

Arguments

X

A univariate time series data

p

Order of AR

q

Order of MA

arfima

Whether to include arfima (0<d<0.5)

dist.model

The distribution density to use for the innovation. The default distribution for the mean model used is "ged". Other choices can be obtained from the rugarch package.

out.sample

A positive integer indicating the number of periods before the last to keep for out of sample forecasting. To be considered as test data.

LSTM.units

Number of units in the LSTM layer

ACTIVATION.function

Activation function

DROPOUT

Dropout rate

Optimizer

Optimizer used for optimization of the LSTM model

Epochs

Number of epochs of the LSTM model

LSTM.loss

Loss function

LSTM.metrics

Metrics

Value

  • ARMA.fit: Parameters of the fitted ARMA model

  • ARMA.fitted: Fitted values of the ARMA model

  • ARMA.residual: Residual values of the ARMA model

  • ARMA.forecast: Forecast values obtained from the ARMA model for the test data

  • ARMA.residual.nonlinearity.test: BDS test results for the ARMA residuals

  • LSTM.lag: Lag used for the LSTM model

  • FINAL.fitted: Fitted values of the hybrid ARMA-LSTM model

  • FINAL.residual: Residual values of the hybrid ARMA-LSTM model

  • FINAL.forecast: Forecast values obtained from the hybrid ARMA-LSTM model for the test data

  • ACCURACY.MATRIX: RMSE, MAE and MAPE of the train and test data

References

  • Box, G. E., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015). Time series analysis: forecasting and control. John Wiley & Sons.

  • Granger, C. W., & Joyeux, R. (1980). An introduction to long-memory time series models and fractional differencing. Journal of time series analysis, 1(1), 15-29.

  • Hochreiter, S., & Schmidhuber, J. (1997). Long short-term memory. Neural computation, 9(8), 1735-1780.

  • Rakshit, D., Paul, R. K., & Panwar, S. (2021). Asymmetric price volatility of onion in India. Indian Journal of Agricultural Economics, 76(2), 245-260.

  • Rakshit, D., Paul, R. K., Yeasin, M., Emam, W., Tashkandy, Y., & Chesneau, C. (2023). Modeling Asymmetric Volatility: A News Impact Curve Approach. Mathematics, 11(13), 2793.

  • Rakshit, D., Roy, A., Atta, K., Adhikary, S., & Vishwanath. (2022). Modeling Temporal Variation of Particulate Matter Concentration at Three Different Locations of Delhi. International Journal of Environment and Climate Change, 12(11), 1831-1839.

Examples

y<-c(5,9,1,6,4,9,7,3,5,6,1,8,6,7,3,8,6,4,7,5)
my.hybrid<-ARMA.LSTM(y, p=1, q=0, arfima=FALSE, dist.model = "ged",
out.sample=10, LSTM.units=50, ACTIVATION.function = "tanh",
DROPOUT = 0.2, Optimizer ="adam", Epochs = 10, LSTM.loss = "mse", LSTM.metrics = "mae")