# A Hybrid Neural Network and H-P Filter Model for Short-Term Vegetable Price Forecasting

Authors: Youzhu Li; Chongguang Li; Mingyang Zheng
Journal: Mathematical Problems in Engineering
 (2014)

---

## Abstract

This paper is concerned with time series data for vegetable prices, which have a great impact on human’s life. An accurate forecasting method for prices and an early-warning system in the vegetable market are an urgent need in people’s daily lives. The time series price data contain both linear and nonlinear patterns. Therefore, neither a current linear forecasting nor a neural network can be adequate for modeling and predicting the time series data. The linear forecasting model cannot deal with nonlinear relationships, while the neural network model alone is not able to handle both linear and nonlinear patterns at the same time. The linear Hodrick-Prescott (H-P) filter can extract the trend and cyclical components from time series data. We predict the linear and nonlinear patterns and then combine the two parts linearly to produce a forecast from the original data. This study proposes a structure of a hybrid neural network based on an H-P filter that learns the trend and seasonal patterns separately. The experiment uses vegetable prices data to evaluate the model. Comparisons with the autoregressive integrated moving average method and back propagation artificial neural network methods show that our method has higher accuracy than the others.


---

## Body

## 1. Introduction

Among all the price fluctuations in the market, the prices of agricultural products have the most obvious and basic impact on the cost of living. Many countries have established price early warning systems to monitor and evaluate grain prices so that the price can be timely adjusted and controlled when it is in abnormal state, in order to guarantee that the grain economy develops in a sustainable, healthy, and stable way [1, 2].To predict a time series price is a challenging problem according to current studies [3, 4]. In recent decades, several linear and nonlinear prediction models have been developed for time series data forecasting. The autoregressive integrated moving average (ARIMA) model [5] is one of the most popular methods based on time series and has been widely used for data prediction [6]. Bianco et al. proposed ARIMA and transfer function models for the prediction of electricity consumption [7]. Linear regression models have also been proposed for the prediction of energy consumption [8].However, time series data forecasting is usually a nonlinear problem, so linear approaches may fail to capture the nonlinear dynamics of the process. There are some nonlinear methods for forecasting future prices using a machine learning model [9–12]. As the price of vegetables has seasonal cyclical factors, some authors use signal processing methods to analyze the historic data and predict future prices [6, 13]. The limitation of this method is that it assumes that the period of price changes is fixed and will follow the same cycle in the future. As the price is impacted by many factors, it cannot have a fixed change cycle. Those methods cannot handle both linear and nonlinear patterns at the same time.In this paper, a hybrid approach, combining H-P filtering [14] and a neural network model [15, 16], is developed to predict short-term time series price data. Due to the high correlation of time series data, they often contain a trend component. Hence, using an H-P filter to decompose the demand time series into its trend and cyclical components is proposed as an effective technique for time series data forecasting. The use of combined models in water quality time series data could assist in capturing patterns in the data and could improve prediction accuracy. The motivation behind this hybrid approach is large that water quality problems are often complex in nature and so any individual model may not be able to capture all the different patterns equally well.This paper is organized as follows. Section2 briefly describes the situation of the current vegetable market in China and the factors affecting prices. In Section 3, we introduce some technical background knowledge. Section 4 describes the proposed H-P filter based hybrid neural network model. We discuss the experimental results in Section 5. Our conclusion is presented in Section 6.


## 2. A Brief Description of the Vegetable Market in China

The Chinese vegetable market plays an important role in people’s daily life and in the agricultural industry. In 2011, the area planted with vegetables was about 19.7 square kilometers, and vegetable production reached 6.79 million tons. According to a report from the Food and Agriculture Organization (FAO), China has 43 percent of the planted area of the world and 50 percent of the production of the world, and so it is ranked as the first in the world vegetable production.However, vegetable prices have been volatile in recent years. There are many factors that have an influence on vegetable prices, such as population, national policies, area of arable land, international financial markets, price of alternatives, economic growth, and international trade. Here, we study the hidden patterns behind the history of vegetable prices to see if we can build a more accurate model for price forecasting.


## 3. Background

There are several methods for extracting the trend and cyclical components from an original single set of data. As the prediction results from the two components need to be merged together, we have to find a linear filter to separate the original single set of data. Here, we choose the linear Hodrick-Prescott filter to get the trend and cyclical components [17]. Then, we use a traditional neural network to learn from the patterns.


### 3.1. Hodrick-Prescott Filter Model

The H-P filter [17] decomposes time series data into trend and cyclical components: Y
t
=
Y
t
T
+
Y
t
C, t
=
1,2
,
…
,
T, where Y
t
T and Y
t
C are the trend and cyclical components, respectively. This decomposition assumes that the trend component does not contain any seasonality and, because the cycle is derived residually, it does not separate out the cycle from any irregular movements. Hodrick and Prescott [17] minimize the variance of Y
t
C, subject to a penalty for variations in the second difference of the growth term. Their filter is given by
(1)
min
⁡
Y
t
T
{
∑
t
=
1
T
(
Y
t
-
Y
t
T
)
2
+
λ
∑
t
=
2
T
-
1
[
(
Y
t
+
1
T
-
Y
t
T
)
-
(
Y
t
T
-
Y
t
-
1
T
)
]
2
}
.The parameterλ controls the smoothness of Y
t
C. The minimization of (1) provides a mapping from Y
t to Y
t
T, with Y
t
C determined residually. The estimate of potential output using the H-P filter depends on the choice of λ, the smoothing parameter. A λ of zero corresponds to an extreme real business cycle model where all of the fluctuations in real output are caused by technology shocks, because the H-P trend is the same as the series being detrended. Conversely, as λ tends to infinity, the H-P trend moves towards a deterministic time trend. Following Hodrick and Prescott, researchers typically set λ at 1600 for use with quarterly data [17] but test the robustness of their results with different values.


### 3.2. Principles of Neural Networks

