Exponenial moohing
Inroducion A simple mehod for forecasing. Does no require long series. Enables o decompose he series ino a rend and seasonal effecs. Paricularly useful mehod when here is a need o forecas many series in real ime. imple exponenial smoohing uppose ha we have a saionary series, X, X2,..., X N, and we wan o forecas X N + as a linear combinaion of previous observaions: X ˆ ( N,) = C,... 0XN + CXN + I makes sense o require C 0 > C > C 2 >... since we are dealing wih a ime series. Le C i i = α( α) C = i= 0 i, 0 α. 2
imple exponenial smoohing (con.) Xˆ ( N,) = αx + α ( α ) X + α ( α ) X +... 2 N N N 2 = α X + ( α)[ αx + α( α) X +...] N N N 2 Xˆ( N,) = α X + ( α) Xˆ( N,) = Xˆ( N,) + αe ; e [ ˆ N = XN XN ()]. N Noice: Xˆ( N,2) = αxˆ( N,) + ( α) Xˆ( N,) = Xˆ( N,) and so forh. Opimaliy of simple exponenial smoohing. Le X = μ + ε + β( ε + ε 2 +...) W = X X = ε ( βε ) = ε θε MA() Under he MA() model: X ˆ () = X θ[ X X ˆ ()] = X ˆ () + ( θ)[ X X ˆ ()] = Xˆ () + α[ X Xˆ ()] ; α = ( θ ). Forecasing equaion of exponenial smooh. N 3
Choise of α for simple smoohing A- ubjecive consideraions B- By minimizaion of sum of squares of forecasing errors: Xˆ (,) = X e = ( X X ) 2 2 Xˆ(2,) = Xˆ(,) + αe = X + α( X X 3 3 2 2 2 e = X [ αx + ( α) X ],... ) Esimaion of α by minimizaion of N 2 e = 2, or a weighed sum. Minimizaion can be carried ou by a grid search in he range 0< α <. Imporan: simple exponenial smoohing can only be applied o a saionary series. For a nonsaionary series i is no longer effecive. Example: X ˆ = γ 0 + γ; γ > 0 αx + ( α) X () < X+. 4
Exponenial smoohing: Hol & Winers mehod A. Addiive decomposiion: X = L + + u L - rend level a ime, - seasonal effec, u - irregular (noise) erm. Ieraive process. When a new observaion X + becomes available, updae L, R T (slope, see below) and as follows: + ( X + ) ( α )( ) L L R R = γ ( ) ( ) L L + γ + + R ; * + δ( ) ( ) X L δ + + + α + = + + ; = + ; s + Forecas m seps ahead: Xˆ 0 δ, γα, L R + m ( m) = + m + ++ i = 0. + i= 0 are smoohing coefficiens. Noe: each updaing equaion is a weighed average of wo esimaes of he corresponding quaniy. One from pas observaions and a new one. 5
Alernaive equaions for addiive smoohing Le e ˆ + = X+ X () denoe he one sep ahead forecasing error. Then, L L R α e = + + ; = + + + + + + + δ α + R R α γ e ( ) e s = + + ; s ++ ++ = ( ) + + s i i e δ α, i=...( s ). s is he lengh of he seasonal cycle (4, 2, ). Implicaion: if he sum of he seasonal effecs is nullified a he sar of he smoohing ( =), i will remain like his for every ime poin. 6
pecial case Consider a non-seasonal series; Xˆ () = L+ R e= X ( L + R ) X= e+ ( L + R ). From previous equaions, L L = R + αe ; R R = αγ e and hence, 2 ( B) L αγe α( e e ) α[ ( γ) B] e = + =. imilarly, 2 ( B) ( L R ) { αb[ ( γ) B] αγb( B)} e + = +, 2 2 ( ) {( ) α [ ( γ) ] αγ ( )} B X = B + B B + B B e. Or, X 2 X X 2 [ α( γ) 2] e ( α) e 2 = + + + ; opimal predicion for ARIMA(0,2,2). 7
Exponenial smoohing: Hol & Winers mehod (con.) B. Muliplicaive decomposiion: X = L I, I are now percenages ( is a seasonal facor, I is he irregular erm.) Raionale of muliplicaive decomposiion: he seasonal effec (no seasonal facor) is proporional o he rend level. uppose ha in monhs, + 2, + 24, =.. Monh + 2 + 24 L 00 200 300 L 0 220 330 L L 0 20 30 is he seasonal facor, L L is he seasonal effec. 8
Exponenial smoohing for muliplicaive decomposiion Possibiliy I: use he log ransformaion, apply addiive smoohing: Y = log( X ) = log( L ) + log( ) + log( I ) Transforming back he smoohed values yields γ L + ( γ ) + = ( R) L δ * + X + + ( δ ) + = ( ) L + R ; ; α L X = L R + ( α ) + ( ) + s ++ i =. + i= 0 Geomeric mean of seasonal facors =. m ˆ m Forecas: ( ) ( ) X m = L R +. Predicion error: e ˆ = ( X / X/ ). Problem: assumes implicily ha he rend evolves in consan raes. No very realisic in pracice. 9
Exponenial smoohing for muliplicaive decomposiion (con.) Possibiliy II: (original procedure of Winer). X L = α + α + ( )( ) + + + L R γ ( ) ( γ) + + R = L L + R ; * X + + = δ ( δ) + + L + ; + Implicaions: ; s i= 0 ++ i + The rend evolves in consan incremens; Arihmeic mean of seasonal facors =. Why require ha he arihmeic mean of he seasonal facors =? Reasonable o impose ha he sum of he seasonal effecs over s successive ime poins is null. Le s=2. If 2 /2 = =, 2 2 =L L = L = Cov L = = ( ) ( ) 2 (, ) Trend level and seasonal facors uncorrelaed. = s 0. 0
aring values for smoohing uppose ha he series is long enough such ha we can use he firs 3 years for saring values. Trend levels: [2][2] X, cenered moving 24 average. Firs a simple moving average of 2 successive poins and hen a simple moving average of every wo successive averages. This way he firs rend value is for =7. easonal effecs (facors): average he wo differences ( X ˆ ) ˆ L (addiive decomposiion) or he wo raios ( X / Lˆ ) (muliplicaive decomposiion), for each calendar monh. ubrac (divide by) he mean of he resuling esimaes from each esimae such ha heir mean equals 0 for he addiive decomposiion (equals for he muliplicaive decomposiion). Incremen: ( Lˆ 25 +... + Lˆ ˆ ˆ 36) ( L3 +... + L24), or 2 2 jus, ( Lˆ ˆ 36 L35).
Graphical es for choosing beween addiive and muliplicaive decomposiion Compue L ˆ for he whole series in he same way as for he saring values, and ˆ ( ˆ = X L). Plo ˆ agains L ˆ for each calendar monh separaely. The monhly esimaes ˆ may be subjeced o large noise, so an alernaive procedure is o plo he annual geomeric means 2 /2 2 ( ˆ /2 X ) j ij L = ij agains ( Lˆ ) j= ij. Raionale: Denoe ˆ = ( X Lˆ ). If ij = K jlij ij ij ij 2 2 2 2 ij = K j j j L j ij K L = = = = j= ij. ( ) Graphical es of smoohing performance (CUUM) Le m = e, m2 = m+ e2 = e+ e2... m = m + e, m = he sum of forecasing errors unil ime. Plo m agains. [ m / e ] k= k and we expec i o be close o 0. 2
Example The able below shows he sales of a business in 4 years. ΙVYear\quarer I II III 22 303 358 288 2 22 325 398 326 3 257 358 42 364 4 275 380 464 42 I is desired o forecas he amoun of sales in he hird and fourh quarers of Year 4, using he daa unil he second quarer of Year 4. We shall use he firs 3 years for saring values and sar he smoohing from he hird quarer of Year 3 ( = ). Le α = γ = δ = 0.. 3
Compuaion of saring values aring values for rend levels: [2][4] 8 X. Lˆ = 0.25X + 0.25X + 0.25X + 0.25X + 0.25X 2 + + 2 L ˆ 3 = 0.25 22+ 0.25(303 + 358 + 288) + 0.25 22 = 292.5 imilar compuaions yield, ΙVYear\quarer I II III 287* 289.75* 292.5 295.25 2 303 32.75 322 330.63 3 337.63 345.25 352.25 357.25 4 365.38 377.88 390.38* 402.88* (*) The firs wo values are compued by subracing he esimaed incremen (295.25-292.5). The las wo values are compued by adding he esimaed incremen (377.88-365.38). These values are used for he graphical es bu are no needed for he smoohing process. 4
Compuaion of saring values (con.) aring values for seasonal effecs: ˆ = ( X Lˆ ) ΙVYear\quarer I II III Mean -66.0 3.25 65.5-7.25.375 2-82.0 2.25 76-4.63 0.405 3-80.6 2.75 68.75 6.75.905 4-90.4 2.2 73.62 8.2 0.87 The able shows ha he series is highly seasonal. Annual average of seasonal effecs close o zero despie of very rough esimaion of rend levels. The figures in he able don indicae ha he seasonal effecs increase when he rend increases, so an addiive decomposiion seems righ. (One can apply boh procedures and compare he forecass.) 5
Graphical es 00 80 Ŝ 60 40 20 0 280-2 0 300 320 340 360 380 400-4 0-6 0-8 0-00 Lˆ The Figure shows very clearly ha here is no apparen relaionship beween ˆ and L ˆ, suggesing ha he addiive decomposiion is more appropriae. Compuaion of he annual geomeric means of ˆ = X Lˆ yields: G = 25.39, G = 24.38, G = 26.28, G = 22.49. () (2) (3) (4) The annual geomeric means of L ˆ are: L = 29., L = 36.93, L = 348.02, L = 383.88 () (2) (3) (4) The annual geomeric means of he rend levels increase, bu he annual geomeric means of he seasonal effecs are more or less consan. 6
Compuaion of saring values for smoohing * = [ 82 + ( 80.63)]/ 2 = 8.32 * 2 = (2.25 + 2.75) / 2 = 2.5 * 3 = (65.5 + 76) / 2 = 70.75 * = * 4 = (7.25 + 4.63) / 2 = 5.94 aring values for seasonal effecs by quarer: = =, 2 = 3.5, 3 = 7.75, * * 80.32 4 = 4.94 =We sar he smoohing a ime 0. Lˆ = 345.25, Rˆ = Lˆ Lˆ = 7.62 0 0 0 9 7
0 moohing under he addiive decomposiion e = X X ˆ () = 42 (345.25 + 7.62 + 7.75) = 3.62 ˆ 0 = 7.75 seasonal effec compued a ime = 0 for ime =. =moohed values for ime L ˆ = L ˆ + R ˆ + αe = 345.25 + 7.62 + 0.( 3.62) = 352.83 0 0 ˆ 2 = ˆ 7.62 (0.) ( 3.62) 7.58 0 + αγ = = R R e 3 3 = 0 + 0.75 δ( α) e = 7.75 + 0.75 0. 0.9( 3.62) = 7.5 4 4 = 0 0.25 δ( α) e = 4.94 0.25 0. 0.9( 3.62) = 5.02 = 0 0.25 δ( α) e = 80.32 0.25 0. 0.9( 3.62) = 80.40 2 2 = 0 0.25 δ( α) e = 3.5 0.25 0. 0.9( 3.62) = 5.02 New forecas: X () = 352.83 + 7.58 5.02 = 355.4 New forecas error: e 2 = 364 355.4 = 8.6 4 j= j = 0 8
moohing (con.) Coninuing he same way for imes = 2, = 3 and = 4 yields he following smoohed values: ime L ˆ =2 36.27 7.66-80.2 =3 368.8 7.52-8.4 =4 376.22 7.42-8.36 R ˆ Ŝ Ŝ 2 Ŝ 3 4 e + Ŝ X ˆ () 3.6 7.70-288.72-4.44 3.72 3.30 7.40-389.62-9.62 4.75 2.62 7.20-454.84 9.6 4.97 Predicion for ime =5: X ˆ 4() = 376.22 + 7.42 + 7.2 = 4.e 5 = 464 454.84 = 9.6(less han 2%). Predicion for ime =5: X ˆ 4(2) = 376.22 + 2 7.42 4.97 = 3e 5 = 34.9(8% error) 548486.9