• Tidak ada hasil yang ditemukan

Fuzzy Model Translation for Time Series Data in the Extent of Median

N/A
N/A
Protected

Academic year: 2023

Membagikan "Fuzzy Model Translation for Time Series Data in the Extent of Median "

Copied!
12
0
0

Teks penuh

(1)

http://dx.doi.org/10.12988/ams.2014.42114

Fuzzy Model Translation for Time Series Data in the Extent of Median

Error and its Application

Nurhayadi

Department of Mathematics Education, Tadulako University

& Department of Mathematics Gadjah Mada University, Indonesia

Subanar

Department of Mathematics, Gadjah Mada University, Indonesia Abdurakhman

Department of Mathematics, Gadjah Mada University, Indonesia

Agus Maman Abadi

Department of Mathematics Education Yogyakarta State University, Indonesia

Copyright © 2014 Nurhayadi et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract

Many scientists have been studied time series modeling using fuzzy method. Fuzzy method has an advantage in time series modeling because it permits linguistic variable as an input, namely economists’ experiences. This paper discusses model transformation in the extent of median error. Sliding the model in the extent of median error directing to zero is proven to be able to minimize Mean Absolute Error (MAE). Comparison with other methods to predict the enrollment of new students at the University of Alabama, has shown

(2)

that our proposed method can provide the smallest MAE. In the case study of stock price prediction of Bank Mandiri (Persero) Tbk (BMRI.JK), the translation of weighted Takagi Sugeno Kang fuzzy model of zero order can reduce MAE.

Mathematics Subject Classification: 62-07

Keywords: fuzzy model, time series, model translation, stock price prediction.

1. Introduction

Time series analysis is one of the important aspects in applying statistics into daily life, for example in observing price movement (Loh, 2003; Liu et al., 2005). Time series prediction is a modeling based on a data set of the past time series values which is used to predict the future values. The first step in forecasting is generating a modeling using the available data. After the modeling is done, then the future time series values are predicted using a model based on the present and past observations.

The movement of stock price is an interesting thing in economic problems associated with time series. The formation of stock price is due to demand and supply of the stock. Stock price index is an indicator showing the stock price movement. By the index, we can find the movement trend of present stock price.

The movement of indexes describes the market condition at a time and it will become an important indicator for the investors to determine whether they will sell, hold, or buy the stock. However, the behavior of stock price growth shows a high volatility. In fact, volatility in financial market is sensitive to the change of economic variables, such as monetary or fiscal policy, as well as noneconomic variables, such as political instability or even just rumors. The complexity of stock price change makes the researchers interested to be able to predict the movement, and for this purpose, many time series models have been developed.

Some researchers have developed time series modeling using fuzzy method. Selecting fuzzy method for modeling is based on a consideration that fuzzy permits linguistic variable as an input, namely economists’ experiences (Wang, 1997). Song and Chissom (1993b, 1994) studied the use of fuzzy for time series modeling. Cheng et al. (2006) made time series fuzzy model by grouping fuzzy relations based on their antecedents and it had a better result.

The precision of model resulted from fuzzy method has not ever been calculated exactly when the model is generated. The generated estimation model can be relatively higher or lower than the real data. Intuitively, the optimization can be done by model translation.

Agrawal et al. (1995), Argyros et al. (2003) and Kontaki et al. (2005) had ever used translation of time series model to find the similarity of two sub time series. Graphically, this treatment coincides two sub time series using value translation, and the similarity is observed from the amount of two adjacent points at two corresponding sub time series.

(3)

This paper applies the translation to optimize weighted Takagi Sugeno Kang (TSK) fuzzy model of time series data. In order to improve the accuracy, a model translation is applied to fuzzy model of time series data developed by Wang (1997) in which the basis of fuzzy rule is weighted (Yu, 2004 and Nurhayadi et al., 2012). The optimized model obtained here is applied to predict stock price. Section 2 describes briefly the procedures in generating weighted fuzzy model. The model translation is done in Section 3. Section 4 discusses the application of fuzzy model translation to predict various stock prices and Section 5 contains the conclusion of this paper.

