Subscribe Now Subscribe Today
Research Article

Application of ANFIS to Agricultural Economic Variables Forecasting Case Study: Poultry Retail Price

S.M. Fahimifard, M. Salarpour, M. Sabouhi and S. Shirzady
Facebook Twitter Digg Reddit Linkedin StumbleUpon E-mail

It is well documented that many economic time series observations are nonlinear and nonlinear models estimated by various methods can fit a data base much better than linear models. Beside they can learn from examples, are fault tolerant in the sense that they are able to handle noisy and incomplete data, are able to deal with non-linear problems and once trained can perform prediction and generalization at high speed. Therefore, in this study, the utilization of Adaptive Neuro Fuzzy Inference System (ANFIS) as a nonlinear model and Auto-Regressive Integrated Moving Average (ARIMA) model as a linear model are compared to agricultural economic variables time series forecasting. As a case study the three horizons (1, 2 and 4 week ahead) of Iran’s poultry retail price are forecasted using the two mentioned models. The results of using the three forecast evaluation criteria state that, ANFIS model outperforms ARIMA model in all three horizons. And consequently the effective role of ANFIS model to improve the Iran’s poultry retail price forecasting accuracy can’t be denied.

Related Articles in ASCI
Similar Articles in this Journal
Search in Google Scholar
View Citation
Report Citation

  How to cite this article:

S.M. Fahimifard, M. Salarpour, M. Sabouhi and S. Shirzady, 2009. Application of ANFIS to Agricultural Economic Variables Forecasting Case Study: Poultry Retail Price. Journal of Artificial Intelligence, 2: 65-72.

DOI: 10.3923/jai.2009.65.72



In the last few decades, many forecasting models have been developed (Markridakis, 1982). Which among them, the Auto-Regressive Integrated Moving Average (ARIMA) model has been highly popularized, widely used and successfully applied not only in economic time series forecasting, but also as a promising tool for modeling the empirical dependencies between successive times and failures (Ho and Xie, 1998). Recently, it is well documented that many economic time series observations are non-linear while, a linear correlation structure is assumed among the time series values therefore, the ARIMA model can not capture nonlinear patterns and, approximation of linear models to complex real-world problem is not always satisfactory. While nonparametric nonlinear models estimated by various methods such as Artificial Intelligence (AI), can fit a data base much better than linear models and it has been observed that linear models, often forecast poorly which limits their appeal in applied setting (Racine, 2001).

Artificial Intelligence (AI) systems are widely accepted as a technology offering an alternative way to tackle complex and ill-defined problems (Kalogirou, 2003). They can learn from examples, are fault tolerant in the sense that they are able to handle noisy and incomplete data, are able to deal with non-linear problems and once trained can perform prediction and generalization at high speed (Kamwa et al., 1996). They have been used in diverse applications in control, robotics, pattern recognition, forecasting, medicine, power systems, manufacturing, optimization, signal processing and social/psychological sciences. AI systems comprise areas like expert systems, ANNs, genetic algorithms, fuzzy logic and various hybrid systems, which combine two or more techniques (Kamwa et al., 1996).

In this study, we compare the accuracy of new Adaptive Neuro-Fuzzy Inference System (ANFIS) model as the nonlinear model with the ARIMA as the linear model for forecasting 1, 2 and 4 weeks ahead of weekly Iran’s poultry retail price using the forecast evaluation criteria include; R2, MAD and RMSE.


Auto-Regressive Integrated Moving Average (ARIMA) Model
Introduced by Box and Jenkins (1978), in the last few decades the ARIMA model has been one of the most popular approaches of linear time series forecasting methods. An ARIMA process is a mathematical model used for forecasting. One of the attractive features of the Box-Jenkins approach to forecasting is that ARIMA processes are a very rich class of possible models and it is usually possible to find a process which provides an adequate description to the data. The original Box-Jenkins modeling procedure involved an iterative three-stage process of model selection, parameter estimation and model checking. Recent explanations of the process (Makridakis et al., 1998) often add a preliminary stage of data preparation and a final stage of model application (or forecasting). The ARIMA (p, d, q) model is as follow:


where, yt and et are the target value and random error at time t, respectively, φi(i = 1, 2,...,p) and θj(i = 1, 2,...,q) are model parameters, p and q are integers and often referred to as orders of autoregressive and moving average polynomials.

Adaptive Neuro-Fuzzy Inference System (ANFIS)
Many economic time series observations are non-linear while, a linear correlation structure is assumed among the time series values therefore, the ARIMA model can not capture nonlinear patterns and, approximation of linear models to complex real-world problem is not always satisfactory. Therefore, in this section the ANFIS nonlinear model has been introduced as follow:

