an introduction to grey methods by using ran introduction to grey methods by using r tan xi...

33
2009-12-5 1 An IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009

Upload: others

Post on 26-Apr-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 1

An IntRoduction to gRey methods by using

RTan Xi

Department of Statistics, NUFENov 6, 2009

Page 2: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 2

Contents:A brief introduction to Grey MethodsAn analysis of Degree of Grey IncidenceGrey GM(1, 1) Model(1)Construction(2)Test the accuracy of the modelSome Envisions

Page 3: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 3

A brief introduction to Grey Methods

• Who?Professor Deng! A Chinese!

• When? Long ago… About 1970s!

• What?White, Grey, Black?

• Application?Many realms! Economics, Physics, Social Science, and the list will go on!

Page 4: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 4

An easy example——Step by Step

Suppose that the original sequence is

comparative sequences are :

Which of the comparative sequences is much closer to the original series ?

{0 8, 8.8,16,18, 24, 32 }Y =

{1 10,12.12,19.28, 20.25, 23.4, 30.69 }Y =

{2 6, 6.35, 6.57, 6.98, 8.35, 8.75}Y =

.

0Y

Page 5: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 5

Before computing the exact values, you can get the intuition by looking at the graph.

(Ads: Where is Xie? ☺).GET THE INTUITION

0

5

10

15

20

25

30

35

1 2 3 4 5 6

Y0 Y1 Y2

Page 6: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 6

• Step1: Initialize all sequences

• Step2 : Compute the absolute subtractionsequences

0

1

2

{1,1.1, 2, 2.25, 3, 4}{1,1.212,1.928, 2.205, 2.34, 3.069}{1,1.0583,1.0950,1.1633,1.3917,1.4583}

XXX

===

0 0( ) ( ) ( )i ik Y k Y kΔ = −

Page 7: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 7

• Step3: Compute the two-step minimum and maximum of the absolute subtraction sequences

min 0min min ( ) ( ) 2.5417ii kY k Y kΔ = − =

max 0max max ( ) ( ) 0ii kY k Y kΔ = − =

Page 8: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 8

Step4: Compute coefficients of Grey incidence

Formula:

of which the distinguishing coefficient is 0.5.

min max0

max

( ( ), ( ))( )i

oi

Y k Y kk

ργρ

Δ + ⋅Δ=Δ + ⋅Δ

ρ

Page 9: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 9

• Step5: Compute the degree of Grey incidence

And so our intuition is right!

The computed results show that is much more closer to than to , which is in coincidence with our intuition!

0 01

1( , ) ( ( ), ( ))n

i ik

Y Y Y k Y kn

γ γ=

= ∑

0 1( , ) 0.8251Y Yγ = 0 2( , ) 0.6444Y Yγ =

1Y0Y

2Y

Page 10: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 10

Recap:

• Initialize all sequences. • Compute the absolute subtraction sequences

• Compute the two-step minimum and maximum of the absolute subtraction sequences

• Compute coefficients of Grey incidence

0 0( ) ( ) ( )i ik Y k Y kΔ = −

min 0min min ( ) ( )ii kY k Y kΔ = − max 0max max ( ) ( )ii k

Y k Y kΔ = −

min max0

max

( ( ), ( ))( )i

oi

Y k Y kk

ργρ

Δ + ⋅Δ=Δ + ⋅Δ

Page 11: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 11

Recap:

• Bingo! ! Compute the degree of Grey incidence:

0 01

1( , ) ( ( ), ( ))n

i ik

Y Y Y k Y kn

γ γ=

= ∑

Page 12: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 12

All steps in one functionAre you bored or puzzled with these steps??Alternatives:• The first: R functions!

I’ve involved all preceding steps in one function: 灰色关联分析函数.RI’ll show you how to use it!

• The second:Click-Mouse Statistical Packages ……

• It’s your choice! It’s all up to you! For R-Users??

Page 13: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 13