2. Weighted Fuzzy Rules

Time series modeling using fuzzy inference maps every sample point in time series into fuzzy set and applies the “if-then” fuzzy rule. Wang (1997), Yu (2004) and Nurhayadi et al. (2012) have explained briefly that the formations of weighted fuzzy rules are as follows:

Step 1. Defining fuzzy set containing input and output spaces.

Given a pair of input-output (ytp, ... ,yt,2, yt1,yt) ∈ [αpp] x … x ]

,

2 β2 x [α11] x [α00] ⊂ Rp+1 , with ytp,..., yt2,yt1 is the input and yt is the output. For every [αii], i = 1, 2, 3, … , p, defined as many as qi

fuzzy sets Aik, k = 1, 2, 3, … , qi a complete in interval [αii], that is for every yt-i∈ [αii], there exists Aik such that ( t i)

Ak y

i

µ ≠ 0, where ( t i)

Ak y

i

µ is membership degree of yti in fuzzy set Aik.

Step 2. Generating the rule of every pair of input-output.

For every pair of input-output (ytp,..., yt2,yt1,yt ), formed if-then fuzzy rule as follows:

If ((yt1 isA1*) and … and (ytpis A*p)) then y)t

=yt where A1* is fuzzy set Aik which has the biggest ( t i)

Ak y

i

µ . Step 3. Grouping fuzzy rules.

Group the rules generated in Step 2 based on the similarAi*. They are the rule’s components in part “if”, and the consequence of yk which is the mean of yt is selected from part “then”.

If ((yt1 isA1k) and … and (ytpis Akp)) then y)t

=yvj j = 1, 2, … , m

m=qiq2…qp Step 4. Constructing basis of fuzzy rule.

Basis of fuzzy rule has to satisfy three conditions below:

(4)

• In the rules generated in Step 2, there is no conflict between one rule and another. It means that the similar antecedents do not happen but the different consequences do.

• The weights of basis elements are obtained from numbers of groups in Step 3.

• Experiences of experts can be included into the basis of fuzzy rules.

Step 5. Developing fuzzy system based on the basis of fuzzy rules.

For example, obtain k basis of fuzzy rules. Consider singleton fuzzifier, a multiplication in machine of fuzzy inference, and defuzzifier of center mean, then use a formula below:

∑ ∏

∑ ∏

= =

= =

= m

j

p

i

i A t j

m

j

p

i

i A t j

j t

y w

y y

w y

k i k i

1 1