Adaptive Neuro-Fuzzy Inference System (ANFIS) is a neuro-fuzzy system. It has a feed-forward neural network structure where each layer is a neuro-fuzzy system component (Fig. 1).

It simulates TSK (Takagi–Sugeno–Kang) fuzzy rule of type-3 where the consequent part of the rule is a linear combination of input variables and a constant. The final output of the system is the weighted average of each rule’s output (Sugeno and Kang, 1998). The form of the type-3 rule simulated in the system is as follows:

Fig. 1: The scheme of adaptive neural fuzzy inference system

If x1 is A1 and x2 is A2 and... and xp is Ap
Then, y = c0+ c1 x1+ c2x2+…+ cp xp

where, x1 and x2 are the input variables, A1 and A2 are the membership functions, y is the output variable and c0, c1 and c2 are the consequent parameters. The neural network structure contains six layers.

Layer 0 is the input layer. It has n nodes where n is the number of inputs to the system.
The fuzzy part of ANFIS is mathematically incorporated in the form of Membership Functions (MFs). A membership function can be any continuous and piecewise differentiable function that transforms the input value x into a membership degree, that is to say a value between 0 and 1. The most widely applied membership function is the generalized bell (gbell MF), which is described by the three parameters, a, b and c (Eq. 2). Therefore, layer 1 is the fuzzification layer in which each node represents a membership value to a linguistic term as a Gaussian function with the mean:


where, ai, bi and ci are parameters of the function. These are adaptive parameters. Their values are adapted by means of the back-propagation algorithm during the learning stage. As the values of the parameters change, the membership function of the linguistic term, Ai changes. These parameters are called premise parameters. In that layer there exist nxp nodes where n is the number of input variables and p is the number of membership functions. For example, if size is an input variable and there exist two linguistic values for size which are small and large then two nodes are kept in the first layer and they denote the membership values of input variable size to the linguistic values small and large.

Each node in Layer 2 provides the strength of the rule by means of multiplication operator. It performs and operation


Every node in this layer computes the multiplication of the input values and gives the product as the output as in the above equation. The membership values represented by are multiplied in order to find the firing strength of a rule where the variable x0 has linguistic value Ai and x1 has linguistic value Bi in the antecedent part of rule l.

There are pn nodes denoting the number of rules in layer 2. Each node represents the antecedent part of the rule. If there are two variables in the system namely x1 and x2 that can take two fuzzy linguistic values, small and large, there exist four rules in the system whose antecedent parts are as follows:

If x1 is small and x2 is small
If x1 is small and x2 is large
If x1 is large and x2 is small
If x1 is large and x2 is large

Layer 3 is the normalization layer which normalizes the strength of all rules according to the equation:


where, wi is the firing strength of the ith rule which is computed in layer 2. Node i computes the ratio of the ith rule’s firing strength to the sum of all rules’ firing strengths. There are pn nodes in this layer.

Layer 4 is a layer of adaptive nodes. Every node in this layer computes a linear function where the function coefficients are adapted by using the error function of the multi-layer feed-forward neural network


where, pi’s are the parameters where i = n+1 and n is the number of inputs to the system (i.e., number of nodes in Layer 0). In this example, since there exist two variables (x1 and x2), there are three parameters p0, p1 and p2) in layer 4 and is the output of layer 3. The parameters are updated by a learning step. Kalman filtering based on least-squares approximation and back-propagation algorithm is used as the learning step.

Layer 5 is the output layer whose function is the summation of the net outputs of the nodes in layer 4. The output is computed as:


where, is the output of node i in layer 4. It denotes the consequent part of rule i. The overall output of the neuro-fuzzy system is the summation of the rule consequences.

The ANFIS uses a hybrid learning algorithm in order to train the network. For the parameters in the layer 1, back-propagation algorithm is used. For training the parameters in the layer 4, a variation of least-squares approximation or back-propagation algorithm is used.


