ctanujit / FEWNet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FEWNet: Filtered Ensemble Wavelet Neural Network

This repository is the source code for the research paper "Forecasting CPI Inflation under Economic Policy and Geo-political Uncertainties". The paper introduces a new approach called the Filtered Ensemble Wavelet Neural Network (FEWNet), which can generate accurate long-term predictions for CPI inflation. The idea utilizes a maximum overlapping discrete wavelet transform on the CPI inflation data to extract high-frequency and low-frequency signals. The wavelet-transformed series and filtered exogenous variables are fed into autoregressive neural networks downstream to get the ultimate ensemble forecast. Our theoretical analysis demonstrates that FEWNet effectively minimizes the empirical risk compared to individual, fully connected neural networks. Furthermore, we provide evidence that the real-time forecasts generated by the suggested algorithm, using a rolling-window approach, are notably superior in accuracy compared to standard forecasting methods used for comparison. In addition, we utilize conformal prediction intervals to measure the level of uncertainty linked to the projections produced by the suggested method. The outstanding performance of FEWNet can be ascribed to its ability to efficiently capture non-linearities and long-range relationships in the data via its flexible architecture.

  • FEWNet integrates the maximum overlapping discrete wavelet transformation (MODWT) approach, economic filtering methods including the Hodrick-Prescott (HP) filter and Christiano-Fitzgerald (CF) filter, and the autoregressive neural network with exogenous variables (ARNNx).

  • The code module economic filters contains generic code to derive the trend and cycle components using HP and CF economic filters.

  • The global characteristics of the CPI Inflation, EPU, and GPRC can be derived using global_characteristics code module. This R code module calculates key statistical properties like skewness, kurtosis, long-range dependency, seasonality, stationarity, and non-linearity of the above-mentioned time series.

  • The application of Wavelet Coherence Analysis (WCA) for analyzing the spatio-temporal association among variables is available in WCA. The WCA methodology offers a valuable method for examining the interconnection and simultaneous movement of two non-stationary signals in the time-frequency domain.

  • The code module to perform MODWT (Maximal Overlap Discrete Wavelet Transform) - based decomposition of the CPI Inflation series for the BRIC countries is available in MODWT

  • The code modules for all the baseline models: DeepAR (python script), ARNNx (R script), NBeatsx (python script), ARFIMAx (R script), SARIMAx (python script), ARIMAx (python script), Lasso Regression (LR) (python script), ARDL (python script), MSGARCH (R script), AR (R script), RW/RWD (R script), XGBoost (python script), TFT (python script), WARIMAx (R script) are available in baseline_models. These code modules share a generic framework for all algorithms highlighted above. The specific model and its hyper-parameters may vary slightly for different countries and forecast horizons. Please take note of the fact that all the deep learning models like NBeats and TFT are implemented using Darts package, SARIMAx/ARIMAx models are implemented using statsmodels and pmdarima packages in Python, and XGBoost models have been implemented using skforecast and xgboost packages in python. The relevant libraries/packages for different algorithms are highlighted in the subsequent R/Python scripts.

  • The overall architectural design of the algorithm for generating long-term forecasts is shared below: architecture_FEWNet

  • The following image illustrates the key steps for generating the forecasts using the FEWNet algorithm: Pseudo_Code_FEWNet

  • This repository contains the datasets for the CPI Inflation numbers along with the EPU and GPRC indices for the BRIC countries, and these datasets have been used in the downstream model development exercise. To access the dataset, please refer to the dataset section in GitHub. For more details about the datasets, please refer to the paper Forecasting CPI inflation under economic policy and geopolitical uncertainties. In our study, we consider the monthly CPI numbers for BRIC countries from 2003-01 to 2021-11 released by FRED (Federal Reserve Bank of St. Louis) FRED - BRAZIL CPI.

  • The source code for the proposed FEWNet model can be accessed through FEWNet. The proposed framework consists of two hyper-parameters $(p,k)$, where $p$ denotes the number of lagged input observations and $k$ indicates the number of nodes in the hidden layer of the proposed EWNet model. The hyper-parameter $p$ is tuned by minimizing the Symmetric Mean Absolute Percentage Error (SMAPE) metric on the validation set. The optimized values of these hyper-parameters for different economies are highlighted in the paper and can be accessed through the source code for the FEWNet. Moreover, we also share a framework for Grid-search CV to determine the optimal values of the hyper-parameters (HPs) at the end of the source code. Interested users can experiment with the code for different ranges of values for the HPs or other data types.

  • The source code FEWNet also contains a code module to derive the conformalised prediction intervals (CPI) for the forecasts generated by the FEWNet Model. Similarly, the CPIs can be calculated using the same code module for other models. The ground truth, forecasted values of CPI inflation series along with the CPI of the proposed FEWNet and forecasts from the top two baseline models are shared below for the 24M forecast horizon: 24M_forecasts_CPI

  • A generic Python code module performance evaluation and MCB test are available in Performance_evaluation and MCB. The dataset used for the MCB test can be accessed in Performance_evaluation. The R code module for Giacomini and Rossi (2010) forecasting ability test is also available in Performance_evaluation. The corresponding datasets for GR tests for respective countries can be accessed in dataset.

  • The code module and the datasets can be referred to reproduce the tables, charts, and final performance evaluation.

  • To cite this work, please use

    Sengupta, Shovon, Tanujit Chakraborty, and Sunny Kumar Singh. "Forecasting CPI inflation under economic policy and geo-political uncertainties." arXiv preprint arXiv:2401.00249 (2023).

    @article{sengupta2023forecasting,

    title={Forecasting CPI inflation under economic policy and geo-political uncertainties},

    author={Sengupta, Shovon and Chakraborty, Tanujit and Singh, Sunny Kumar},

    journal={arXiv preprint arXiv:2401.00249},

    year={2023},

    note=https://arxiv.org/pdf/2401.00249.pdf}

References

  • [1] CPI Data: Brazil
  • [2] CPI Data: Russia
  • [3] CPI Data: India
  • [4] CPI Data: China
  • [5] EPU Data
  • [6] GPRC Data
  • [7] Pratap, Bhanu and Sengupta, Shovon. Rbi working paper series no. 04 Macroeconomic forecasting in India: Does machine learning hold the key to better forecasts? 2019.
  • [8] Panja, Madhurima, Chakraborty, Tanujit, Kumar, Uttam and Liu, Nan. Epicasting: An ensemble wavelet neural network for forecasting epidemics. Neural Networks, 2023.
  • [9] Herzen, Julien, et al. "Darts: User-friendly modern machine learning for time series." Journal of Machine Learning Research 23.124 (2022): 1-6.
  • [10] Garza, Federico et al. "StatsForecast: Lightning fast forecasting with statistical and econometric models." PyCon, Salt Lake City, Utah, US (2022).
  • [11] Hyndman, Rob J., and Yeasmin Khandakar. "Automatic time series forecasting: the forecast package for R." Journal of statistical software 27 (2008): 1-22.
  • [12] Di Narzo, A. F., Aznarte, J. L., & Stigler, M. (2022). Package ‘tsDyn’.

About


Languages

Language:R 71.8%Language:Python 28.2%