Artificial neural networks (ANN) are popular models for studying nonlinear relationship functions. One of the most significant advantages of an ANN model is that it can approximate a large class of functions with a high degree of accuracy [18]. This capability comes from the parallel processing of the information. No prior assumption of the model form is required in the model building process. Instead, the network structure is mainly determined by the features of the data. The key element of an artificial neural network is an artificial neuron. For a given neuron, there are multiple (
m
+
1
) inputs and one output. The output of the kth neuron is y
k
=
φ
(
∑
j
=
0
m
w
k
j
x
j
), where φ
(
·
) is called the action function.A single hidden layer feed-forward network is the most widely used model form for time series modeling and forecasting [19]. The model is characterized by a network of three layers of simple processing units connected by links, as shown in Figure 1. The output y
t and the inputs (
y
t
-
1
,
…
,
y
t
-
T
) have the following relationship:
(2)
y
t
=
w
0
+
[
∑
j
=
1
q
w
j
·
g
(
w
0
j
+
∑
i
=
1
p
w
i
j
·
y
t
-
i
)
]
+
ε
t
,
where w
j and w
i
j
(
i
=
0,1
,
…
,
p
,
j
=
1,2
,
…
,
q
) are parameters often called connection weights, p is the number of input nodes, and q is the number of nodes in the hidden layer. There are several types of activation function. The most widely used activation function for the output layer is the linear function, as a nonlinear activation function may introduce distortion to the predicted output. The logarithmic and hyperbolic functions are often used as the hidden layer transfer function and they are shown in (3) and (4), respectively. Consider
(3)
sig
(
x
)
=
1
1
+
exp
⁡
⁡
(
-
x
)
,
(4)
tanh
(
x
)
=
1
-
exp
⁡
⁡
(
-
2
x
)
1
+
exp
⁡
⁡
(
-
2
x
)
.Figure 1
Structure of the three layers of a neural network.Hence, the neural network model of (2) acts as a nonlinear function mapping from past observations to the future value y
t. The function can be represented as
(5)
y
t
=
f
(
y
t
-
1
,
…
,
y
t
-
T
,
w
)
+
ε
t
,
where w is a vector and f
(
·
) is the mapping function that we want to find.The function learning process uses a back propagation training algorithm [20] to minimize the errors E between the output results and the desired results. This minimization is done by adjusting the parameters w
i
j of the neural network by an amount Δ
w
i
j according to the following formula:
(6)
Δ
w
i
j
=
-
η
∂
E
∂
w
i
j
.Finally, the estimated model is evaluated using a separate hold-out sample that has not been exposed to the training process.


## 3.1. Hodrick-Prescott Filter Model

The H-P filter [17] decomposes time series data into trend and cyclical components: Y
t
=
Y
t
T
+
Y
t
C, t
=
1,2
,
…
,
T, where Y
t
T and Y
t
C are the trend and cyclical components, respectively. This decomposition assumes that the trend component does not contain any seasonality and, because the cycle is derived residually, it does not separate out the cycle from any irregular movements. Hodrick and Prescott [17] minimize the variance of Y
t
C, subject to a penalty for variations in the second difference of the growth term. Their filter is given by
(1)
min
⁡
Y
t
T
{
∑
t
=
1
T
(
Y
t
-
Y
t
T
)
2
+
λ
∑
t
=
2
T
-
1
[
(
Y
t
+
1
T
-
Y
t
T
)
-
(
Y
t
T
-
Y
t
-
1
T
)
]
2
}
.The parameterλ controls the smoothness of Y
t
C. The minimization of (1) provides a mapping from Y
t to Y
t
T, with Y
t
C determined residually. The estimate of potential output using the H-P filter depends on the choice of λ, the smoothing parameter. A λ of zero corresponds to an extreme real business cycle model where all of the fluctuations in real output are caused by technology shocks, because the H-P trend is the same as the series being detrended. Conversely, as λ tends to infinity, the H-P trend moves towards a deterministic time trend. Following Hodrick and Prescott, researchers typically set λ at 1600 for use with quarterly data [17] but test the robustness of their results with different values.


## 3.2. Principles of Neural Networks

Artificial neural networks (ANN) are popular models for studying nonlinear relationship functions. One of the most significant advantages of an ANN model is that it can approximate a large class of functions with a high degree of accuracy [18]. This capability comes from the parallel processing of the information. No prior assumption of the model form is required in the model building process. Instead, the network structure is mainly determined by the features of the data. The key element of an artificial neural network is an artificial neuron. For a given neuron, there are multiple (
m
+
1
) inputs and one output. The output of the kth neuron is y
k
=
φ
(
∑
j
=
0
m
w
k
j
x
j
), where φ
(
·
) is called the action function.A single hidden layer feed-forward network is the most widely used model form for time series modeling and forecasting [19]. The model is characterized by a network of three layers of simple processing units connected by links, as shown in Figure 1. The output y
t and the inputs (
y
t
-
1
,
…
,
y
t
-
T
) have the following relationship:
(2)
y
t
=
w
0
+
[
∑
j
=
1
q
w
j
·
g
(
w
0
j
+
∑
i
=
1
p
w
i
j
·
y
t
-
i
)
]
+
ε
t
,
where w
j and w
i
j
(
i
=
0,1
,
…
,
p
,
j
=
1,2
,
…
,
q
) are parameters often called connection weights, p is the number of input nodes, and q is the number of nodes in the hidden layer. There are several types of activation function. The most widely used activation function for the output layer is the linear function, as a nonlinear activation function may introduce distortion to the predicted output. The logarithmic and hyperbolic functions are often used as the hidden layer transfer function and they are shown in (3) and (4), respectively. Consider
(3)
sig
(
x
)
=
1
1
+
exp
⁡
⁡
(
-
x
)
,
(4)
tanh
(
x
)
=
1
-
exp
⁡
⁡
(
-
2
x
)
1
+
exp
⁡
⁡
(
-
2
x
)
.Figure 1
Structure of the three layers of a neural network.Hence, the neural network model of (2) acts as a nonlinear function mapping from past observations to the future value y
t. The function can be represented as
(5)
y
t
=
f
(
y
t
-
1
,
…
,
y
t
-
T
,
w
)
+
ε
t
,
where w is a vector and f
(
·
) is the mapping function that we want to find.The function learning process uses a back propagation training algorithm [20] to minimize the errors E between the output results and the desired results. This minimization is done by adjusting the parameters w
i
j of the neural network by an amount Δ
w
i
j according to the following formula:
(6)
Δ
w
i
j
=
-
η
∂
E
∂
w
i
j
.Finally, the estimated model is evaluated using a separate hold-out sample that has not been exposed to the training process.


