South African Consumer Price Index Prediction using Stacked Ensemble Learning: A Comparative Model Evaluation
Abstract
Accurate Consumer Price Index (CPI) prediction requires models that generalise well across different economic conditions. This study evaluates stacked ensemble learning as an approach for improving predictive performance in South African CPI prediction. Monthly South African CPI data from January 2009 to December 2024 were analysed and divided into pre-COVID-19, post-COVID-19, and full-sample periods to assess model performance under different economic conditions. The study compares traditional statistical models, including the Random Walk and Seasonal Autoregressive Integrated Moving Average (SARIMA), with machine learning models, including Random Forest (RF), Gradient Boosting (GB), and Multilayer Perceptron (MLP). A two-layer stacking framework was developed in which RF and MLP served as base learners and GB acted as the meta-learner, producing RF-GB, MLP-GB, and MLP-RF-GB ensemble models. Model performance was evaluated using walk-forward validation and assessed using Root Mean Squared Error (RMSE) and Mean Absolute Error (MAE) across multiple prediction horizons. Results show that predictive performance varies across economic conditions. During the relatively stable pre-COVID-19 period, SARIMA achieved strong short-horizon predictive performance, while individual machine learning models performed better during the more volatile post-COVID-19 period. Across the full sample, the stacked ensemble models demonstrated more consistent predictive performance, particularly over longer prediction horizons. These findings highlight the potential of stacked ensemble learning for improving predictive performance and provide evidence that model suitability depends on the underlying economic conditions and prediction horizon.