1 1

) ) ( (

) ) ( (

ˆ

µ µ

(1)

where

yˆ is the value estimation of t yt , wj is the weight of fuzzy rule base, yj is partial constant of part “then”, and

) ( t i

Ak y

i

µ is membership degree of yti in fuzzy set Aik.

3. Fuzzy Model Translation

Almost all methods in generating fuzzy models in time series always involve processes in rounding numbers or number approximation which are done many times. These will affect on model accuracy, so that the optimization using translation will be done to improve it.

Given a collection of time series values y1, y2, … yn and it is predicted using a model. Let the prediction values are

yn

y

1, ˆ2,...., ˆ (2) where

n n

n y e

y e y y e y

1= 1+ 1, ˆ2 = 2+ 2,...., ˆ = + (3) If over estimate prediction points are more than under estimate prediction points, then intuitively, sliding the predictors down will reduce the MAE because distances that decline are more than distances that increase. Furthermore, if a translation is applied to the model in the extent to median error directing to zero, i.e. Yˆ*=Yˆ−e~ , then MAE of predictors will reach the minimum value of translation.

(5)

If there is no eiwhich is similar to e~ , a brief description of this translation is as follows

Figure 1. Realization values of time series and the predictions where all ei≠e~ .

If the amount of time series realization is even, then MAE will be minimum if the number of positive error ei+ is equal to the number of negative error ei.

If there are some ei which are similar to e~ , then MAE will be minimum if e~ = 0.

Figure 2. Realization values of time series and the predictions where some ei = e~ Real values =

Prediction =

Real values = Predictions =

(6)

Theorem 1.

Let Y is a realization of time series, Yˆ is a prediction model, and Yˆ* =Yˆ−e~ where e~is the median error, then MAE (Y ) ≤ MAE (ˆ*),

Proof:

Given positive time series y1, y2, …, yn , the predictions yˆ1,yˆ2,...,yˆn, and ˆ Y e.

Y = +

Generated a model Yˆ* =Yˆ−~e.

For e~ > 0, (4) Error {ei} is partitioned into three sets,

e#1, e#2, … , e#p is positive error where e#j≥ e~ for j = 1, 2, …,p, (5) e+1, e+2, … ,e+q is positive error where 0 < e+k< e~ for k = 1, 2, …,q (6)

e1, e2, … , er is non positive error where ej ≤ 0 for l =1, 2, …,r (7)

then p ≥ q+r (8) and p+q+r = n. (9) Given

= n

i

i

i y

y

1

ˆ*

=

=

n

i

i

i e y

y

1

~) ˆ (

=

=

n +

i

i i

i e e y

y

1

~) (

=

= n

i

i e

e

1

~

=

∑ ∑ ∑

=

= +

=

− +

− +

r

l l q

k k p

j

j e e e e e

e

1 1

1

# ~ ~ ~

=

∑ ∑ ∑

=

=

+

=

− +

− +

r

l l q

k

k p

j

j e e e e e

e

1 1

1

# ~ ~ ~

Based on (4), (5), (6) and (7), e#j ≥ e~> 0, e~> e+k >0 and el ≤ 0<~e, then

=

( ) ( ) ( )

=

=

+

=

+ +

− +

r

l l q

k

k p

j

j e e e e e

e

1 1

1

# ~ ~ ~

=

∑ ∑ ∑

=

= +

=

+ +

− +

r

l l q

k k p

j

j pe qe e e re

e

1 1

1

# ~ ~ ~

= e e e pe qe re

p

j

r

l l q

k k

j ~ ~ ~

1 1 1

# − + − + +

∑ ∑ ∑

= =

= +

(7)

= e e e p q r e

p

j

r

l l q

k k j

)~ (

1 1 1

# − + + − + +

∑ ∑ ∑

= =

= +

because 



 + +

≤



+

∑ ∑ ∑ ∑

= =

= +

= =

=

+ p

j

r

l l q

k k j

p

j

r

l l q

k k

j e e e e e

e

1 1 1

#

1 1 1

# ,

and based on (8), p ≥ q+r that makes (–p + q+r) ≤ 0, then

∑ ∑ ∑

= =

= + +

p +

j

r

l l q

k k

j e e

e

1 1 1

#

because of (9), p+q+r = n, then

=

= n

i

ei 1

=

= n

i

i

i y

y

1

ˆ

So, it is obtained that

= n

i

i

i y

y

1

ˆ*

= n

i

i

i y

y

1

ˆ (10)

For e~ < 0, it can be proved in the same way.

While e~ = 0, the model is translated by 0 distance, in other words the model is not translated, then equation (10) is also satisfied.

Corollary of (10), then n

1

= n

i

i

i y

y

1

ˆ*

n

1

= n

i

i

i y

y

1

ˆ or MAE (Yˆ*) ≤ MAE(Yˆ) Based on theorem 1, fuzzy model for time series data (1) is translated in the extent of e~ and in the direction to zero into

e

y w

y y

w

y d

k

c t A k d

k

c t A k k t

k

k ~

) (

) ( ˆ

1

1

=

=

=

µ µ

(11)

Then, it will reduce MAE.

4. Verifications and Comparisons

4.1. Forecasting for University enrollment

For comparing with another method, this study will use a enrollment data in Alabama University, because this data has widely used as comparison by many researchers in time series forecasting.

The rules in Section 2 is applied to the first differences of the data using which uses p = 1 and q1 = 9. A fuzzy set Aikin [αii]with Gaussian membership function is applied as follows,

(8)





 

 

 −

=

2

2 exp 1 )

( s

v

yt i yt i k

Aik

µ (12) where vk is a center of the fuzzy set and s is the scale parameter. vk = -1, -0.75, -0.5, -0.25, 0, 0.25, 0.5, 0.75, 1 and s = 0.417 are given in this case.

The comparison results with different model, the actual enrollment, the prediction model from Song and Chissom (1993a, 1993b), Sullivan and Woodall (1994), Chen (1996), Cheng (2008), as well as the prediction based on the proposed model are shown in Table 1.

Table 1. Comparisons of the prediction results for enrollment with different models

Year Actual

Song (1993a,

1993b)

Sullivan (1994)

Chen (1996)

Cheng (2008)

Proposed method 1971 13,055

1972 13,563 14,000 13,500 14,000 13,680.5

1973 13,867 14,000 14,500 14,000 13,731.3 13,834 1974 14,696 14,000 14,500 14,000 13,761.7 14,517 1975 15,460 15,500 15,231 15,500 15,194.6 15,371 1976 15,311 16,000 15,563 16,000 15,374.8 15,434 1977 15,603 16,000 15,500 16,000 15,359.9 15,575 1978 15,861 16,000 15,500 16,000 16,410.3 16,253 1979 16,807 16,000 15,500 16,000 16,436.1 16,511 1980 16,919 16,813 16,684 16,833 17,130.7 17,482 1981 16,388 16,813 16,684 16,833 17,141.9 16,450 1982 15,433 16,789 15,500 16,833 15,363.8 16,069 1983 15,497 16,000 15,563 16,000 15,372.1 15,114 1984 15,145 16,000 15,563 16,000 15,378.5 15,295 1985 15,163 16,000 15,563 16,000 15,343.3 14,826 1986 15,984 16,000 15,563 16,000 15,345.1 15,315 1987 16,859 16,000 15,500 16,000 16,448.4 16,659 1988 18,150 16,813 16,577 16,833 17,135.9 17,534 1989 18,970 19,000 19,500 19,000 18,915.0 18,825 1990 19,328 19,000 19,500 19,000 18,997.0 19,645 1991 19,337 19,000 19,500 19,000 19,032.8 19,456

1992 18,876 19,000 19,033.7 19,489

MAE 516 442 518 350 298

MAPE 3.22% 2.66% 3.11% 2.09% 1.79%

RMSE 650 621 638 438 367

MAE = Mean Absolute Error

MAPE = Mean Absolute Percentage Error RMSE = Root Mean Square Error

(9)

The graph of the actual values is indicated by the blue plot and the predictions are indicated by the red one in Figure 3.

Figure 3. Actual and prediction results for the enrollment

Based on the results from Table 1, the proposed model has a smaller MAE, MAPE and RMSE as well as less average error than the other models.

4.2. The Application of Fuzzy Model Translation in Stock Price Prediction The time series fuzzy modeling is applied to the stock price of BMRI. The data used here is taken from July 14th, 2003 to March 18th, 2014 and it consists of 2744 observations (Yahoo-finance, 2014). The first 2000 data is used as in-sample data and the rest is used as test materials. The rules in Section 2 are applied to the first differences of the data, using p = 3. For i=3, qi = 6, a fuzzy set Aikin [αii] with Gaussian membership function (12) is applied for vk = -2, -1.2, -0.4, 0.4, 1.2, 2 and s = 0.2667. While a fuzzy set Aikin [αikik]with a membership function

) (yti

µ = 0 for everyyti∈[αii] is applied for i = 1, 2.

The prediction applies fuzzy method in two ways, they are using model (1), i.e. weighted basis of fuzzy rule, and using model (11), i.e. including a translation in the extent of median error of sample data in model (1). After the translation is

1972 1974 1976 1978 1980 1982 1984 1986 1988 1990 1992 1.3

1.4 1.5 1.6 1.7 1.8 1.9

2x 104

Year

Enrollment

Real values Predictions

(10)

applied in the extent of median error of in-sample data, then MAE will decrease.

The MAE of prediction using model (1) and model (11) is described briefly in Table 2.

Table 2. Comparison of MAE and MAPE in Stock Price Prediction of BMRI

Model MAE

In-sample Out-sample

Weighted Fuzzy 60.81741 126,8622

Weighted Fuzzy with Translation 60.69729 126.7590

The results in Table 2 show empirically that a translation in the extent of median error can minimize MAE of both in-sample and out-sample data. The graph of the actual values is indicated by the blue plot and the predictions are indicated by the red one in Figure 3.

Figure 4. Actual and prediction results for the stock market values of BMRI

5. Conclusion

Based on the theorem in Section 3, a model translation in the extent of median error directing to zero can minimize MAE. It can be seen from the case

500 1000 1500 2000 2500

1000 2000 3000 4000 5000 6000 7000 8000 9000 10000

Values

Time

Real values Predictions

(11)

study of fuzzy modeling for stock price of BMRI in Section 4.2 where a model translation in the extent of median error shows the results. In Section 4.1, a weighted fuzzy model with translation has a better accuracy than the other models.

References

[1] R. Agrawal, K.I. Lin, H.S. Sawhney, & K. Shim, 1995, Fast Similarity Search in the Presence of Noise, Scaling, and Translation In Times-Series Databases, Proceedings of the 21st Very Large Data Base Endowment (VLDB) Conference, Zurich, Switzerland.

[2] T. Argyros, C. Ermopoulos, 2003, Efficient Subsequence Matching in Time Series Databases Under Time and Amplitude Transformations, Proceedings of Third IEEE International Conference on Data Mining (ICDM'03), pp 481.

[3] S.M. Chen, 1996, Forecasting Enrollments Based on Fuzzy Time-Series.

Fuzzy Sets and Systems, Vol 81, pp 311–319.

[4] C. Cheng, T. Chen, and C. Chiang, 2006, Trend-Weighted Fuzzy Time- Series Model for TAIEX Forecasting, Neural Information Processing, Proceedings 13th International Conference, ICONIP 2006, Hong Kong, China, Part III pp 469 – 477, ISBN 978-3-540-46484-6.

[5] C. Cheng, T. Chen, H.J. Teoh, and C. Chiang, 2008, Fuzzy Time-Series Based on Adaptive Expectation Model for TAIEX Forecasting, Expert Systems with Applications, Vol 34, pp. 1126–1132.

[6] M. Kontaki, A.N. Papadopoulos, Y. Manolopoulos, 2005, Similarity Search in Time-Series Databases, Encyclopedia of Database Technologies and Applications, IDEA Group Publishing.

[7] Nurhayadi, Subanar, Abdurakhman, A.M. Abadi, 2012, Weighted Fuzzy Rule Base To Modeling Time Series Data And Its Application In Prediction Of Stock Prices, Proceeding of International Conference on Mathematics, Statistics and its Applications, Bali, Indonesia, November 19-21, 2012, ISBN 978-979-96152-7-5.

[8] Q. Song, and B.S. Chissom, 1993a, Fuzzy Time-Series and Its Models.

Fuzzy Sets and Systems, Vol. 54, pp. 269–277.

[9] Q. Song, and B.S. Chissom, 1993b, Forecasting Enrollments with Fuzzy Time Series Part I, Fuzzy Sets and Systems, Vol.54, pp 1-9.

(12)

[10] Q. Song, and B.S. Chissom, 1994, Forecasting Enrollments with Fuzzy Time Series - Part II, Fuzzy Sets and Systems, Vol 62(1), pp 1–8.

[11] J.H. Sullivan, and W.H. Woodall, 1994, A Comparison of Fuzzy Forecasting and Markov Modeling, Fuzzy Sets and Systems, Vol. 64(3), pp.

279-293.

[12] L.X. Wang, 1997, A Course in Fuzzy System and Control, Prentice Hall, Inc, New Jersey.

[13] Yahoo-Finance, 2013, http://finance.yahoo.com, downloaded on March 22, 2014.

[14] H.K. Yu, Weighted fuzzy time series models for TAIEX forecasting, Physica A: Statistical Mechanics and its Applications, Vol 349, pp 609-624.

Received: February 20, 2014

Referensi

Dokumen terkait

For the purposes of Article 16, the following categories indicated in Column 4 in the Schedule of Brunei Darussalam, in Section 2 of this Part, shall apply: a customs duties on