## 4. Model of H-P Filter Based Hybrid Neural Network

In this section, we will introduce the proposed forecasting model. The whole system framework will be presented first. Then, the model formulation will be given. Finally, we will discuss the workflow of our forecasting scheme.


### 4.1. Framework of the Proposed Approach

The module description of our proposed time series data forecast framework is presented in Figure2. As shown in Figure 2, the proposed approach includes three main stages: data preprocessing, data forecasting, and data merge.Figure 2
Framework of the proposed forecasting approach.In the first stage, the time series price data are passed through the H-P filter. Trend and cyclical components are generated. This decomposition allows us to model the trend and the cyclical fluctuations of the time series separately and more accurately. As the H-P filter is a linear filter, we can merge these two components after forecasting. It must be noted that the trend and the cyclical components are separately learned by ANNT and ANNC. Then, in the next stage, we select suitable features to be applied to the ANN models and forecast each component individually. In the third stage, we use a linear function to merge the two components together as the original data series forecasting result.


### 4.2. Hybrid Model Formulation

The behavior of vegetable prices may not easily be captured by stand-alone models because the price time series data could include a variety of characteristics such as seasonality, heteroskedasticity, or a non-Gaussian error. Our hybrid model aims to reduce the dimension of the raw data. As the raw data contains multidimensional variables, we need to find a more complex function to fit the data. The artificial neural network needs to have more nodes and more layers to learn the complex function. This also requires more time to train the ANN, which will increase the risk of failure and make the results less accurate. After we have reduced the dimension of the raw data, the artificial neural networks are easier to train and the predictive performance will be improved in the combined models.Based on Box’s [21] work in linear modeling, time series data are considered as a nonlinear function of several past observations and random errors as follows:
(7)
y
t
=
f
[
(
y
t
-
1
,
y
t
-
2
,
…
,
y
t
-
m
)
,
(
e
t
-
1
,
e
t
-
2
,
…
,
e
t
-
n
)
]
,
where f
(
·
) is a nonlinear function learned by the neural network, the noise e
t is the residual at time t, and m and n are integers. Suppose the time series f
(
t
) is composed of a trend and a cyclical component:
(8)
Y
t
=
f
(
t
)
=
Y
t
T
+
Y
t
C
=
f
T
(
t
)
+
f
C
(
t
)
,
where f
T and f
C are the trend and the cyclical components. The H-P filter separates the function f
(
·
) into f
T and f
C. This is the first stage shown in Figure 2. In the second stage, two neural networks are used in order to model the nonlinear relationships f
T and f
C. Consider
(9)
Y
t
T
=
f
T
[
(
y
t
-
1
,
y
t
-
2
,
…
,
y
t
-
m
)
,
(
e
t
-
1
,
e
t
-
2
,
…
,
e
t
-
n
)
]
,
Y
t
C
=
f
C
[
(
y
t
-
1
,
y
t
-
2
,
…
,
y
t
-
m
)
,
(
e
t
-
1
,
e
t
-
2
,
…
,
e
t
-
n
)
]
.As we can see from (9), we still use the original data as the inputs for the two neural networks, and the output result is the trend value and the cyclical value. Then, in the forecasting process, we use the following function to compute the future data:
(10)
Y
t
+
1
=
f
T
(
t
+
1
)
+
f
C
(
t
+
1
)
=
f
T
[
(
y
t
,
y
t
-
1
,
…
,
y
t
-
m
+
1
)
,
(
e
t
,
e
t
,
…
,
e
t
-
n
+
1
)
]
+
f
C
[
(
y
t
,
y
t
,
…
,
y
t
-
m
+
1
)
,
(
e
t
,
e
t
,
…
,
e
t
-
n
+
1
)
]
.


### 4.3. Forecasting Scheme

The overall flowchart of the proposed H-P filter based neural network forecasting is shown in Figure3. The proposed training scheme is briefly described in the following steps.Figure 3
The overall flowchart of the proposed forecasting approach.Step 1.
Prepare the raw data of the vegetable price time seriesY
t and compute the cycle T of the time series data using Fourier transform.Step 2.
Preprocess the raw price data using the H-P filter and generate two series of data:Y
t
T and Y
t
C.Step 3.
According to the time series data cycleT, build the training set for the neural network.Step 4.
Use the heuristic algorithm to select the optimal number of neurons in the hidden layers of ANNT and ANNC and initialize the parameters of each neural network.Step 5.
Use the back propagation algorithm to train the neural network.Step 6.
Repeat Steps4 and 5 until the best fitness value satisfies the minimum requirement, or the given count of total generations is reached.The proposed forecasting scheme is briefly described in the following steps.Step 1.
Select the latest data within a cycle as the input data.Step 2.
Preprocess these data using the H-P filter.Step 3.
Use the trained ANNT and ANNC to forecast the price at the next date.Step 4.
Combine the results of the two networks as the final forecast price value.


## 4.1. Framework of the Proposed Approach

The module description of our proposed time series data forecast framework is presented in Figure2. As shown in Figure 2, the proposed approach includes three main stages: data preprocessing, data forecasting, and data merge.Figure 2
Framework of the proposed forecasting approach.In the first stage, the time series price data are passed through the H-P filter. Trend and cyclical components are generated. This decomposition allows us to model the trend and the cyclical fluctuations of the time series separately and more accurately. As the H-P filter is a linear filter, we can merge these two components after forecasting. It must be noted that the trend and the cyclical components are separately learned by ANNT and ANNC. Then, in the next stage, we select suitable features to be applied to the ANN models and forecast each component individually. In the third stage, we use a linear function to merge the two components together as the original data series forecasting result.