GM(1, 1)ModelGM(1, 1) type of Grey model is the most widely used in the literature, pronounced as “Grey Model First Order One Variable”. This model is a time series forecasting model. The differential equations of the GM(1, 1) model have time-varying coefficients.

Page 14: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 14

How to construct the GM(1,1) Model?

Consider a time sequence , which has n observations,When this sequence is subjected to the Accumulating Generation Operation (AGO), the following sequence is obtained

where

X(0)

{ (1), (2), , ( )}X X X X n=(0) (0) (0) (0)

X(1)

(1) { (1), (2), , ( )}X X X X n= (1) (1) (1)

(1)

1

( ) ( )k

i

X k X i=

= ∑ (0)

Page 15: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 15

How to construct the GM(1,1) Model?

• The grey difference equation of GM(1,1) is defined as follows:

The least square estimate sequence of the grey difference equation of GM(1,1) is defined as follows:

(1)(1)dX aX

dtμ+ =

1ˆ ( )T T

nB B B Y

μ−= =

⎛ ⎞⎜ ⎟⎝ ⎠

Page 16: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 16

How to construct the GM(1,1) Model?

• Solve the grey difference equation of GM(1,1), the predicted GM(1,1) Model can be obtained:

• To obtain the predicted value of the primitive data at time , the IAGO is used to establish the following grey model:

(1) (0)ˆ ( 1) (1) akX k X ea aμ μ−⎛ ⎞+ = − +⎜ ⎟

⎝ ⎠

( )k H+

(0) (0) ( 1)( ) [ (1) ] (1 )a k H ap

bX k H X e ea

− + −+ = − −

Page 17: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 17

How to test the accuracy of the GM(1,1) Model?

• Residual Tests

(0) (0) (0)ˆ( ) ( ) ( ) 1, 2, ,i X i X i i nΔ = − =

(0)

(0)

( )( ) 100% 1, 2, ,( )ii i n

X iΔ

Φ = × =

Page 18: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 18

How to test the accuracy of the GM(1,1) Model?

• The Test of the degree of Grey incidence

According to experience, the GM(1,1) Model is qualified if

, when .

(0) (0) (0) (0)

1

1ˆ ˆ( , ) ( ( ), ( ))n

i

X X X i X in

γ γ=

= ∑

(0) (0)ˆ( , ) 0.6X Xγ > 0.5ρ =

Page 19: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 19

How to test the accuracy of the GM(1,1) Model?

• C and P Criteria(0) (0) 2

1

[ ( ) ]1

X i XS

n−

=−

∑ (0) (0) 2

2

[ ( ) ]1

iS

nΔ −Δ

=−

2

1

SC= 0.01887908S

=

(0) (0)1{ ( ) 0.6745 }P p i S= Δ − Δ <

Page 20: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 20

How to test the accuracy of the GM(1,1) Model?

• C and P Criteria

Page 21: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 21

An easy example executed by R Program

Suppose the original sequence is:

Construct the GM(1,1) Model and predict the values of 7~11th Periods.

R program :GM(1,1)模型建立、检验和预测.R

Page 22: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 22

• Step1: Construct the AGO sequence:

• Step2: Construct the matrix B and the vector nY(1) (1)

(1) (1)

(1) (1)

(1) (1)

(1) (1)

1[ (1) (2)] 1

2

1[ (2) (3)] 1

2

1[ (3) (4)] 1

2

1[ (4) (5)] 1

2

1[ (5) (6)] 1

2

-42.45 1

-74.60 1

-108.05 1

-143.00 1

-179.65 1

X X

X X

X X

X X

X X

B

− +

− +

− +

− +

− +

= =

⎛ ⎞⎜ ⎟⎜ ⎟⎜ ⎟ ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟⎜ ⎟ ⎝ ⎠⎜ ⎟⎜ ⎟⎜ ⎟⎝ ⎠

(0)

(0)