For the exercise which is follows, we modeled the Iran’s poultry retail price as a function of past prices. Clearly, this has the shortcoming that our models are somewhat naive from the perspective of theoretical macroeconomics. However, there is a large body of literature in economics suggesting that very parsimonious models, such ARIMA model, perform better than more complex models, at least from the perspective of forecasting (Chen et al., 2001). The study was carried out in Iran through the 2008:5-2008:9. We obtained the weekly poultry retail price time series of Iran for the period 2002:3-2007:12 from the website of Iran State Livestock Affairs Logistics ( Also, we consider the period 2003:3-2007:3 (70% of total observations) and 2007:3-2008-12 (30% of total observations) for training and testing of all models, respectively. The Iran’s weekly poultry retail price changes during this period have been shown in Fig. 2.

Figure 2 shows that these changes are swinger with the average and standard error of 15841.61 and 2405.79, respectively.

Fig. 2: Iran’s weekly poultry retail price changes during 2003:3 to 2008:12

Table 1: Forecast evaluation criteria
yt, and n are the actual value, output value and the number of observations, respectively

Beside, in order to evaluate and compare the forecasting performance, it is necessary to introduce forecasting evaluation criteria. In this research, three criteria include; R2, Mean Absolute Deviations (MAD) and Root Mean Square Error (RMSE) are used. Table 1 shows the R2, MAD and RMSE formulation.


Linear and Non-Linear Models Performance to Poultry Price Forecasting
Concerning the application of AI systems to time series forecasting, there have been mixed reviews. For instance, Lapedes and Farber (1987) reported that simple neural networks can outperform conventional methods, sometimes by orders of magnitude. Sharda and patil (1990) conducted a forecasting competition between neural network models and traditional forecasting technique (namely the Box-Jenkins method) using 75 time series of various natures. They concluded that simple neural nets could forecast about as well as the Box-Jenkins forecasting system. Wu (1995) conducts a comparative study between neural networks and ARIMA models in forecasting the Taiwan/US dollar exchange rate. His findings show that neural networks produce significantly better results than the best ARIMA models in both one-step-ahead and six-step-ahead forecasting. Similarly, Hann and Steurer (1996), Zhang and Hu (1998) find results in favor of neural network. Gencay (1999) compares the performance of neural network with those of random walk and Generalized Auto-Regressive Conditional Hetroskedastic (GARCH) models in forecasting daily spot exchange rates for the British pound, Deutsche mark, French franc, Japanese yen and the Swiss Franc. He finds that forecasts generated by neural network are superior to those of random walk and GARCH models. Ince and Trafalis (2006) proposed a two stage forecasting model which incorporates parametric techniques such as Auto-Regressive Integrated Moving Average (ARIMA), Vector Auto-Regressive (VAR) and co-integration techniques and nonparametric techniques such as Support Vector Regression (SVR) and Artificial Neural Networks (ANN) for exchange rate prediction. Comparison of these models showed that input selection is very important. Furthermore, findings showed that the SVR technique outperforms the ANN for two input selection methods.

Haofei et al. (2007) introduced a Multi-Stage Optimization Approach (MSOA) used in back-propagation algorithm for training neural network to forecast the Chinese food grain price. Their empirical results showed that MSOA overcomes the weakness of conventional BP algorithm to some extend. Furthermore the neural network based on MSOA can improve the forecasting performance significantly in terms of the error and directional evaluation measurements.

In ARIMA model, we identified the degree of integration (d) by augmented Dickey-Fuller and Schwarz criteria and the degree of autoregessive (p) and moving average (q) by log-likelihood function and akaike information criterion. In ANFIS, the hybrid learning algorithm is used to identify the membership function parameters of single-output, Sugeno type Fuzzy Inference Systems (FIS). A combination of least-squares and backpropagation gradient descent methods are used for training FIS membership function parameters to model a given set of input/output data. In Genfis1 which, Generates an initial Sugeno-type FIS for ANFIS training using a grid partition the gauss and gauss2 types of membership function are used for each input and linear membership function is used for output. Also, 3 and 4 numbers of membership functions are used for each input. The forecasting performance of Iran’s poultry retail price obtained by the ARIMA and ANFIS models has been shown in Table 2.

Figure 3a-c show the out-sample fitness of the best designed structures of ARIMA and ANFIS models for forecasting 1, 2 and 4 weeks ahead of Iran’s poultry retail price in comparison with the actual observations. Table 2 shows the quantity of evaluation criterions correspond to the best ARIM and ANFIS structures for forecasting the considered horizons.

In ANFIS structure e.g., structure (gauss 2-4-100) for forecasting 1 week ahead of poultry retail price the terms gauss2, 4 and 100 represent the type of membership function, the number of membership function and the number of training epochs, respectively.

In addition, in ARIMA structure e.g., structure (1-1-3) for forecasting 1 week ahead of poultry retail price the terms 1, 1 and 3 represent the degree of auto regressive (p), the degree of integration (d) and the degree of moving average (q), respectively.

Table 2 states that ANFIS model provide the better forecasting results for Iran’s poultry retail price forecasting by all three performance measures.

Comparison of Linear and Nonlinear Models Performance to Poultry Retail Price Forecasting
In order to compare the performance of considered linear and nonlinear models to Iran’s poultry retail price forecasting, we divided the quantity of forecast evaluation criterions of ANFIS to ARIMA model, per each horizon. Table 3 shows the results of these comparisons.

Table 2: ANFIS and ARIMA models performance to poultry retail price forecasting

Fig. 3: Sample fitness of ARIMA and ANFIS model, (a) 1 weak ahead, (b) 2 weak ahead and (c) 4 weak ahead

Table 3: Comparison the performance of various ANFIS and ARIMA structures

According to Table 3, the ANFIS nonlinear model forecasting performance is better in contrast with the ARIMA linear model because (1) the RMSE, MSE and MAD divided are less than 1 and (2) the R2 divided is more than 1.


In this study, the accuracy of ANFIS as the nonlinear model was compared with ARIMA as the linear model for forecasting 1, 2 and 4 weeks ahead of weekly Iran’s poultry retail price. Results were indicated that ANFIS nonlinear model forecasts are considerably more accurate than the linear traditional ARIMA model which used as benchmarks in terms of error measures, such as RMSE and MAD. On the other hand, as the R2 criterion is concerned; ANFIS nonlinear model is absolutely better than ARIMA linear model. Briefly using forecast evaluation criteria we found that ANFIS nonlinear model outperforms ARIMA linear model. And we cannot deny that the ANFIS model is an effective way to improve the Iran’s poultry retail price forecasting accuracy.

1:  Box, G.P.F. and G.M. Jenkins, 1978. Time series analysis: Forecasting and control. 3rd Edn., Son Francisco.

2:  Chen, X., J. Racine and R.N. Swanson, 2001. Semiparametric ARX neural-network models with an application to forecasting inflation. IEEE Trans. Neural Network, 12: 674-683.

3:  Gencay, R., 1999. Linear, non-linear and essential foreign exchange rate prediction with simple technical trading rules. J. Int. Econ., 47: 91-107.
CrossRef  |  

4:  Hann, T.H. and E. Steurer, 1996. Much ado about nothing? Exchange rate forecasting: Neural networks vs. linear models using monthly and weekly data. Neurocomputing, 10: 323-339.
CrossRef  |  

5:  Ho, S.L. and M. Xie, 1998. The use of ARIMA models for reliability and analysis. Comput. Ind. Eng., 35: 213-216.
CrossRef  |  

6:  Ince, H. and T.B. Trafalis, 2006. A hybrid model for exchange rate prediction. Decision Support Syst., 42: 1054-1062.
CrossRef  |  

7:  Kalogirou, S.A., 2003. Artificial intelligence for the modeling and control of combustion processes: a review. Prog. Energy Combustion Sci., 29: 515-566.
CrossRef  |  

8:  Kamwa, I., R. Grondin, V.K. Sood, C. Gagnon, V.T. Nguyen and J. Mereb, 1996. Recurrent neural networks for phasor detection and adaptive identification in power system control and protection. IEEE Trans. Instrumen. Measurement, 45: 657-664.
CrossRef  |  

9:  Lapedes, A. and R. Farber, 1987. Nonlinear signal processing using neural networks. Los Alamos National Laboratory LA-UR-87-2662. Proc. IEEE.

10:  Makridakis, S., 1982. The accuracy of extrapolation (time series) methods: Results of a forecasting competition. J. Forecast., 7: 111-153.

11:  Makridakis, S., S.C. Wheelwright and R.J. Hyndman, 1998. Forecasting: Methods and Applications. 3rd Edn., John Wiley and Sons Inc., New York, ISBN: 0471532339.

12:  Racine, J.S., 2001. On the nonlinear predictability of stock returns using financial and economic variables, forthcoming. J. Business Econ. Stat., 19: 380-382.

13:  Sharda, R. and R. Patil, 1990. Inexpensive neural net software simulators. Neural Network News, 2: 12-12.

14:  Sugeno, M. and G.T. Kang, 1988. Structure identification of fuzzy model. Fuzzy Sets Syst., 28: 15-33.
CrossRef  |  Direct Link  |  

15:  Wu, B., 1995. Model-free forecasting for non-linear time series (with application to exchange rates). Comput. Stat. Data Anal., 19: 433-459.
CrossRef  |  

16:  Zhang, G. and M.Y. Hu, 1998. Neural network forecasting of the British pound/US dollar exchange rate. Omega, 26: 495-506.
CrossRef  |  

17:  Haoffi, Z., X. Guoping, Y. Fagting and Y. Han, 2007. A neural network model based on the multi-stage optimization approach for short-term food price forecasting in China. Expert Syst. Applic., 33: 347-356.
CrossRef  |  

©  2020 Science Alert. All Rights Reserved