Antwi, AlbertKammies, Emelia ThembileChaka, LysonArasomwan, Martins Akugbe2025-10-032025-10-032025-07Antwi A, Kammies ET, Chaka L and Arasomwan MA (2025) Forecasting South African grain prices and assessing the non-linear impact of inflation and rainfall using a dynamic Bayesian generalized additive model. Frontiers in Applied Mathematics and Statistics 11:1582609. doi: 10.3389/fams.2025.1582609.2297-4687 (online)10.3389/fams.2025.1582609http://hdl.handle.net/2263/104611DATA AVAILABILITY STATEMENT : Publicly available datasets were analyzed in this study. The datasets were extracted and compiled from different sources including www.sagis.org.za/safex_historic.html, www.investing.com and https://giovanni.gsfc.nasa.gov/giovanni/. The compiled list is available upon request.INTRODUCTION : Accurate price forecasts and the evaluation of some of the factors that affect the prices of grains are crucial for proper planning and food security. Various methods have been designed to model and forecast grain prices and other time-stamped data. However, due to some inherent limitations, some of these models do not produce accurate forecasts or are not easily interpretable. Although dynamic Bayesian generalized additive models (GAMs) offer potential to overcome some of these problems, they do not explicitly model local trends. This may lead to biased fixed effects estimates and forecasts, thus highlighting a significant gap in literature. METHODS : To address this, we propose the use of random intercepts to capture localized trends within the dynamic Bayesian GAM framework to forecast South African wheat and maize prices. Furthermore, we examine the complex underlying relationships of the prices with inflation and rainfall. RESULTS : Evidence from the study suggests that the proposed method is able to adequately capture the dynamic localized trends consistent with the underlying local trends in the prices. It was observed that the estimated localized variations are significant, which led to improved and efficient fixed-effect parameter estimates. This led to better posterior predictions and forecasts. A comparison to the static trend Bayesian GAMs and the autoregressive integrated moving average (ARMA) models indicates a general superiority of the proposed approach for the posterior predictions and long-term posterior forecasts and has potential for short-term forecasts. The static trend Bayesian GAMs were found to generally outperform the ARMA models in long-term posterior forecasts and also have potential for short-term forecasts. However, for 1-step ahead posterior forecasts, the ARMA models consistently outperformed all the Bayesian models. The study also unveiled a significant direct nonlinear impact of inflation on wheat and maize prices. Although the impacts of rainfall on wheat and maize prices are indirect and nonlinear, only the impact on maize prices is significant. DISCUSSION : The improved efficiency and forecasts of our proposed method suggest that researchers and practitioners may consider the approach when modelling and forecasting long-term prices of grains, other agricultural commodities, speculative assets and general single-subject time series data exhibiting non-stationarity.en© 2025 Antwi, Kammies, Chaka and Arasomwan. This is an open-access article distributed under the terms of the Creative Commons Attribution License (CC BY).Local trendBayesian GAMGeneralized additive model (GAM)Grain pricesNonlinearityNon-stationarityForecasting South African grain prices and assessing the non-linear impact of inflation and rainfall using a dynamic Bayesian generalized additive modelArticle