(0)

(0)

(0)

(2) 31.5(3) 32.8(4) 34.1

35.8(5)37.5(6)

nY

XXXXX

⎛ ⎞ ⎛ ⎞⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟= =⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎜ ⎟⎜ ⎟ ⎝ ⎠⎝ ⎠

Page 23: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 23

• Step3: Compute , and .

• Step4: Solve the vector of parameters by using the least square estimate.

TB B 1( )TB B − TnB Y

71765.09 -547.75-547.75 5.00

TB B ⎛ ⎞= ⎜ ⎟⎝ ⎠

1 0.000085 0.009316( )

0.009316 1.220591TB B − ⎛ ⎞

= ⎜ ⎟⎝ ⎠

-0.04380429.541220

TnB Y

⎛ ⎞= ⎜ ⎟⎝ ⎠

ˆ-0.04380429.541220

α =⎛ ⎞⎜ ⎟⎝ ⎠

=-0.043804 29.541220a μ=

Page 24: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 24

• Step5: Construct the GM(1,1) prediction Model

So the GM(1,1) prediction model is:

(1)(1)

(1)(1)0.043804 29.541220

dX aXdt

dX Xdt

μ+ =

− =

(1) (0)

(0)

ˆ ( 1) (1)

(1) 26.7, -674.3883

akX k X ea a

Xa

μ μ

μ

−⎧ ⎛ ⎞+ = − +⎜ ⎟⎪⎪ ⎝ ⎠⎨⎪ = =⎪⎩

(1) 0.043804ˆ ( 1) 701.0883 -674.3883kX k e+ =

Page 25: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 25

Test the accuracy of the GM(1,1) Model

• Residual Test

Page 26: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 26

• Residual Test

Page 27: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 27

• The Test of the degree of Grey incidence

(0) (0) (0) (0)

1

1ˆ ˆ( , ) ( ( ), ( )) 0.70119n

i

X X X i X in

γ γ=

= =∑

Page 28: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 28

• C and P Criteria

(0) (0) 2

1

[ ( ) ]3.775006

1X i X

Sn

−= =

−∑

(0) (0) 2

2

[ ( ) ]0.07126863

1i

Sn

Δ −Δ= =

−∑

2

1

SC= 0.01887908S

= 0S 2.546241=

(0) (0)( )

{0.06202667, 0.04460833, 0.06112567, 0.10575133, 0.05980467, 0.03259733}ie i= Δ −Δ

=

(0) (0)1{ ( ) 0.6745 } 1P p i S= Δ − Δ < =

Page 29: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 29

GM(1,1) Model can be used to predict.

Page 30: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 30

Some Envisions• R package?

Any existing R package?Or can we write the first one?

• CollaborationMore R programs and R Functions On grey methods?

Page 31: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 31

Reference:[1]邓聚龙,灰理论基础[M].上海:华中科技大学出版社,

2003.[2]刘思峰,谢思明,灰色系统理论及其应用[M].北京:科学

出版社,2008.[3]王庚,现代数学建模方法[M].北京:科学出版社,2008.[4]徐国祥,统计预测与决策[M].上海:上海财经大学出版

社,2005.[5] Erdal Kayacan, Baris Ulutas, Okyay Kaynak, Grey system

theory-based models in time series prediction[J]. Expert Systems with Applications, 2010:1784–1789.

Page 32: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 32

Acknowledgements

I am grateful to all members of COS, without your excellent work, no R conferences could be held currently in China.I am also grateful to Professor Wang Gen for his help and suggestions on this topic.And thank everyone here for your patient listening and welcome any suggestions.

Page 33: An IntRoduction to gRey methods by using RAn IntRoduction to gRey methods by using R Tan Xi Department of Statistics, NUFE Nov 6, 2009. 2009-12-5 2 Contents: zA brief introduction

2009-12-5 33

Thank you!Contact Information:Tel: 13770636679Email: [email protected]