## 4.2. Hybrid Model Formulation

The behavior of vegetable prices may not easily be captured by stand-alone models because the price time series data could include a variety of characteristics such as seasonality, heteroskedasticity, or a non-Gaussian error. Our hybrid model aims to reduce the dimension of the raw data. As the raw data contains multidimensional variables, we need to find a more complex function to fit the data. The artificial neural network needs to have more nodes and more layers to learn the complex function. This also requires more time to train the ANN, which will increase the risk of failure and make the results less accurate. After we have reduced the dimension of the raw data, the artificial neural networks are easier to train and the predictive performance will be improved in the combined models.Based on Box’s [21] work in linear modeling, time series data are considered as a nonlinear function of several past observations and random errors as follows:
(7)
y
t
=
f
[
(
y
t
-
1
,
y
t
-
2
,
…
,
y
t
-
m
)
,
(
e
t
-
1
,
e
t
-
2
,
…
,
e
t
-
n
)
]
,
where f
(
·
) is a nonlinear function learned by the neural network, the noise e
t is the residual at time t, and m and n are integers. Suppose the time series f
(
t
) is composed of a trend and a cyclical component:
(8)
Y
t
=
f
(
t
)
=
Y
t
T
+
Y
t
C
=
f
T
(
t
)
+
f
C
(
t
)
,
where f
T and f
C are the trend and the cyclical components. The H-P filter separates the function f
(
·
) into f
T and f
C. This is the first stage shown in Figure 2. In the second stage, two neural networks are used in order to model the nonlinear relationships f
T and f
C. Consider
(9)
Y
t
T
=
f
T
[
(
y
t
-
1
,
y
t
-
2
,
…
,
y
t
-
m
)
,
(
e
t
-
1
,
e
t
-
2
,
…
,
e
t
-
n
)
]
,
Y
t
C
=
f
C
[
(
y
t
-
1
,
y
t
-
2
,
…
,
y
t
-
m
)
,
(
e
t
-
1
,
e
t
-
2
,
…
,
e
t
-
n
)
]
.As we can see from (9), we still use the original data as the inputs for the two neural networks, and the output result is the trend value and the cyclical value. Then, in the forecasting process, we use the following function to compute the future data:
(10)
Y
t
+
1
=
f
T
(
t
+
1
)
+
f
C
(
t
+
1
)
=
f
T
[
(
y
t
,
y
t
-
1
,
…
,
y
t
-
m
+
1
)
,
(
e
t
,
e
t
,
…
,
e
t
-
n
+
1
)
]
+
f
C
[
(
y
t
,
y
t
,
…
,
y
t
-
m
+
1
)
,
(
e
t
,
e
t
,
…
,
e
t
-
n
+
1
)
]
.


## 4.3. Forecasting Scheme

The overall flowchart of the proposed H-P filter based neural network forecasting is shown in Figure3. The proposed training scheme is briefly described in the following steps.Figure 3
The overall flowchart of the proposed forecasting approach.Step 1.
Prepare the raw data of the vegetable price time seriesY
t and compute the cycle T of the time series data using Fourier transform.Step 2.
Preprocess the raw price data using the H-P filter and generate two series of data:Y
t
T and Y
t
C.Step 3.
According to the time series data cycleT, build the training set for the neural network.Step 4.
Use the heuristic algorithm to select the optimal number of neurons in the hidden layers of ANNT and ANNC and initialize the parameters of each neural network.Step 5.
Use the back propagation algorithm to train the neural network.Step 6.
Repeat Steps4 and 5 until the best fitness value satisfies the minimum requirement, or the given count of total generations is reached.The proposed forecasting scheme is briefly described in the following steps.Step 1.
Select the latest data within a cycle as the input data.Step 2.
Preprocess these data using the H-P filter.Step 3.
Use the trained ANNT and ANNC to forecast the price at the next date.Step 4.
Combine the results of the two networks as the final forecast price value.


## 5. Experimental Results

In this section, we will use two popular forecasting models to compare with our proposed method. These time series come from the monthly price data for five types of vegetable from 2012 to 2013. We randomly choose the price data for one cycle as the testing dataset and the remaining data as the training dataset. All the experiments are done using Matlab R2013b in the Windows 7 platform. We choose the neural network function in the Matlab toolbox [22]. Now, we study the characteristics of the prices of those five kinds of vegetable.


### 5.1. Study of Vegetable Price Data

We choose the prices of five types of vegetable: cabbages, peppers, cucumbers, green beans, and tomatoes. The price trends of the five types of vegetable are shown in Figure4. As we can see from Figure 4, the price series data have a significant cyclical character. This cycle is mainly influenced by the seasonality of agricultural production. We can also note that there is a growth trend in this series data. This is mainly due to the effects of inflation.Figure 4
Price trends of the five types of vegetable from 2012/01/01 to 2013/03/01.In Table1, we illustrate the price characteristics for the five types of vegetable. They have very similar cycles as they have annual changes. The prices of peppers and green beans have a higher variance than the other prices. It can be seen from Figure 4 that the prices of those two vegetables have relatively larger fluctuations than the prices of the others.Table 1
The price characteristics of the five types of vegetable.
Price type
Cycle (month)
Variance
Cabbages
11.24
0.2916
Peppers
11.25
2.8361
Cucumbers
11.25
1.8933
Green beans
11.25
3.9992
Tomatoes
11.25
1.5610


### 5.2. Experiment Modeling

We implement two traditional forecasting models ARIMA and ANN to compare with the proposed model.


#### 5.2.1. ARIMA Modeling

