A Paradigm For Any Data

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 37

A Paradigm for Any Data

Data = Truth + Error


Finding Truth in Forecasting

1. Smoothing:
Truth can be “approximated” by averaging
out data.

2. Standard Models:
Truth can be “approximated” by a standard
forecasting model (DGP)
FM 1: Smoothing

• How to average out data?


• How to forecast?
• Problems?
• When most applicable?
Notations (NB)

1. Level, Lt

2. Trend, Tt
Not constant
3. Season, Ft

4. Irregulart
(Equal variability)
When Most Applicable

• Many items to forecast


– E.g. demand for standard items

• Automatic procedure is needed

• Excel works well for implementation


– (if Eviews is not available)
A. Simple Exponential Smoothing

• Model for Yt:


Yt = Lt + irregulart

No trend, no seasonality

• Forecasting of Y(T+h)

Pred_Y(T+h|T) = YT(h) in NB = LT
Estimation of LT

• Information set at T

T   Y1 , Y2 ,..., Y(T  4) , Y(T 3) , Y(T  2) , Y(T 1) , YT 

• Average only the most recent m


observations
1
 est _ LT 
m
 YT  Y(T 1)  ...Y(T  m 1) 
Estimation of LT – cont.

• weighted average of all observations:


LT = wT YT + w(T-1) Y(T-1) + …
0 < wt < 1 for all t

• greater weights for recent data points.


Weighting Scheme

• Choose 0 < < 1


• wT = 
• w(T-1) =  (1-)
• w(T-2) =  (1-)2 and so on.

• Note:

    1     1     1    
2 3
1
1  1 
Recursive Form Algorithm
LT =  YT + Y(T-1) + 2 Y(T-2) + ...

=  YT +L(T-1)

L(T-1) =  Y(T-1) +L(T-2) and so on.

Est. for t = (smooth. const.) x Data @ t + (1 - s. c.)(Est. @ t-1)


Example 1

Year Time, t Yt Lt Computation ( = 0.7)

1991 1 1426 1426.00 L1 = Y1 Initialize

1992 2 1471 1457.50 0.7 (1471) + (1 - 0.7) 1426

1993 3 1475 1469.75 0.7(1475) + (1 - 0.7) 1457.5

1994 4 1566

1995 5 1669
1 7 6
Error Correction Form
Est. for t = Est.@ t-1 + s.c.(forecast error@t)

• One Step Ahead Forecast Error


– et = Yt - L(t-1)

• Error Correction Form


– LT =YT + (1 - ) L(T-1) =(YT - L(T-1)) + L(T-1)

= L(T-1) +  eT
Example 2
Recursive Form
a 0.7

Year Time, t Yt Lt et Error Correction

1991 1 1426 1426.00 Initialize, no error


1992 2 1471 1457.50 45.00 1457.50 (=1426+0.7*45)
1993 3 1475 1469.75 17.50 1469.75 (=1457.5+0.7*17.5)
1994 4 1566 1537.13 96.25 1537.13
1995 5 1669 1629.44 131.88 1629.44
Selecting 
• Extreme Values
 = 1 LT = YT

=0 LT = L1 (initial value)

• Guide Lines
Large  for less volatile series

Small  for more volatile series


SSE and RMSE

• SSE = Sum of Squared Residuals


– For Exponential Smoothing, SSE = Sum of
Squared One Step Ahead Forecasting Errors.

• RMSE = Root Mean Squared Error


