Abstract
Share of agricultural sector on GDP has been declining overtime, suggesting a need to deploy machine learning method to predict factors influencing agricultural GDP growth in Tanzania. The used time series data from 1970-2024 with and utilized LSTM, XGBoost, and Random Forest regression models for prediction. Results showed that the l.STM model had the highest value of R² compared to XGBoost and Random Forest regression model. Furthermore, results from LSTM model showed that lending rate dynamics played a critical role in the prediction of the share of agriculture on GDP. Also, results from XGBoost showed that rural population share and exchange rates were influential factors which predicts share of agriculture in GDP. Results from Random Forest regression model showed that exchange rates and the first lag of the share of agriculture in GDP. In general findings suggest the need to monitor macroeconomic factors to prevent their ill effect on the agriculture sector. Also, findings suggest the need of modernize agricultural value chain to improve contribution of agriculture in the GDP.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright (c) 2026 Eastern Africa Journal of Official Statistics