One of the main challenges facing smallholder farmers in developing countries is fluctuating prices. Agricultural prices tend to vary and fluctuate rapidly over time, as prices always adapt to various changes . High price fluctuations can influence production decisions as it becomes difficult for the producer to predict the exact level of future prices or to adjust the timing of the sale . Price fluctuations also offer traders the opportunity to manipulate price information at the farm level . A risk-averse producer will produce less output when faced with price uncertainty and vice versa, ultimately affecting food supplies availability. Price uncertainty also hurts poor consumers as they have to reduce their food consumption or, in extreme cases, simply starve. In addition to its impact on individuals, price volatility can significantly impact economic and social resilience, and hamper economic growth   .
Tanzania is primarily an agricultural country, and rice being among the main crop produced; it’s associated with risks and uncertainties . Production risks include losses of drought, pests, and disease, which can be minimized by the appropriate use of technology and agricultural insurance . On the other hand, price risks are more difficult to avoid because prices vary according to the supply and demand behavior of commodities in domestic and foreign markets . In general, smallholder rice farmers are exposed to risks of price fluctuations that can compromise business profitability and, therefore, need to invest in innovative planting techniques and make predictions of the future price situation to plan the investments and costs  . One of the alternatives to reduce uncertainty in the economic decision-making process is to use time series forecasting models .
Given the economic importance of rice in Tanzania, which is the second most important crop after maize, the most traded crop than any other food crop, employs over 1.6 million people and is highly produced by small farmers (about 90 percent)  . This article aims to use time-series statistical models to forecast rice prices in Mbeya region (one of the major rice-producing regions in Tanzania) and identify the most suitable model. The study is justified by the fact that there is little research with time series models to predict commodity prices. Such analysis can provide tools that help farmers and policymakers in their decision-making. In this study, the models to be tested are the Holt-Winters Exponential Smoothing and the ARIMA model, models that can predict trends and seasonality. The rest of the paper is structured as follows: Part 2 describes the data and methods, which constitute the data types and econometric techniques used in this article. Part 3 illustrates the results, while Part 4 offers conclusions.
2. Data and Methods
The data used for empirical analysis are monthly rice prices (quoted in Tanzanian shillings per 100 kg) marketed at wholesale markets in the Mbeya region from January 2004 to September 2019, totaling 189 observations. The data set was obtained from the Ministry of Industry and Trade, Tanzania1. The free software R was used to develop the ARIMA and Holt-Winters Exponential Smoothing models. For the choice of the best model, we reserved the last nine observations of the series for comparison with the predicted values. The descriptive results for the wholesale rice prices including mean, maximum, and standard deviations are presented in Table 1.
Table 1. Descriptive results of the nominal wholesale rice pricesa.
Note: aPrices are in (1000) Tanzanian shillings.
The use of the ARIMA and Holt-Winters exponential smoothing models to forecast rice prices relied on their ability to predict time series data showing both trend and seasonal variation. The objective is to choose the best model for predicting the prices of agricultural products.
2.2.1. ARIMA Model
Among the statistical models developed to predict future values based on a historical database is the Autoregressive Integrated and Moving Averages (ARIMA) model. Proposed by Box & Jenkins , the model is suitable for describing stationary and non-stationary series. The methodology consists of fitting ARIMA models (p, d, q) to a data set. Where p is the number of terms of the autoregressive part (AR), d is the number of successive differences, and q is the number of terms of the moving average part (MA).
The procedure for searching a stochastic model that represents a time series is an iterative process consisting of three phases: Identification phase, where the condition of stationarity, the behavioral structures such as trend, seasonality, periodicities, and the issues of data correlation (autocorrelation) are verified; Estimation phase through which suitability of the considered model is validated based on estimated parameters; and Diagnosis phase where the model adjustment through residual analysis, statistical tests, and model selection/adequacy criteria is verified .
When a time series has a time-dependent mean and variance, it is not stationary, and it will need to be transformed. The most common transformation is to take successive differences from the original series to a stationary series .
The first difference of is defined by:
The second is given by:
In typical situations, according to the authors, it will be sufficient to take one or two differences for the series to become stationary. The number of differences needed to make the series stationary is called the order of integration d. The inclusion of the integration order term allows the use of the ARIMA models (p, d, q) given by the equation:
where , are the parameters for the autoregressive part and , are the moving average, is an error that cannot be estimated from the model, d represents the number of differences applied in the series.
As the main objective of the ARIMA model is to generate future forecast values, the paper uses the Akaike Information Criterion (AIC) proposed by Akaike  to assess the degree of accuracy of the forecasts.
where is estimated error variance; n is the sample size, and p, q are the parameter values.
From the above criteria values, it is possible to choose the most suitable model to make predictions h steps ahead; the lower the criteria values, the more suitable the model for making predictions. In addition to the selection criteria, we analyzed the white noise condition of the waste through the Ljung-Box test .
2.2.2. Holt-Winters Exponential Smoothing Model
Holt-Winters exponential smoothing model can be divided into a multiplicative model and additive model. The choice of the model depends on the seasonal component of the series.
The model equations are given by:
With three smoothing equations (Equations (7) to (9)):
where (γ, and δ) are smoothing constants, l is number of seasons in a year, is a seasonal pattern and refers to irregular components.
3. Empirical Result
3.1. Estimation of ARIMA Model
Before starting a time series analysis, it is necessary to identify the stationarity properties of the data series. The nature of the series (Figure 1(a)) leads us to differentiate the series to make it stationary (Figure 1(b)).
The autocorrelation (ACF) and partial autocorrelation (PACF) graphs (Figure 2) indicates which model to use. The differentiated ACF graph gives us an indication of a significant autoregressive parameter (p), and the PACF graph demonstrates one parameter for moving averages (q).
In order to identify the best ARIMA model, we tested several competing models. Table 2 shows the best significant ARIMA models for the rice price series studied.
According to the Akaike information criterion (AIC) , the best model to predict the rice prices studied is ARIMA (0, 1, 3) (2, 1, 0)  (see Table 2). To confirm the model’s fit, we checked whether it meets the white noise assumptions. Figure 3(a) shows the distribution of the residuals and Figure 3(b) verifies that the errors are concentrated in the range of (−2, 2), which means that there is no variance, i.e., the errors are around the mean. Looking at the ACF
Figure 1. (a) Original price series; (b) Price series with the first difference.
Figure 2. Autocorrelation (ACF) and Partial Autocorrelation (PACF).
Table 2. Competing ARIMA models.
Note: A good model is the one that has minimum AIC among all the other models (Akaike, 1974).
and PACF plots (Figure 4), we can see that there is no significantly non-zero autocorrelation in any lag, so the data are independent and demonstrates a good fit for the model.
After identifying the best fit model, the next step was to forecast rice prices for the next 24 months. The results of the fitted values (180 months) (Figure 5(a)) and the predicted values (Figure 5(b)) show that the forecast prices for both periods are within the allowable range and can therefore be justified in predicting future rice prices.
To further justify the results, we compared the forecast results of the ARIMA model with nine steps ahead and the actual rice prices for the same period. The results in Table 3 show that the predicted price values for the specified period are very close to the actual price values. In addition, the actual values are within the low and high limits at both the 80 and 95 percent significance level. Based on these results, it is clear that the ARIMA model can be used to forecast the prices of agricultural products.
3.2. Estimation of Holt-Winters Model
The Holt-Winters model falls into two categories, additive and multiplicative. In order to choose the best model, we first find the fitted values for the additive and multiplicative models. In the second step, we compared the fitted values of the models to the original series. The model that best corresponds to the price series studied was then chosen to compare with the ARIMA model. According to Figure 6(a) and Figure 6(b), the best model using the selection criteria was the
Figure 3. (a) Graphs of residuals; (b) QQ-Plot.
Figure 4. Autocorrelation (ACF) and partial autocorrelation (PACF) function of Residual.
Figure 5. (a) Fitted values within the observed period; (b) Forecasts with 24 months ahead.
Holt-Winters additive model.
3.3. Model Comparison
In order to compare the two models, we used the MAPE (Mean Absolute Percent Error) selection criteria. As proposed in the methodology, the last nine observations of the nominal rice price series were reserved for the comparison of the proposed models. The results in Table 4 show that both models could be
Table 3. Predicted against real values (h = 9).
Note: Prices are in (1000) Tanzanian shillings.
Figure 6. (a) Additive model; (b) Multiplicative model.
Table 4. Forecast results of the models under analysis (h = 9).
Note: Prices are in (1,000) Tanzanian shillings.
used to forecast rice prices studied. However, according to the MAP selection criteria, the price values predicted by the Holt-Winters additive model are closer to the original rice prices than those predicted by the ARIMA model (see Table 4). Thus, on the basis of these results, the Holt-Winters additive model is more efficient in predicting the prices of agricultural products than the ARIMA model.
In this study, we looked at forecasting agricultural commodity prices using the time series model. The data used are the wholesale rice prices in Tanzania for the period January 2004 to September 2019. The study found that both of the studied models (Holt-Winters and ARIMA) performed well in predicting rice price values. However, in the model comparison, although by very little difference, the Holt-Winters additive model was closer to the actual data. Thus, it is clear from this article that time series can be used to forecast the prices of agricultural products, not only rice but also other crops, thus helping producers, policymakers and other actors to make informed production and marketing decisions.
Furthermore, this study is limited to rice prices in Tanzania. Therefore, similar studies on other agricultural products are also recommended.
YJM designed and analyzed the statistical data for the study. ST contributed to the data collection and analysis. YY supervised the study. All authors have read and approved the final and revised version of the manuscript.
The authors are grateful to everyone who facilitated the study.
 Food and Agriculture Organization of the United Nations, Organization for Economic Cooperation and Development, International Fund for Agricultural Development, International Food Policy Research Institute, International Monetary Fund, United Nations Conference on Trade and Development, et al. (2011) Price Volatility in Food and Agricultural Markets: Policy Responses. Technical Report, Food and Agriculture Organization of the United Nations; Organization for Economic Cooperation and Development, Rome. https://doi.org/10.1596/27379
 Seck, P.A., Tollens, E., Wopereis, M.C., Diagne, A. and Bamba, I. (2010) Rising Trends and Variability of Rice Prices: Threats and opportunities for Sub-Saharan Africa. Food Policy, 35, 403-411. https://doi.org/10.1016/j.foodpol.2010.05.003
 Worako, T.K., Jordaan, H. and van Schalkwyk, H.D. (2011) Investigating Volatility in Coffee Prices along the Ethiopian Coffee Value Chain. Agrekon, 50, 90-108.
 Ismail, A., Ihsan, H., Khan, S.A. and Jabeen, M. (2017) Price Volatility of Food and Agricultural Commodities: A Case Study of Pakistan. Journal of Economic Cooperation and Development, 38, 77-120.
 Nkuba, J., Ndunguru, A., Madulu, R., Lwezaura, D., Kajiru, G., Babu, A., et al. (2016) Rice Value Chain Analysis in Tanzania: Identification of Constraints, Opportunities and Upgrading Strategies. African Crop Science Journal, 24, 73-87. https://doi.org/10.4314/acsj.v24i1.8S
 Achandi, E.L. and Mujawamariya, G. (2016) Market Participation by Smallholder Rice Farmers in Tanzania: A Double Hurdle Analysis. Studies in Agricultural Economics, 118, 112-115.
 Kantanantha, N., Serban, N. and Griffin, P. (2010) Yield and Price Forecasting for Stochastic Crop Decision Planning. Journal of Agricultural, Biological, and Environmental Statistics, 15, 362-380. https://doi.org/10.1007/s13253-010-0025-7
 Wilson, R.T. and Lewis, I. (2015) The Rice Value Chain in Tanzania. A Report from the Southern Highlands Food Systems Programme. The Food and Agriculture Organization of the United Nations, Rome.
 Akaike, H. (1974) A New Look at the Statistical Model Identification. In: Parzen, E., Tanabe, K. and Kitagawa, G., Eds., Selected Papers of Hirotugu Akaike, Springer, New York, 215-222.