– Square Root of { SSE / # of Errors in SSE }
Practicality

1. Only information needed to forecast


Y(T+1) is { YT and L(T-1) }

Forecast of Y(T+1|T) = LT=  YT + (1 - ) L(T-1)

2. Robustness
Ref. NB 6.10
Two Problems
• How to determine the initial value?
– Use the first observation
– Take the average of the first half observations

• How to determine the best smoothing


constant, ?
– Use RMSE as a guide
– Do not minimize RMSE
Extensions of Simple Exponential
Smoothing
• Data = Trend + Seasonality + Cycle + Irregularity

• How to Incorporate Trend and Seasonality for


Forecast?
– B: Holt’s Linear Trend for Trend without Seasonality
– C: Holt-Winters for Trend and Seasonality

• Problems
– (1) Initial estimates
– (2) smoothing constants – one for each component
B. Holt’s Linear Trend
Exponential Smoothing

Yt Holt

 Simple

 

T t
Include Trend Component
for Forecast

Model for Data: Yt = Lt + irregulart


Lt = L(t-1) +T(t-1)

Forecast: Pred_Y(T+1 | T) = L T + TT

Pred_Y(T+h | T) = LT +hTT

h=1, 2, …
Recursive Formula for Lt and Tt

Est. for t = (smooth. const.) x Data@t + (1 - s.c.)(Est.@t-1)

For Level: Lt = Yt + (1 - )(L(t-1) + T(t-1))

For Trend: Tt = (Lt - L(t-1)) + (1 -) T(t-1)


Example 1

Yt Lt Tt Computation ( = 0.5,  = 0.3)

1 1813 1813

2 1650 1650 -163 L2 = 1650


Initialize
T2 = 1650 - 1813

3 1822 1654.5 -112.78 L3 = 0.5(1822) + 0.5(1650 +(-163))

T3 = 0.3 (1654.5 - 1650) + 0.7 (-163)

4 1778 1659.88 -77.31 L4 = 0.5 (1778) + 0.5 (1654.5 +(-112.78)

T4 = 0.3 (1659.88 - 1654.5) + 0.7 (-112.78)

5 1520 1551.28 - 86.70


17 6
Error Correction Form
Est. for t = Est.@t-1 + (s.c.)(forecast error@t)

“One Step Ahead” Forecast Error for Yt :


et = Yt - {L(t-1) + T(t-1)}

ECF (see page 198 of NB):


Lt = {L(t-1) + T(t-1)} +  e t

Tt = T(t-1) + e t
Example 2

Yt Lt Tt Computation ( = 0.5,  = 0.3)

1 1813 1813

L2 = 1650
2 1650 1650 -163
T2 = 1650 - 1813
Initialize

3 1822 1654.5 -112.75 e2 = 1822 - {1650 + (-163)} = 335


L3 = {1650 + (-163)} + 0.5 (335)
T3 = (-163) + (0.5)(0.3)(335)

4 1778 1659.88 -77.31 e3 = 1778 - {1654.5 + (-112.75)} = 236.25


L4 = {1654.5 + (-112.75)} + 0.5 (236.25) = 1659.88
T4 = (-112.75) + (0.5)(0.3)(236.25) = -77.31

5 1520 1551.28 - 86.70 e4 = 1520 - { 1659.88 + (-77.31) } = - 62.57


L5 = {1659.88 + (-77.31)} + 0.5 (-62.57)
T5 = (-77.31) + (0.5)(0.3) (-62.57) = -86.70

17 6
Computing Holt’s Linear Trend Smoothing – an Illustration

Forecasting Sales Using Holt's Linear Exponential Smoothing


SSE= 2.57E+12
 0.7000
 0.5000
Data Standard Algorithm One Step Ahead Forecast Error Correction Form
t Yt Lt Tt L(t-1) + T(t-1) et Lt Tt
1 447752
2 349598 349598 -98154
3 414581 365640 -41056 251444 163137 365640 -41056
4 477851 431871 12587 324584 153267 431871 12587
5 538203 510080 45398 444458 93745 510080 45398
6 507278 521738 28528 555478 -48200 521738 28528
7 521351 530026 18408 550266 -28915 530026 18408
8 532782 537477 12930 548433 -15651 537477 12930
9 566398 561601 18527 550407 15991 561601 18527
10 603704 596631 26778 580127 23577 596631 26778
11 545344 568764 -544 623409 -78065 568764 -544
12 521980 535852 -16728 568219 -46239 535852 -16728
13 625043 593267 20344 519124 105919 593267 20344
14 620319 618307 22691 613611 6708 618307 22691
15 666157 658609 31497 640998 25159 658609 31497
16 613159 636243 4566 690106 -76947 636243 4566
17 635441 637051 2687 640809 -5368 637051 2687
18 674235 663886 14761 639738 34497 663886 14761
19 818490 776537 63706 678647 139843 776537 63706
20 737921 768618 27893 840243 -102322 768618 27893
Comparison With Fixed Trend

• Fixed Trend:
Y( T+1| T) =  + T+1) = LT + 

• Holt’s Model:
Y( T+1| T) = LT + T (slope variable)
C. Holt-Winters Seasonal
Exponential Smoothing

Let: s : # of “seasons” in a year

Model for Yt = Lt +Ft + irregulart


- additive seasonality

Yt = Lt Ft (irregulart)
- multiplicative seasonality

Lt = Lt-1 + Tt-1
Forecasting for Holt – Winters Methods
Need to Estimate Ft by F(t-s)

Additive Seasonality
Pred_YT+1|T = LT+TT+F(T+1-s)
Pred_YT+h|T = LT+hTT+F(T+h-s)

Multiplicative Seasonality
Pred_ YT+1|T = (LT+TT) F(T+1-s)
Pred_ YT+h|T = (LT+h TT) F(T+h-s)
Recursive Formula
- additive seasonality

Est. for t = (smooth. const.) x Data@t + (1 - s.c.)(Est.@t-1)

• Level: Lt =  (Yt - F(t-s) ) + (1 - ) {L(t-1) + T(t-1)}

• Trend: Tt =  (Lt - L(t-1)) + (1 - ) T(t-1)

• Season: Ft =  (Yt - Lt) + (1 - ) F(t-s)


Error Correction Form
- additive seasonality
Est. for t = Est.@t-1/s + (s.c.)(forecast error@t)

• Error: et = Yt - (Lt-1 + Tt-1 + F(t - s))

• ECF:
Lt = (L(t-1) +T(t-1)) e t

Tt = T(t-1) + et

Ft = F(t-s) + e t
Recursive Formula
- multiplicative seasonality

Yt
• Level: Lt =  + 1- L(t-1)+ T(t-1)
Ft-s

• Trend: Tt =  (Lt - L(t-1)) + (1 - ) T(t-1)

• Season: Ft =  Yt + 1- F(t-s)


Lt
Error Correction Form
- multiplicative seasonality

• Error: et = Yt - (L(t-1) + T(t-1) ) F(t-s)

• ECM:
Lt = L(t-1) +T(t-1) e t / F(t-s)

Tt = T(t-1) + e t / F(t-s)

Ft = F(t-s) + e t / Lt
Determining Initial Values
• Use the average of the first s observations
of data for L1 ..Ls.

• Compute the F1 through Fs, using (Y1, L1) …


(Ys, Ls).

• Set T1…Ts = 0

Note: This is just one method.


Example: Additive Seasonality
Holt- Winter's Seasonal Exponential Smoothing
NB pa ge 201
 0.3 One S te p Ahe a d Fore ca s t & Error Corre ction Form Es tima tion
 0.4 Error
 0.5
t S e a s on Yt Lt Tt Ft Y(t| t-1) et Lt Tt Ft
1 1 897 564.50 0.00 332.50 564.50 0.00 332.50
2 2 476 564.50 0.00 -8 8.50 564.50 0.00 -8 8.50
3 3 376 564.50 0.00 -1 88.50 564.50 0.00 -188.50
4 4 509 564.50 0.00 -5 5.50 564.50 0.00 -5 5.50
5 1 967 585.50 8.40 357.00 897.00 70.00 585.50 8.40 357.00
6 2 529 600.98 1 1.23 -8 0.24 505.40 23.60 600.98 11.23 -8 0.24
7 3 407 607.20 9.23 -1 94.35 423.71 -16 .71 607.20 9.23 -194.35
8 4 371 559.45 -13.56 -1 21.97 560.92 -189.92 559.45 -13.5 6 -121.97
9 1 884 540.22 -15.83 350.39 902.88 -18 .88 540.22 -15.8 3 350.39
10 2 407 513.24 -20.29 -9 3.24 444.15 -37 .15 513.24 -20.2 9 -9 3.24
11 3 310 496.37 -18.92 -1 90.36 298.61 11.39 496.37 -18.9 2 -190.36
12 4 338 472.21 -21.02 -1 28.09 355.48 -17 .48 472.21 -21.0 2 -128.09
13 1 900 480.72 -9.21 384.84 801.58 98.42 480.72 -9.21 384.84
14 2 448 492.43 -0.84 -6 8.83 378.27 69.73 492.43 -0.84 -6 8.83
15 3 344 504.42 4.29 -1 75.39 301.23 42.77 504.42 4.29 -175.39
16 4 274 476.73 -8.50 -1 65.41 380.62 -106.62 476.73 -8.50 -165.41
17 1 740 434.31 -22.07 345.27 853.06 -113.06 434.31 -22.0 7 345.27
18 2 261 387.52 -31.96 -9 7.68 343.40 -82 .40 387.52 -31.9 6 -9 7.68
19 3 289 388.21 -18.90 -1 37.30 180.17 108.8 3 388.21 -18.9 0 -137.30
20 4 319 403.84 -5.09 -1 25.12 203.90 115.1 0 403.84 -5.09 -125.12
21 1 1036 486.35 2 9.95 447.46 744.02 291.9 8 486.35 29.95 447.46
22 2 602 571.31 5 1.96 -3 3.49 418.62 183.3 8 571.31 51.96 -3 3.49
23 3 536 638.28 5 7.96 -1 19.79 485.97 50.03 638.28 57.96 -119.79
24 4 349 629.60 3 1.31 -2 02.86 571.11 -222.11 629.60 31.31 -202.86
25 1 1050 643.40 2 4.30 427.03 1108.37 -58 .37 643.40 24.30 427.03
26 2 633 667.34 2 4.16 -3 3.92 634.21 -1 .21 667.34 24.16 -3 3.92
27 3 435 650.48 7.75 -1 67.64 571.71 -136.71 650.48 7.75 -167.64
28 4 415 646.13 2.91 -2 16.99 455.37 -40 .37 646.13 2.91 -216.99
S ta rting Va lue s 1076.06
1. T1=T2=T3=T4 = 0
2. L1=L2=L3=L4 = 564.5 = Ave ra ge (Y1, Y2, Y3 , Y4)
3. F1 = Y1 - L1, F2 = Y2 - L2, F3 = Y3 - L2, F4 = Y4 - L4
Example: Multiplicative Seasonality

Holt- Winter's Seasonal Exponential Smoothing


NB page 201
 0.3 One S te p Forecas t & Error Correction Form Es timation
 0.4 Error
 0.5
t S ea s on Yt Lt Tt Ft Y(t| t-1) et Lt Tt Ft
1 1 897 564.50 0.00 1.589 564.50 0.00 1.589
2 2 476 564.50 0.00 0.843 564.50 0.00 0.843
3 3 376 564.50 0.00 0.666 564.50 0.00 0.666
4 4 509 564.50 0.00 0.902 564.50 0.00 0.902
5 1 967 577.72 5.286 1.6314 897.00 70.00 577.72 5.286 1.6314
6 2 529 596.31 10.609 0.8652 491.60 37.40 596.31 10.609 0.8652
7 3 407 608.15 11.104 0.6677 404.25 2.75 608.15 11.104 0.6677
8 4 371 556.92 -13.833 0.7839 558.37 -187.37 556.92 -13.833 0.7839
9 1 884 542.72 -13.980 1.6301 886.00 -2.00 542.72 -13.980 1.6301
10 2 407 511.24 -20.977 0.8306 457.45 -50.45 511.24 -20.977 0.8306
11 3 310 482.48 -24.092 0.6551 327.33 -17.33 482.48 -24.092 0.6551
12 4 338 450.22 -27.359 0.7673 359.34 -21.34 450.22 -27.359 0.7673
13 1 900 461.63 -11.850 1.7899 689.32 210.68 461.63 -11.850 1.7899
14 2 448 476.65 -1.102 0.8853 373.61 74.39 476.65 -1.102 0.8853
15 3 344 490.42 4.846 0.6783 311.53 32.47 490.42 4.846 0.6783
16 4 274 453.81 -11.736 0.6856 380.04 -106.04 453.81 -11.736 0.6856
17 1 740 433.48 -15.173 1.7485 791.26 -51.26 433.48 -15.173 1.7485
18 2 261 381.27 -29.991 0.7849 370.32 -109.32 381.27 -29.991 0.7849
19 3 289 373.72 -21.013 0.7258 238.26 50.74 373.72 -21.013 0.7258
20 4 319 386.49 -7.500 0.7555 241.80 77.20 386.49 -7.500 0.7555
21 1 1036 443.05 18.123 2.0434 662.66 373.34 443.05 18.123 2.0434
22 2 602 552.91 54.818 0.9369 361.98 240.02 552.91 54.818 0.9369
23 3 536 646.96 70.512 0.7771 441.08 94.92 646.96 70.512 0.7771
24 4 349 640.82 39.851 0.6500 542.03 -193.03 640.82 39.851 0.6500
25 1 1050 630.62 19.832 1.8542 1390.90 -340.90 630.62 19.832 1.8542
26 2 633 658.02 22.857 0.9494 609.38 23.62 658.02 22.857 0.9494
27 3 435 644.54 8.322 0.7260 529.13 -94.13 644.54 8.322 0.7260
28 4 415 648.53 6.589 0.6450 424.39 -9.39 648.53 6.589 0.6450
S tarting Va lue s 1214.73
1. T1=T2=T3=T4 = 0
2. L1=L2=L3=L4 = 564.5 = Ave rage (Y1, Y2, Y3, Y4)
3. F1 = Y1/ L1, F2 = Y2/ L2, F3 = Y3/ L3, F4 = Y4 / L4
Choosing Smoothing Constants

• Forecast = f(Data, s.c, initial values)

• Big Question:
must evolve from using the system

• Recommendation:
use small values, say 0.2 to 0.5,
to begin with
Using Eviews

• Simple smooth(s, ) ser_name smooth_name

• Holt smooth(n, )

• Holt-Winters smooth(a, additive


smooth(m, multiplicative

You might also like