In the present study, several trials were carried out to choose the optimal ARIMA model parameters. The model parameters that satisfy the statistical residual diagnostic checking were chosen for the ARIMA forecasting model. In an ARIMA(
p
,
d
,
q
) model, the future value of a variable is assumed to be a linear function of the past observations and random errors; that is, the underlying process that generates the time series with the mean has the form
(11)
ϕ
(
B
)
∇
d
(
y
t
-
μ
)
=
θ
(
B
)
a
t
,
where y
t and a
t are the actual value and random error at time period t.The Box [21] methodology includes three iterative steps: model identification, parameter estimation, and diagnostic checking. The basic idea of model identification is that if a time series is generated from an ARIMA process, it should have theoretical autocorrelation properties. Box [21] proposed the use of the autocorrelation function (ACF) and the partial autocorrelation function (PACF) of the sample data as the basic tools for identifying the order of the ARIMA model. Based on the ARIMA model, we build five ARIMA models, to forecast the price of each of the five types of vegetable. The five ARIMA models are Cabbage ARIMA (2, 1, 5)(1, 1, 1)12, Pepper ARIMA (2, 1, 2)(1, 1, 1)12, Cucumber ARIMA (1, 1, 1)(1, 1, 1)12, Green bean ARIMA (2, 1, 1)(1, 1, 1)12, and Tomatoes ARIMA (1, 1, 1)(1, 1, 1)12.From Tables2, 3, 4, 5, and 6, we can see that the ARIMA models can basically predict the results. However, we need to calculate the different parameters each time for each model, and it is difficult to find an easy way to get the parameters. The artificial neural network is easier to use because we just need to determine the number of layers.Table 2
Cabbage ARIMA (2, 1, 5)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
1.52
1.44
2012-07
2.18
2.48
2012-02
1.65
1.5
2012-08
2.40
3.05
2012-03
1.85
2
2012-09
2.41
2.57
2012-04
2.31
2.61
2012-10
2.08
1.81
2012-05
2.25
2.82
2012-11
1.84
1.61
2012-06
2.06
2.52
2012-12
1.85
1.85Table 3
Pepper ARIMA (2, 1, 2)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
9.84
7.10
2012-07
4.25
4.02
2012-02
7.95
7.57
2012-08
4.16
4.09
2012-03
9.57
7.78
2012-09
4.26
4.40
2012-04
7.96
7.20
2012-10
4.13
4.84
2012-05
6.56
5.74
2012-11
4.39
5.32
2012-06
4.75
4.43
2012-12
5.67
6.12Table 4
Cucumber ARIMA (1, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
8.17
6.08
2012-07
3.11
2.89
2012-02
6.35
6.32
2012-08
3.8
3.39
2012-03
6.21
5.74
2012-09
3.43
3.62
2012-04
5.04
4.71
2012-10
3.44
3.96
2012-05
3.56
3.68
2012-11
4.38
4.67
2012-06
2.71
2.84
2012-12
5.69
5.56Table 5
Green bean ARIMA (2, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
9.95
8.65
2012-07
4.78
5.10
2012-02
9.3
9.18
2012-08
5.6
5.63
2012-03
10.12
9.64
2012-09
5.58
6.06
2012-04
9.2
8.56
2012-10
5.19
6.26
2012-05
6.29
7.12
2012-11
6.96
7.06
2012-06
4.64
5.097
2012-12
8.13
8.05Table 6
Tomato ARIMA (1, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
5.82
5.26
2012-07
3.75
3.36
2012-02
5.92
5.48
2012-08
4.61
3.65
2012-03
6.42
5.28
2012-09
5
3.95
2012-04
6.69
5.15
2012-10
4.41
4.31
2012-05
5.17
4.42
2012-11
4.75
4.58
2012-06
3.78
3.49
2012-12
5.46
4.90


#### 5.2.2. Neural Network Modeling

A three-layer feed-forward neural network model was developed for the prediction of the price series data using an optimized back propagation training algorithm. In the present study, the scaled conjugated gradient algorithm was selected as the optimized training method. The network structure is shown in Figure1. We choose 12 neural nodes for the input data and 8 nodes in the hidden layer. The output has one node with the “purelin” function. In what follows, artificial neural network model performances were validated for flow prediction under a monthly time-step condition. The forecast results are shown in Figures 5(a), 5(b), 5(c), 5(d), and 5(e) for the prices of the five different types of vegetable for one season.Regression of the predictive data using ANN.
(a)
Cabbage price prediction using ANN
(b)
Pepper price prediction using ANN
(c)
Cucumber price prediction using ANN
(d)
Green bean price prediction using ANN
(e)
Tomato price prediction using ANNFrom Figure5, we can see that the dashed lines are very close to the solid lines. This means that our ANN model can successfully learn the patterns of the time series price data and predict the future results. The neural network is more robust than the ARIMA model, because it does not need us to analyze the characteristics of the original data and find suitable parameters. ANN is easier to use and has similar accuracy.


#### 5.2.3. Hybrid Modeling

Our proposed model uses the same data from the previous 12 months as the testing dataset. First, we need to extract the trend and cyclical components. Figure6 is an example for the pepper price data after using an H-P filter. We use the decomposed data as the training datasets. The forecast results are shown in Figures 7(a), 7(b), 7(c), 7(d), and 7(e).Figure 6
Example of H-P filter results.Regression of the proposed predictive data and real data.
(a)
Cabbage price prediction using the proposed model
(b)
Pepper price prediction using the proposed model
(c)
Cucumber price prediction using the proposed model
(d)
Green bean price prediction using the proposed model
(e)
Tomato price prediction using the proposed modelThe neural network uses the same structure as we used in Section5.2.2. As the cycle of the price data is 12 months, we use the latest 12 months’ data as the input datasets. The input training dataset is illustrated in (12). The left column is the label data, which are the prices for the latest 12 months. The 12 columns on the right are the historical data, which are used as the 12 input values for the neural networks. Consider
(12)
[
y
13
y
14
y
15
…
y
n
︸
label
y
12
…
y
1
y
0
y
13
…
y
2
y
1
y
14
…
y
3
y
2
…
…
…
…
y
n
-
1
…
y
n
-
11
y
n
-
12
︸
input
]
.Figure7 shows a cycle’s real data and the predicted results. We can see that the proposed method has good performance in learning the trend and cyclical patterns of the original data. The forecasting results are more accurate than the traditional results. The performance comparison is presented in the next section.


### 5.3. Model Verification and Comparison

To illustrate the accuracy of the method, two different forecast consistency measures are used for the different types of vegetables. The root mean squared error (RMSE, (13)) is used as the error criterion; it is the ratio of the root mean squared error to the variance of the time series. The mean absolute error (MAE, (14)) is also employed as a performance indicator. The RMSE and the MAE are defined as follows:
(13)
RMSE
=
1
N
∑
t
=
1
N
(
x
t
-
x
^
t
)
2
,
(14)
MAE
=
1
N
∑
t
=
1
N
|
x
t
-
x
^
t
|
.Table7 contains a statistical analysis of the performance of the three forecasting models. We can see that our proposed model has the best performance in predicting the future prices for the vegetables. The ARIMA model is unstable for different kinds of time series data. It did well for price data for cabbage but worse for the data for the price of peppers. This is because we did not find the best parameters for the ARIMA model. Our proposed model is more stable when handling different kinds of time series data. The ANN model has a middling performance.Table 7
A comparison of the accuracy of the three methods in forecasting the prices of the five vegetables.
Model
Cabbages
Peppers
Cucumbers
Green beans
Tomatoes
RMSE
MAE
RMSE
MAE
RMSE
MAE
RMSE
MAE
RMSE
MAE
Autoregressive integrated moving average (ARIMA)
0.33
0.11
1.07
1.15
0.66
0.44
0.62
0.39
0.77
0.6
Artificial neural networks (ANN)
0.24
0.21
0.88
0.67
1.12
0.90
0.73
0.55
0.89
0.79
Proposed model
0.19
0.15
0.79
0.37
0.51
0.34
0.46
0.38
0.42
0.37


## 5.1. Study of Vegetable Price Data

We choose the prices of five types of vegetable: cabbages, peppers, cucumbers, green beans, and tomatoes. The price trends of the five types of vegetable are shown in Figure4. As we can see from Figure 4, the price series data have a significant cyclical character. This cycle is mainly influenced by the seasonality of agricultural production. We can also note that there is a growth trend in this series data. This is mainly due to the effects of inflation.Figure 4
Price trends of the five types of vegetable from 2012/01/01 to 2013/03/01.In Table1, we illustrate the price characteristics for the five types of vegetable. They have very similar cycles as they have annual changes. The prices of peppers and green beans have a higher variance than the other prices. It can be seen from Figure 4 that the prices of those two vegetables have relatively larger fluctuations than the prices of the others.Table 1
The price characteristics of the five types of vegetable.
Price type
Cycle (month)
Variance
Cabbages
11.24
0.2916
Peppers
11.25
2.8361
Cucumbers
11.25
1.8933
Green beans
11.25
3.9992
Tomatoes
11.25
1.5610


## 5.2. Experiment Modeling

We implement two traditional forecasting models ARIMA and ANN to compare with the proposed model.


### 5.2.1. ARIMA Modeling

In the present study, several trials were carried out to choose the optimal ARIMA model parameters. The model parameters that satisfy the statistical residual diagnostic checking were chosen for the ARIMA forecasting model. In an ARIMA(
p
,
d
,
q
) model, the future value of a variable is assumed to be a linear function of the past observations and random errors; that is, the underlying process that generates the time series with the mean has the form
(11)
ϕ
(
B
)
∇
d
(
y
t
-
μ
)
=
θ
(
B
)
a
t
,
where y
t and a
t are the actual value and random error at time period t.The Box [21] methodology includes three iterative steps: model identification, parameter estimation, and diagnostic checking. The basic idea of model identification is that if a time series is generated from an ARIMA process, it should have theoretical autocorrelation properties. Box [21] proposed the use of the autocorrelation function (ACF) and the partial autocorrelation function (PACF) of the sample data as the basic tools for identifying the order of the ARIMA model. Based on the ARIMA model, we build five ARIMA models, to forecast the price of each of the five types of vegetable. The five ARIMA models are Cabbage ARIMA (2, 1, 5)(1, 1, 1)12, Pepper ARIMA (2, 1, 2)(1, 1, 1)12, Cucumber ARIMA (1, 1, 1)(1, 1, 1)12, Green bean ARIMA (2, 1, 1)(1, 1, 1)12, and Tomatoes ARIMA (1, 1, 1)(1, 1, 1)12.From Tables2, 3, 4, 5, and 6, we can see that the ARIMA models can basically predict the results. However, we need to calculate the different parameters each time for each model, and it is difficult to find an easy way to get the parameters. The artificial neural network is easier to use because we just need to determine the number of layers.Table 2
Cabbage ARIMA (2, 1, 5)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
1.52
1.44
2012-07
2.18
2.48
2012-02
1.65
1.5
2012-08
2.40
3.05
2012-03
1.85
2
2012-09
2.41
2.57
2012-04
2.31
2.61
2012-10
2.08
1.81
2012-05
2.25
2.82
2012-11
1.84
1.61
2012-06
2.06
2.52
2012-12
1.85
1.85Table 3
Pepper ARIMA (2, 1, 2)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
9.84
7.10
2012-07
4.25
4.02
2012-02
7.95
7.57
2012-08
4.16
4.09
2012-03
9.57
7.78
2012-09
4.26
4.40
2012-04
7.96
7.20
2012-10
4.13
4.84
2012-05
6.56
5.74
2012-11
4.39
5.32
2012-06
4.75
4.43
2012-12
5.67
6.12Table 4
Cucumber ARIMA (1, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
8.17
6.08
2012-07
3.11
2.89
2012-02
6.35
6.32
2012-08
3.8
3.39
2012-03
6.21
5.74
2012-09
3.43
3.62
2012-04
5.04
4.71
2012-10
3.44
3.96
2012-05
3.56
3.68
2012-11
4.38
4.67
2012-06
2.71
2.84
2012-12
5.69
5.56Table 5
Green bean ARIMA (2, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
9.95
8.65
2012-07
4.78
5.10
2012-02
9.3
9.18
2012-08
5.6
5.63
2012-03
10.12
9.64
2012-09
5.58
6.06
2012-04
9.2
8.56
2012-10
5.19
6.26
2012-05
6.29
7.12
2012-11
6.96
7.06
2012-06
4.64
5.097
2012-12
8.13
8.05Table 6
Tomato ARIMA (1, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
5.82
5.26
2012-07
3.75
3.36
2012-02
5.92
5.48
2012-08
4.61
3.65
2012-03
6.42
5.28
2012-09
5
3.95
2012-04
6.69
5.15
2012-10
4.41
4.31
2012-05
5.17
4.42
2012-11
4.75
4.58
2012-06
3.78
3.49
2012-12
5.46
4.90


### 5.2.2. Neural Network Modeling

A three-layer feed-forward neural network model was developed for the prediction of the price series data using an optimized back propagation training algorithm. In the present study, the scaled conjugated gradient algorithm was selected as the optimized training method. The network structure is shown in Figure1. We choose 12 neural nodes for the input data and 8 nodes in the hidden layer. The output has one node with the “purelin” function. In what follows, artificial neural network model performances were validated for flow prediction under a monthly time-step condition. The forecast results are shown in Figures 5(a), 5(b), 5(c), 5(d), and 5(e) for the prices of the five different types of vegetable for one season.Regression of the predictive data using ANN.
(a)
Cabbage price prediction using ANN
(b)
Pepper price prediction using ANN
(c)
Cucumber price prediction using ANN
(d)
Green bean price prediction using ANN
(e)
Tomato price prediction using ANNFrom Figure5, we can see that the dashed lines are very close to the solid lines. This means that our ANN model can successfully learn the patterns of the time series price data and predict the future results. The neural network is more robust than the ARIMA model, because it does not need us to analyze the characteristics of the original data and find suitable parameters. ANN is easier to use and has similar accuracy.


### 5.2.3. Hybrid Modeling

Our proposed model uses the same data from the previous 12 months as the testing dataset. First, we need to extract the trend and cyclical components. Figure6 is an example for the pepper price data after using an H-P filter. We use the decomposed data as the training datasets. The forecast results are shown in Figures 7(a), 7(b), 7(c), 7(d), and 7(e).Figure 6
Example of H-P filter results.Regression of the proposed predictive data and real data.
(a)
Cabbage price prediction using the proposed model
(b)
Pepper price prediction using the proposed model
(c)
Cucumber price prediction using the proposed model
(d)
Green bean price prediction using the proposed model
(e)
Tomato price prediction using the proposed modelThe neural network uses the same structure as we used in Section5.2.2. As the cycle of the price data is 12 months, we use the latest 12 months’ data as the input datasets. The input training dataset is illustrated in (12). The left column is the label data, which are the prices for the latest 12 months. The 12 columns on the right are the historical data, which are used as the 12 input values for the neural networks. Consider
(12)
[
y
13
y
14
y
15
…
y
n
︸
label
y
12
…
y
1
y
0
y
13
…
y
2
y
1
y
14
…
y
3
y
2
…
…
…
…
y
n
-
1
…
y
n
-
11
y
n
-
12
︸
input
]
.Figure7 shows a cycle’s real data and the predicted results. We can see that the proposed method has good performance in learning the trend and cyclical patterns of the original data. The forecasting results are more accurate than the traditional results. The performance comparison is presented in the next section.


## 5.2.1. ARIMA Modeling

In the present study, several trials were carried out to choose the optimal ARIMA model parameters. The model parameters that satisfy the statistical residual diagnostic checking were chosen for the ARIMA forecasting model. In an ARIMA(
p
,
d
,
q
) model, the future value of a variable is assumed to be a linear function of the past observations and random errors; that is, the underlying process that generates the time series with the mean has the form
(11)
ϕ
(
B
)
∇
d
(
y
t
-
μ
)
=
θ
(
B
)
a
t
,
where y
t and a
t are the actual value and random error at time period t.The Box [21] methodology includes three iterative steps: model identification, parameter estimation, and diagnostic checking. The basic idea of model identification is that if a time series is generated from an ARIMA process, it should have theoretical autocorrelation properties. Box [21] proposed the use of the autocorrelation function (ACF) and the partial autocorrelation function (PACF) of the sample data as the basic tools for identifying the order of the ARIMA model. Based on the ARIMA model, we build five ARIMA models, to forecast the price of each of the five types of vegetable. The five ARIMA models are Cabbage ARIMA (2, 1, 5)(1, 1, 1)12, Pepper ARIMA (2, 1, 2)(1, 1, 1)12, Cucumber ARIMA (1, 1, 1)(1, 1, 1)12, Green bean ARIMA (2, 1, 1)(1, 1, 1)12, and Tomatoes ARIMA (1, 1, 1)(1, 1, 1)12.From Tables2, 3, 4, 5, and 6, we can see that the ARIMA models can basically predict the results. However, we need to calculate the different parameters each time for each model, and it is difficult to find an easy way to get the parameters. The artificial neural network is easier to use because we just need to determine the number of layers.Table 2
Cabbage ARIMA (2, 1, 5)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
1.52
1.44
2012-07
2.18
2.48
2012-02
1.65
1.5
2012-08
2.40
3.05
2012-03
1.85
2
2012-09
2.41
2.57
2012-04
2.31
2.61
2012-10
2.08
1.81
2012-05
2.25
2.82
2012-11
1.84
1.61
2012-06
2.06
2.52
2012-12
1.85
1.85Table 3
Pepper ARIMA (2, 1, 2)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
9.84
7.10
2012-07
4.25
4.02
2012-02
7.95
7.57
2012-08
4.16
4.09
2012-03
9.57
7.78
2012-09
4.26
4.40
2012-04
7.96
7.20
2012-10
4.13
4.84
2012-05
6.56
5.74
2012-11
4.39
5.32
2012-06
4.75
4.43
2012-12
5.67
6.12Table 4
Cucumber ARIMA (1, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
8.17
6.08
2012-07
3.11
2.89
2012-02
6.35
6.32
2012-08
3.8
3.39
2012-03
6.21
5.74
2012-09
3.43
3.62
2012-04
5.04
4.71
2012-10
3.44
3.96
2012-05
3.56
3.68
2012-11
4.38
4.67
2012-06
2.71
2.84
2012-12
5.69
5.56Table 5
Green bean ARIMA (2, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
9.95
8.65
2012-07
4.78
5.10
2012-02
9.3
9.18
2012-08
5.6
5.63
2012-03
10.12
9.64
2012-09
5.58
6.06
2012-04
9.2
8.56
2012-10
5.19
6.26
2012-05
6.29
7.12
2012-11
6.96
7.06
2012-06
4.64
5.097
2012-12
8.13
8.05Table 6
Tomato ARIMA (1, 1, 1)(1, 1, 1)12 model predictions contrast (unit: RMB/kg).
Date
Observation
Forecast
Date
Observation
Forecast
2012-01
5.82
5.26
2012-07
3.75
3.36
2012-02
5.92
5.48
2012-08
4.61
3.65
2012-03
6.42
5.28
2012-09
5
3.95
2012-04
6.69
5.15
2012-10
4.41
4.31
2012-05
5.17
4.42
2012-11
4.75
4.58
2012-06
3.78
3.49
2012-12
5.46
4.90


## 5.2.2. Neural Network Modeling

A three-layer feed-forward neural network model was developed for the prediction of the price series data using an optimized back propagation training algorithm. In the present study, the scaled conjugated gradient algorithm was selected as the optimized training method. The network structure is shown in Figure1. We choose 12 neural nodes for the input data and 8 nodes in the hidden layer. The output has one node with the “purelin” function. In what follows, artificial neural network model performances were validated for flow prediction under a monthly time-step condition. The forecast results are shown in Figures 5(a), 5(b), 5(c), 5(d), and 5(e) for the prices of the five different types of vegetable for one season.Regression of the predictive data using ANN.
(a)
Cabbage price prediction using ANN
(b)
Pepper price prediction using ANN
(c)
Cucumber price prediction using ANN
(d)
Green bean price prediction using ANN
(e)
Tomato price prediction using ANNFrom Figure5, we can see that the dashed lines are very close to the solid lines. This means that our ANN model can successfully learn the patterns of the time series price data and predict the future results. The neural network is more robust than the ARIMA model, because it does not need us to analyze the characteristics of the original data and find suitable parameters. ANN is easier to use and has similar accuracy.


## 5.2.3. Hybrid Modeling

Our proposed model uses the same data from the previous 12 months as the testing dataset. First, we need to extract the trend and cyclical components. Figure6 is an example for the pepper price data after using an H-P filter. We use the decomposed data as the training datasets. The forecast results are shown in Figures 7(a), 7(b), 7(c), 7(d), and 7(e).Figure 6
Example of H-P filter results.Regression of the proposed predictive data and real data.
(a)
Cabbage price prediction using the proposed model
(b)
Pepper price prediction using the proposed model
(c)
Cucumber price prediction using the proposed model
(d)
Green bean price prediction using the proposed model
(e)
Tomato price prediction using the proposed modelThe neural network uses the same structure as we used in Section5.2.2. As the cycle of the price data is 12 months, we use the latest 12 months’ data as the input datasets. The input training dataset is illustrated in (12). The left column is the label data, which are the prices for the latest 12 months. The 12 columns on the right are the historical data, which are used as the 12 input values for the neural networks. Consider
(12)
[
y
13
y
14
y
15
…
y
n
︸
label
y
12
…
y
1
y
0
y
13
…
y
2
y
1
y
14
…
y
3
y
2
…
…
…
…
y
n
-
1
…
y
n
-
11
y
n
-
12
︸
input
]
.Figure7 shows a cycle’s real data and the predicted results. We can see that the proposed method has good performance in learning the trend and cyclical patterns of the original data. The forecasting results are more accurate than the traditional results. The performance comparison is presented in the next section.


## 5.3. Model Verification and Comparison

To illustrate the accuracy of the method, two different forecast consistency measures are used for the different types of vegetables. The root mean squared error (RMSE, (13)) is used as the error criterion; it is the ratio of the root mean squared error to the variance of the time series. The mean absolute error (MAE, (14)) is also employed as a performance indicator. The RMSE and the MAE are defined as follows:
(13)
RMSE
=
1
N
∑
t
=
1
N
(
x
t
-
x
^
t
)
2
,
(14)
MAE
=
1
N
∑
t
=
1
N
|
x
t
-
x
^
t
|
.Table7 contains a statistical analysis of the performance of the three forecasting models. We can see that our proposed model has the best performance in predicting the future prices for the vegetables. The ARIMA model is unstable for different kinds of time series data. It did well for price data for cabbage but worse for the data for the price of peppers. This is because we did not find the best parameters for the ARIMA model. Our proposed model is more stable when handling different kinds of time series data. The ANN model has a middling performance.Table 7
A comparison of the accuracy of the three methods in forecasting the prices of the five vegetables.
Model
Cabbages
Peppers
Cucumbers
Green beans
Tomatoes
RMSE
MAE
RMSE
MAE
RMSE
MAE
RMSE
MAE
RMSE
MAE
Autoregressive integrated moving average (ARIMA)
0.33
0.11
1.07
1.15
0.66
0.44
0.62
0.39
0.77
0.6
Artificial neural networks (ANN)
0.24
0.21
0.88
0.67
1.12
0.90
0.73
0.55
0.89
0.79
Proposed model
0.19
0.15
0.79
0.37
0.51
0.34
0.46
0.38
0.42
0.37


## 6. Conclusion

Time series forecasting is one of the most important quantitative models and has received a considerable amount of attention in the literature. This study presents a novel adaptive approach to extending the artificial neural network model; adaptive metrics of the inputs and a new mechanism for mixing the outputs are proposed for time series prediction. Due to the individual modeling of the trend and cyclical components, the forecasting accuracy is improved. The experimental results generated by a set of consistent performance measures with different metrics (RMSE, MAE) show that this new method can improve the accuracy of time series prediction. The performance of the proposed method is validated by time series data for five sets of vegetables.



---

*Source: 135862-2014-06-23.xml*