Joual of Mode Applied aisical Mehods Volume 7 Issue 1 Aicle 15 5-1-008 A Weighed Movig Aveage Pocess fo Foecasig hou Hsig hih Uivesiy of ouh Floida, sshih@mail.usf.edu Chis P. Tsokos Uivesiy of ouh Floida, pofcp@cas.usf.edu Follow his ad addiioal woks a: hp://digialcommos.waye.edu/jmasm Pa of he Applied aisics Commos, ocial ad Behavioal cieces Commos, ad he aisical Theoy Commos Recommeded Ciaio hih, hou Hsig ad Tsokos, Chis P. (008) "A Weighed Movig Aveage Pocess fo Foecasig," Joual of Mode Applied aisical Mehods: Vol. 7 : Iss. 1, Aicle 15. DOI: 10.37/jmasm/10961540 Available a: hp://digialcommos.waye.edu/jmasm/vol7/iss1/15 This Regula Aicle is bough o you fo fee ad ope access by he Ope Access Jouals a DigialCommos@Wayeae. I has bee acceped fo iclusio i Joual of Mode Applied aisical Mehods by a auhoized edio of DigialCommos@Wayeae.
Joual of Mode Applied aisical Mehods Copyigh 008 JMAM, Ic. May, 008, Vol. 7, No. 1, 187-197 1538 947/08/$95.00 A Weighed Movig Aveage Pocess fo Foecasig hou Hsig hih Chis P. Tsokos Uivesiy of ouh Floida The objec of he pese sudy is o popose a foecasig model fo a osaioay sochasic ealizaio. The subjec model is based o modifyig a give ime seies io a ew k-ime movig aveage ime seies o begi he developme of he model. The sudy is based o he auoegessive iegaed movig aveage pocess alog wih is aalyical cosais. The aalyical pocedue of he poposed model is give. A sock XYZ seleced fom he Foue 500 lis of compaies ad is daily closig pice cosiue he ime seies. Boh he classical ad poposed foecasig models wee developed ad a compaiso of he accuacy of hei esposes is give. Key wods: ARIMA, movig aveage, sock, ime seies aalysis Ioducio Time seies aalysis ad modelig plays a vey impoa ole i foecasig, especially whe ou iiial sochasic ealizaio is osaioay i aue. ome of he ieesig ad useful publicaios elaed o he subjec aea ae Akaike (1974), Baejee e al. (1993), Box e al. (1994), Bockwell ad Davis (1996), Dickey ad Fulle (1979), Dickey e al. (1984), Dubi ad Koopma (001), Gade e al. (1980), Havey (1993), Joes (1980), Kwiakowski e al. (199), Roges (1986), aid ad Dickey (1984), akamoo e al. (1986), humway ad offe (006), Tsokos (1973), Wei (006). The subjec of he pese sudy is o begi wih a give ime seies ha chaaceizes hou Hsig hih s eseach ieess ae i developig foecasig ad saisical aalysis ad modelig of ecoomic ad eviomeal poblems. Email: sshih@mail.usf.edu. Chis P. Tsokos is a Disiguished Uivesiy Pofesso i mahemaics ad aisics. His eseach ieess ae i modelig global wamig; aalysis ad modelig of cace daa; paameic, Bayesia ad opaameic eliabiliy; ad sochasic sysems. He is a fellow of AA ad II. Email: pofcp@cas.usf.edu a ecoomic o ay ohe aual pheomeo ad as usual, is osaioay. Box ad Jekis (1994) have ioduced a popula ad useful classical pocedue o develop foecasig models ha have bee show o be uie effecive. I he pese sudy, we ioduce a pocedue fo developig a foecasig model ha is moe effecive ha he classical appoach is ioduced. Fo a give saioay o osaioay ime seies, { x }, geeae a k-day movig aveage ime seies, { y }, ad he developmeal pocess begis. Basic coceps ad aalyical mehods ae eviewed ha ae esseial i sucuig he poposed foecasig model. The eview is based o he auoegessive iegaed movig aveage pocesses. The accuacy of he poposed foecasig model is illusaed by selecig fom he lis of Foue 500 compaies, compay XYZ, ad cosideig is daily closig pices fo 500 days. The classical ime seies model fo he subjec ifomaio alog wih he poposed pocess was developed. A saisical compaiso based o he acual ad foecasig esiduals is give, boh i abula ad gaphical fom. Poposed Foecasig Model: k-h Movig Aveage Befoe ioducig he poposed foecasig model, seveal impoa mahemaical coceps will be defied ha ae esseial i developig he aalyical pocess. I 187
A WEIGHTED MOVING AVERAGE PROCE FOR FORECATING is kow ha i is o possible o poceed i buildig a ime seies model wihou cofomig o ceai mahemaical cosais such as saioaiy of a give sochasic ealizaio. Almos always, he ime seies ha ae give ae osaioay i aue ad he, i is ecessay o poceed o educe i io beig saioay. Le { x } be he oigial ime seies. The diffeece file is give by d ( 1 B), (1) j whee B x = x j, ad d is he degee of diffeecig of he seies. I ime seies aalysis, he pimay use fo he k-h movig aveage pocess is fo smoohig a ealized ime seies. I is vey useful i discoveig a sho-em, log-em eds ad seasoal compoes of a give ime seies. The k-h movig aveage pocess of a ime seies x is defied as follows: { } 1 1 k = x k + 1+ j k j= 0 y, () whee = k, k +1,...,. I ca be see ha as k iceases, he umbe of obsevaios k of { y } deceases, ad { y } ges close ad close o he mea of { x } as k iceases. I addiio, whe k =, { y } educes o oly a sigle obsevaio, ad euals μ, ha is 1 y = x j j = 1 = μ, (3) The poposed model is developed by x io y by applyig (). Afe esablishig he ew asfomig he oigial ime seies { } { } ime seies, usually osaioay, he pocess of educig i io a saioay ime seies is begu. Kwiakowski, Phillips, chmi, ad hi (199) ioduced he KP Tes o check he level of saioaiy of a ime seies. The diffeecig ode d is applied o he ew ime { y seies } fo d = 0,1,,..., he veify he saioaiy of he seies wih he KP es uil he seies become saioay. Theefoe, he osaioay ime seies is educed io a saioay oe afe a pope umbe of diffeecig. The model buildig pocedue is he developed via he poposed foecasig model. Afe choosig a pope degee of diffeecig d, assume diffee odes fo he auoegessive iegaed movig aveage model, ARIMA(p,d,), also kow as Box ad Jekis mehod, whee (p,d,) epese he ode of he auoegessive pocess, he ode of diffeecig ad he ode of he movig aveage pocess, especively. The ARIMA(p,d,) is defied as follows: d φ ( B)(1 B) y = θ ( B), (4) p whee { y } is he ealized ime seies, φ p ad θ ae he weighs o coefficies of he AR ad MA ha dive he model, especively, ad is he adom eo. Wie φ p ad θ as ad φ ( B ) = p (1 φb φ B... φ B ), (5) p 1 θ ( B ) = (1 θ B θ B... θ B ). (6) 1 I ime seies aalysis, someimes i is vey difficul o make a decisio i selecig he bes ode of he ARIMA(p,d,) model whe hee ae seveal models ha all adeuaely epese a give se of ime seies. Hece, Akaile s ifomaio cieio (AIC) (1974), plays a majo ole whe i comes o model selecio. AIC was ioduced by Akaike i 1973, ad i is defied as: AIC(M)= -l[maximum likelihood]+m, (7) whee M is he umbe of paamees i he model ad he ucodiioal log-likelihood fucio suggesed by Box, Jekis, ad Reisel (1994), is give by ( φμθ,, ) l L( φμθσ,,, ) = l πσ,(8) σ whee ( φ, θ ) is he ucodiioal sum of suaes fucio give by p 188
HIH & TOKO ( φ, μθ, ) = [ E( φ, μ, θ, y)] (9) = whee E( φ, θ, y) is he codiioal expecaio of give φ, θ, y. The uaiies φ, μ, ad θ ha maximize (8) ae called ucodiioal maximum likelihood esimaos. ice l L ( φ, θ, σ ) ivolves he daa oly hough ( φ, θ ), hese ucodiioal maximum likelihood esimaos ae euivale o he ucodiioal leas suaes esimaos obaied by miimizig ( φ, θ ). I pacice, he summaio i (9) is appoximaed by a fiie fom ( φ, μθ, ) = = M [ E( φ, θ, y)] (10) whee M is a sufficiely lage iege such ha he back cas iceme E( φ, θ, y) E( 1 φ, θ, y) is less ha ay abiay pedeemied small value fo ( M +1). This expessio implies ha E( φ, θ, y) μ ; hece, E( φ, θ, y) is egligible fo ( M +1). Afe obaiig he paamee esimaes φ, μ, ad θ, he esimae be calculaed fom σ of σ ca he ( φ, θ ) σ =. (11) Fo a ARMA(p,) model based o obsevaios, he log-likelihood fucio is 1 l L = l πσ ( φμθ,, ). (1) σ Poceed o maximize (1) wih espec o he paamees φ, θ, ad σ, fom (11), l L = l σ (1 + l π). (13) Because he secod em i expessio (13) is a cosa, we ca educe he AIC o he followig expessio AIC(M) = lσ + M. (14) The, a appopiae ime seies model is geeaed ad he saisical pocess wih he smalles AIC ca be seleced. The model ideified will possess he smalles aveage mea suae eo. The developme of he model is summaized as follows. Tasfom he oigial ime seies { x } io a ew seies { y }. Check fo saioaiy of he ew ime seies { y } by deemiig he ode of diffeecig d, whee d = 0,1,,... accodig o KP es, uil saioaiy is achieved. Decide he ode m of he pocess. Fo his case, le m = 5 whee p + = m. Afe (d, m ) is seleced, lis all possible se of (p, ) fo p + m. Fo each se of (p, ), esimae he paamees of each model, ha is, φ φ,..., φ, θ, θ,..., 1, p 1 θ Compue he AIC fo each model, ad choose he oe wih smalles AIC. Accodig o he cieio meioed above, he ARIMA(p,d,) model ca be obaied ha bes fi a give ime seies, whee he coefficies ae φ φ,..., φ, θ, θ,..., θ 1, p 1. Usig he model ha we developed fo { y } ad subjec o he AIC cieia, we foecas values of { y } ad poceed o apply he backshif opeao o obai esimaes of he oigial pheomeo x }, ha is, { x = ky x 1 x... x k+ 1. (15) The poposed model ad he coespodig pocedue discussed i his secio shall be illusaed wih eal ecoomic applicaio ad he esuls will be compaed wih he classical ime seies model. 189
A WEIGHTED MOVING AVERAGE PROCE FOR FORECATING Pice 3 4 5 6 7 8 9 30 0 100 00 300 400 500 Time Figue 1. Daily Closig Pice fo ock XYZ Pice 4 5 6 7 8 9 30 31 Oigial Daa Classical ARIMA 0 0 40 60 80 100 Time Figue. Compaisos o Classical ARIMA Model V. Oigial Time eies fo he Las 100 Obsevaios 190
HIH & TOKO Pice -3 - -1 0 1 3 0 100 00 300 400 500 Figue 3. Time eies Plo of he Residuals fo Classical Model Time Table 1. Basic Evaluaio aisics 0.009169 0.1445187 0.380156 0.0170011 Applicaio: Foecasig ock XYZ A sock was seleced fom Foue 500 compaies ha we ideify a (XYZ). The daily closig pice fo 500 days cosiues he ime seies { x }. A plo of he acual ifomaio is give by Figue 1. Fis, develop a ime seies foecasig model of he give osaioay daa usig he odiay Box ad Jekis mehodology. ecodly, we shall modify he give daa, Figue 1, o develop he poposed ime seies foecasig model. A compaiso of he wo models will be give. The geeal heoeical fom of he ARIMA(p,d,) is give by bes AIC scoe is he ARIMA(1,1,). Tha is, a combiaio of fis ode auoegessive (AR) ad a secod ode movig aveage (MA) wih a fis diffeece file. Thus, wie i as (1.9631 B)(1 Bx ) = (1 1.0531 B+.0581 B ) (17) Afe expadig he auoegessive opeao ad he diffeece file, (1 1.9631 B +.9631 B ) x = (18) (1 1.0531 +.0581 ) ad ewie he model as B B d φ p ( B)(1 B) x = θ ( B) (16) Followig he Box ad Jekis mehodology (1994), he classical foecasig model wih he 191
A WEIGHTED MOVING AVERAGE PROCE FOR FORECATING Table. Acual ad Pediced Pice N Acual Pice Pediced Pice Residuals 476 6.78 6.8473-0.0673 477 6.75 6.7976-0.0476 478 6.67 6.7673-0.097 479 6.8 6.69 0.1078 480 6.73 6.8064-0.0764 481 6.78 6.7490 0.0310 48 6.7 6.7911-0.511 483 6.1 6.377-0.077 484 6.3 6.1631 0.1569 485 5.98 6.3364-0.3564 486 5.86 6.0349-0.1749 487 5.65 5.9068-0.568 488 5.67 5.6670 0.0031 489 6.0 5.7119 0.3081 490 6.01 6.0335-0.035 491 6.11 6.047 0.0674 49 6.18 6.1343 0.0457 493 6.8 6.03 0.0768 494 6.39 6.986 0.0914 495 6.46 6.4043 0.0557 496 6.18 6.4743-0.943 497 6.3 6.19 0.0981 498 6.16 6.3354-0.1754 499 6.4 6.1953 0.0447 500 6.07 6.60-0.190 x = 1.9631 x 1.9631x + (19) 1.0531 +.0581 1 by leig = 0, hee is he oe day ahead foecasig ime seies of he closig pice of sock XYZ as x = 1.9631 x 1.9631x (0) 1.0531 +.0581. 1 Usig he above euaio, gaph he foecasig values obaied by usig he classical appoach o op of he oigial ime seies, as show by Figue. The basic saisics ha eflec he accuacy of model (0) ae he mea, vaiace, sadad deviaio ad sadad eo of he esiduals. Figue 3 gives a plo of he esidual ad Table 1 gives he basic saisics. Fuhemoe, esucue he model (0) wih = 475 daa pois o foecas he las 5 19
HIH & TOKO Pice 4 6 8 30 Oigial Daa New eies 0 100 00 300 400 500 Time Figue 4. Thee Days Movig Aveage o Daily Closig Pice of ock XYZ V. he Oigial Time eies obsevaios usig oly he pevious ifomaio. The pupose is o see how accuae ou foecas pices ae wih espec o he acual 5 values ha have o bee used. Table gives he acual pice, pediced pice, ad esiduals bewee he foecass ad he 5 hidde values. The aveage of hese esiduals is = 0. 05608. Poceed o develop he poposed foecasig model. The oigial ime seies of sock XYZ daily closig pices is give by Figue 1. The ew ime seies is beig ceaed by k = 3 days movig aveage ad he aalyical fom of { y } is give by x + x 1 + x y = (1) 3 Figue 4 shows he ew ime seies { y } alog wih he oigial ime seies { x }, ha will be used o develop he poposed foecasig model. Followig he pocedue saed above, he bes model ha chaaceizes he behavio of { y } is ARIMA (,1,3). Tha is, (1.8961 B.0605 B )(1 B) y 3 (1 +.0056 B.0056 B B ) = () Expadig he auoegessive opeao ad he fis diffeece file, we have 3 (1 1.8961 B +.8356 B +.0605 B ) y = (3) 3 (1 +.0056 B.0056 B B ) Thus, wie (3) as y = 1.8961 y 1.8356 y.0605y 3 +.0056 1.0056 3 + (4) The fial aalyical fom of he poposed foecasig model ca be wie as 1.8961 y.8356 y.0605y +.0056.0056 (5) y = 1 3 1 3 Usig he above euaio, a plo of he developed model (5), showig a oe day ahead 193
A WEIGHTED MOVING AVERAGE PROCE FOR FORECATING Pice 4 5 6 7 8 9 30 31 Oigial Daa Poposed Model 0 0 40 60 80 100 Figue 5. Compaisos o Ou Poposed Model V. Oigial Time eies fo he Las 100 Obsevaios Time Pice -3 - -1 0 1 3 0 100 00 300 400 500 Figue 6. Time eies Plo fo Residuals fo Ou Poposed Model Time 194
HIH & TOKO Table 3. Basic Evaluaio aisics 0.01016814 0.143759 0.3791119 0.01698841 Table 4. Acual ad Pediced Pice N Acual Pice Pediced Pice Residuals 476 6.78 6.8931-0.1131 477 6.75 6.7715-0.015 478 6.67 6.711-0.041 479 6.8 6.739 0.0761 480 6.73 6.7854-0.0554 481 6.78 6.689 0.0908 48 6.7 6.89-0.559 483 6.1 6.307-0.187 484 6.3 6.0808 0.39 485 5.98 6.3603-0.3803 486 5.86 5.9868-0.168 487 5.65 5.8443-0.1943 488 5.67 5.7115-0.0414 489 6.0 5.6499 0.3701 490 6.01 5.9650 0.0450 491 6.11 6.056 0.0574 49 6.18 6.091 0.0888 493 6.8 6.1449 0.1351 494 6.39 6.3090 0.0810 495 6.46 6.375 0.0848 496 6.18 6.43-0.43 497 6.3 6.461 0.0739 498 6.16 6.964-0.1364 499 6.4 6.1437 0.0963 500 6.07 6.678-0.1978 195
A WEIGHTED MOVING AVERAGE PROCE FOR FORECATING Table 5. Basic Compaiso o Classical Appoach V. Ou Poposed Model Classical 0.009169 0.1445187 0.380156 0.0170011 Poposed 0.01016814 0.143759 0.3791119 0.01698841 foecasig alog wih he ew ime seies, { y }, is displayed by Figue 5.Noe he closeess of he wo plos ha eflec he ualiy of he poposed model. imila o he classical model appoach ha we discussed ealie, use he fis 475 obsevaios { y 1, y,..., y475} o foecas y 476. The, use he obsevaios y, y,..., } o { 1 y476 foecas y 477, ad coiue his pocess uil foecass ae obaied fo all he obsevaios, ha is, { y 476, y477,..., y500}. Fom euaio (1), he elaioship ca be see bewee he foecasig values of he oigial seies { x } ad he foecasig values of 3 days movig aveage seies y }, ha is, { = 3 y x 1 x x (6) { y,,..., } Hece, afe 476 y477 y500 is esimaed, use he above euaio, (6), o solve he foecasig values fo { x }. Figue 6 is he esidual plo geeaed by he poposed model, ad followed by Table 3, ha icludes he basic evaluaio saisics. Boh of he above displayed evaluaios eflec o accuacy of he poposed model. The acual daily closig pices of sock XYZ fom he 476h day alog wih he foecased pices ad esiduals ae give i Table 4. The esuls give above aes o he good foecasig esimaes fo he hidde daa. Compaiso of he Foecasig Models The wo developed models ae compaed. The classical pocess is give by x 1.9631 x 1.9631x =. (7) 1.0531 +.0581 1 I he poposed model, he followig ivesio is used o obai he esimaed daily closig pices of sock XYZ, ha is, 1.8961 y.8356 y.0605y +.0056.0056. (8) y = 1 3 i cojucio wih 1 3 = 3 y x 1 x x (9) Table 5 give is a compaiso of he basic saisics used o evaluae he wo models ude ivesigaio. The aveage mea esiduals bewee he wo models show ha he poposed model is oveall appoximaely 54% moe effecive i esimaig oe day ahead he closig pice of Foue 500 sock XYZ. Coclusio I he pese sudy a ew ime seies model is ioduced ha is based o he acual sochasic ealizaio of a give pheomeo. The popped model is based o modifyig he give ecoomic ime seies, { x }, ad smoohig i wih k-ime movig aveage o ceae a ew ime 196
HIH & TOKO seies { y }. The basic aalyical pocedues ae developed hough he developig pocess of a foecasig model. A sep-by-sep pocedue is memoized fo he fial compuaioal pocedue fo a osaioay ime seies. To evaluae he effeciveess of ou poposed model We seleced a compay fom he Foue 500 lis, compay XYZ he daily closig pices of he sock fo 500 days was used as ou ime seies daa, { x }, which was as usual osaioay. We developed he classical ime seies foecasig model usig he Box ad Jekis mehodology ad also ou poposed model, { y }, based o a 3-way movig aveage smoohig pocedue. The aalyical fom of he wo foecasig models is peseed ad a compaiso of hem is also give. Based o he aveage mea esiduals, he poposed model was sigificaly moe effecive i such ems of pedicig of he closig daily pices of he sock XYZ. Refeeces Akaike, H. (1974). A New Look a he aisical Model Ideificaio, IEEE Tasacios o Auomaic Cool, AC-19, 716-73. Baejee, A., Dolado, J. J., Galbaih, J. W., & Hedy, D. F. (1993). Coiegaio, Eo Coecio, ad he Ecoomeic Aalysis of No-aioay Daa, Oxfod Uivesiy Pess, Oxfod. Box, G. E. P., Jekis, G. M., & Reisel, G. C. (1994). Time eies Aalysis: Foecasig ad Cool, 3 d ed., Peice Hall, Eglewood Cliffs, NJ., 89-99. Box, G. E. P., Jekis, G. M., & Reisel, G. C. (1994) Time eies Aalysis: Foecasig ad Cool, 3 d ed., Peice Hall, Eglewood Cliffs, NJ., 4-47. Bockwell, P. J., & Davis, R. A. (1996). Ioducio o Time eies ad Foecasig., pige, New Yok., ecios 3.3 ad 8.3. Dickey, D. A., & Fulle, W. A. (1979) Disibuio ad he Esimaos fo Auoegessive Time eies Wih a Ui Roo., Joual of he Ameica aisical Associaio, Vol. 74, No. 366, 47-431. Dickey, D. A., Hasza, D. P., & Fulle, W. A. (1984). Tesig fo Ui Roos i easoal Time eies., Joual of he Ameica aisical Associaio, Vol. 79, No. 386, 355-367. Dubi, J., & Koopma,. J. (001). Time eies Aalysis by ae pace Mehods., Oxfod Uivesiy Pess. Gade, G., Havey, A. C., & Phillips, G. D. A. (1980). Algoihm A154. A algoihm fo exac maximum likelihood esimaio of auoegessive-movig aveage models by meas of Kalma fileig., Applied aisics, 9, 311-3. Havey, A. C. (1993). Time eies Models, d Ediio, Havese Wheasheaf., secios 3.3 ad 4.4. Joes, R. H. (1980). Maximum likelihood fiig of ARMA models o ime seies wih missig obsevaios., Techomeics, 0, 389-395. Kwiakowski, D., Phillips, P. C. B., chmid, P., & hi, Y. (199). Tesig he Null Hypohesis of aioaiy agais he Aleaive of a Ui Roo., Joual of Ecoomeics, 54, 159-178. Roges, A. J. (1986). Modified Lagage Muliplie Tess fo Poblems wih Oe-ided Aleaives, Joual of Ecoomeics, Noh- Hollad., 31, 341-361. aid,. E., & Dickey, D. A. (1984) Tesig fo Ui Roos i Auoegessive- Movig Aveage Models of Ukow Ode., Biomeika, 71, 599-607. akamoo, Y., Ishiguo, M., & Kiagawa, G. (1986). Akaike Ifomaio Cieio aisics., D. Reidel Publishig Compay. humway, R. H., & offe, D.. (006). Time eies Aalysis ad Is Applicaios: wih R Examples, d ed., pige, New Yok. Tsokos, C. P. (1973). Foecasig Models fom No-aioay Time eies-ho Tem Pedicabiliy of ocks., Mahemaical Mehods i Ivesme ad Fiace., Noh Hollad Publishig Co., 50-63. Wei, W. W.. (006). Time eies Aalysis: Uivaiae ad Mulivaiae Mehods, d ed., Peaso Educaio, Ic. 197