A Weighed Moving Aveage Pocess fo Foecasing Shou Hsing Shih Chis P. Tsokos Depamen of Mahemaics and Saisics Univesiy of Souh Floida, USA Absac The objec of he pesen sudy is o popose a foecasing model fo a nonsaionay sochasic ealizaion. The subjec model is based on modifying a given ime seies ino a new k- ime moving aveage ime seies o begin he developmen of he model. The sudy is based on he auoegessive inegaed moving aveage pocess along wih is analyical consains. The analyical pocedue of he poposed model is given. A sock XYZ seleced fom he Foune 500 lis of companies and is daily closing pice consiue he ime seies. Boh he classical and poposed foecasing models wee developed and a compaison of he accuacy of hei esponses is given. Keywods: ARIMA; Moving Aveage; Sock; Time Seies Analysis Inoducion Time seies analysis and modeling plays a vey impoan ole in foecasing, especially when ou iniial sochasic ealizaion is nonsaionay in naue. Some of he ineesing and useful publicaions elaed o he subjec aea ae Akaike (974), Banejee e al. (993), Box e al. (994), Bockwell and Davis (996), Dickey and Fulle (979), Dickey e al. (984), Dubin and Koopman (00), Gadne e al. (980), Havey (993), Jones (980), Kwiakowski e al. (99),
Roges (986), Said and Dickey (984), Sakamoo e al. (986), Shumway and Soffe (006), Tsokos (973), Wei (006). The subjec of he pesen sudy is o begin wih a given ime seies ha chaaceizes an economic o any ohe naual phenomenon and as usual, is nonsaionay. Box and Jenkins (994) have inoduced a popula and useful classical pocedue o develop foecasing models ha have been shown o be quie effecive. In he pesen sudy we inoduce a pocedue fo developing a foecasing model ha is moe effecive han he classical appoach. Fo a given saionay o nonsaionay ime seies, x, we geneae a k-day moving aveage ime seies, y, and ou { developmenal pocess begins. We eview ceain basic conceps and analyical mehods ha ae essenial in sucuing he poposed foecasing model. The eview is based on he auoegessive inegaed moving aveage pocesses. The accuacy of he poposed foecasing model is illusaed by selecing fom he lis of Foune 500 companies, company XYZ, and consideing is daily closing pices fo 500 days. We develop he classical ime seies model fo he subjec infomaion along wih he poposed pocess. A saisical compaison based on he acual and foecasing esiduals is given, boh in abula and gaphical fom. { The Poposed Foecasing Model: k-h Moving Aveage Befoe inoducing ou poposed foecasing model, we shall fis define seveal impoan mahemaical conceps ha ae essenial in developing he analyical pocess. I is known ha one canno poceed in building a ime seies model wihou confoming o ceain mahemaical consains such as saionaiy of a given sochasic ealizaion. Almos always he ime seies ha we ae given ae nonsaionay in naue and hen, we mus poceed o educe i ino being saionay. Le { x be he oiginal ime seies. The diffeence file is given by d ( B), ()
j whee B x = x j, and d is he degee of diffeencing of he seies. In ime seies analysis, he pimay use fo he k-h moving aveage pocess is fo smoohing a ealized ime seies. I is vey useful in discoveing a sho-em, long-em ends and seasonal componens of a given ime seies. The k-h moving aveage pocess of a ime seies { x is defined as follows: k = x k + + j k j= 0 y, () whee = k, k +,..., n. I can be seen ha as k inceases, he numbe of obsevaions k of { y deceases, and y ges { close and close o he mean of { x as k inceases. In addiion, when k = n, { y educes o only a single obsevaion, and equals o μ, ha is y = n x j n j = = μ. (3) We poceed o develop ou poposed model by ansfoming he oiginal ime seies { x ino { y by applying (). Afe esablishing he new ime seies, usually nonsaionay, we begin he pocess of educing i ino a saionay ime seies. Kwiakowski, D., Phillips, P. C. B., Schmid, P., and Shin, Y. inoduced he useful KPSS Tes (99) o check he level of saionaiy of a ime seies. We apply he diffeencing ode d o ou new ime seies { y fo d = 0,,,..., hen veify he saionaiy of he seies wih he KPSS es unil he seies become saionay. Theefoe, we can educe he nonsaionay ime seies ino a saionay one afe a pope numbe of diffeencing. We hen poceed he model building pocedue of developing he poposed foecasing model. Afe choosing a pope degee of diffeencing d, we can poceed he model building pocess by assuming diffeen odes fo he auoegessive inegaed moving aveage model, 3
ARIMA(p,d,q), also known as Box and Jenkins mehod, whee (p,d,q) epesen he ode of he auoegessive pocess, he ode of diffeencing and he ode of he moving aveage pocess, especively. The ARIMA(p,d,q) is defined as follows whee { y d φ ( B)( B) y = θ ( B) ε, (4) p is he ealized ime seies, φ p and θ q ae he weighs o coefficiens of he AR and MA ha dive he model, especively, and ε is he andom eo. We can wie φ p and θ q as and φ ( B) = ( φ B φ B p θ ( B) = ( θ B θ B q q... φ B p... θ B q p q ), (5) ). (6) In ime seies analysis, someimes i is vey difficul o make a decision in selecing he bes ode of he ARIMA(p,d,q) model when we have seveal models ha all adequaely epesen a given se of ime seies. Hence, Akaile s infomaion cieion (AIC) (974), plays a majo ole when i comes o model selecion. AIC was fis inoduced by Akaike in 973, and i is defined as follows: AIC(M) = - ln [maximum likelihood] + M, (7) whee M is he numbe of paamees in he model and he uncondiional log-likelihood funcion suggesed by Box, Jenkins, and Reinsel (994), is given by n S( φ, θ ) ln L( φ, σ ε ) = ln πσ ε, (8) σ whee S ( φ, θ ) is he uncondiional sum of squaes funcion given by n S( φ, θ ) = [ E( ε φ, y)] (9) = whee E( ε φ, y) is he condiional expecaion of ε given φ, y. ε 4
The quaniies φ, μ, and θ ha maximize (8) ae called uncondiional maximum likelihood esimaos. Since ln L ( φ, ) involves he daa only hough S ( φ, θ ), hese σ ε uncondiional maximum likelihood esimaos ae equivalen o he uncondiional leas squaes esimaos obained by minimizing S ( φ, θ ). In pacice, he summaion in (9) is appoximaed by a finie fom n S( φ, θ ) = [ E( ε φ, y)] (0) = M whee M is a sufficienly lage inege such ha he backcas incemen E( ε φ, y) E( ε φ, y) is less han any abiay pedeemined small ε value fo ( M +). This expession implies ha E( ε φ, y) μ ; hence, E( ε φ, y) is negligible fo ( M +). Afe obaining he paamee esimaes φ,, and θ, he esimae of can hen be calculaed fom μ σ ε S ( φ, θ ) σ ε =. () n Fo an ARMA(p,q) model based on n obsevaions, he log-likelihood funcion is n ln L = ln πσε S( φ, θ ). () σ We poceed o maximize () wih espec o he paamees φ, and, fom (), we have n n ln L = lnσ ε ( + ln π ). (3) Since he second em in expession (3) is a consan, we can educe he AIC o he following expession ε σ ε σ ε 5
σ ε AIC(M) = nln + M. (4) Thus, we geneae an appopiae ime seies model and selec he saisical pocess wih he smalles AIC. The model ha we have idenified will possess he smalles aveage mean squae eo. In addiion, we summaize he developmen of he model as follows: Tansfom he oiginal ime seies { x ino a new seies y Check fo saionaiy of he new ime seies { y by deemining he ode of { diffeencing d, whee d = 0,,,... accoding o KPSS es, unil we achieve saionaiy Deciding he ode m of he pocess, fo ou case, we le m = 5 whee p + q = m Afe (d, m ) being seleced, lising all possible se of (p, q) fo p + q m Fo each se of (p, q), esimaing he paamees of each model, ha is,, φ,..., φ p, θ, θ θ q φ,..., Compue he AIC fo each model, and choose he one wih smalles AIC Accoding o he cieion ha we menioned above, we can obain he ARIMA(p,d,q) model ha bes fi a given ime seies, whee he coefficiens ae φ φ,..., φ, θ, θ,..., θ values of phenomenon Using he model ha we developed fo { y, p q. and subjec o he AIC cieia, we foecas and poceed o apply he back-shif opeao o obain esimaes of he oiginal { x, ha is, { y x = k y x k x... x +. (5) The poposed model and he coesponding pocedue discussed in his secion shall be illusaed wih eal economic applicaion and he esuls will be compaed wih he classical ime seies model. Applicaion: Foecasing Sock XYZ 6
We seleced a sock fom foune 500 companies ha we idenify as (XYZ). We shall use he daily closing pice fo 500 days ha will consiue he ime seies infomaion is given by Figue. { x. A plo of he acual Pice 3 4 5 6 7 8 9 30 0 00 00 300 400 500 Time Figue. Daily Closing Pice fo Sock XYZ Fis, we shall develop a ime seies foecasing model of he given nonsaionay daa using he odinay Box and Jenkins mehodology. Secondly, we shall modify he given daa, Figue, o develop ou poposed ime seies foecasing model. A compaison of he wo models will be given. The geneal heoeical fom of he ARIMA(p,d,q) is given by d φ ( B)( B) x = θ ( B) ε. (6) p Following he Box and Jenkins mehodology (994), he classical foecasing model wih he bes AIC scoe is he ARIMA(,,). Tha is, a combinaion of fis ode auoegessive (AR) and a second ode moving aveage (MA) wih a fis diffeence file. Thus, we can wie i as q (.963B)( B) x = (.053B +.058B ) ε. (7) 7
Afe expanding he auoegessive opeao and he diffeence file, we have and we may ewie he model as (.963B +.963B ) x = (.053B +.058B ) ε (8) x =.963x.963x +.053ε +. 058ε ε (9) by leing ε = 0, we have he one day ahead foecasing ime seies of he closing pice of sock XYZ as x =.963x.963x.053ε +. 058ε. (0) Using he above equaion, we gaph he foecasing values obained by using he classical appoach on op of he oiginal ime seies, as shown by Figue. Pice 4 5 6 7 8 9 30 3 Oiginal Daa Classical ARIMA 0 0 40 60 80 00 Time Figue. Compaisons on Classical ARIMA Model VS. Oiginal Time Seies The basic saisics ha eflec he accuacy of model (0) ae he mean, vaiance S, sandad deviaion S and sandad eo S of he esiduals. Figue 3 gives a plo of he esidual and n Table gives he basic saisics. 8
Pice -3 - - 0 3 0 00 00 300 400 500 Time Figue 3. Time Seies Plo of he Residuals fo Classical Model Table. Basic Evaluaion Saisics S S S n 0.00969 0.44587 0.38056 0.0700 Fuhemoe, we esucue he model (0) wih n = 475 daa poins o foecas he las 5 obsevaions only using he pevious infomaion. The pupose is o see how accuae ou foecas pices ae wih espec o he acual 5 values ha have no been used. Table gives he acual pice, pediced pice, and esiduals beween he foecass and he 5 hidden values. 9
Table. Acual and 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.078 480 6.73 6.8064-0.0764 48 6.78 6.7490 0.030 48 6.7 6.79-0.5 483 6. 6.377-0.077 484 6.3 6.63 0.569 485 5.98 6.3364-0.3564 486 5.86 6.0349-0.749 487 5.65 5.9068-0.568 488 5.67 5.6670 0.003 489 6.0 5.79 0.308 490 6.0 6.0335-0.035 49 6. 6.047 0.0674 49 6.8 6.343 0.0457 493 6.8 6.03 0.0768 494 6.39 6.986 0.094 495 6.46 6.4043 0.0557 496 6.8 6.4743-0.943 497 6.3 6.9 0.098 498 6.6 6.3354-0.754 499 6.4 6.953 0.0447 500 6.07 6.60-0.90 The aveage of hese esiduals is = 0. 05608. We poceed o develop he poposed foecasing model. The oiginal ime seies of sock XYZ daily closing pices is given by Figue. The new ime seies is being ceaed by k = 3 days moving aveage and he analyical fom of { y is given by y x + x 3 + x =. () Figue 4 shows he new ime seies { y along wih he oiginal ime seies x, ha we shall use o develop he poposed foecasing model. { 0
Pice 4 6 8 30 Oiginal Daa New Seies 0 00 00 300 400 500 Time Figue 4. Thee Days Moving Aveage on Daily Closing Pice of Sock XYZ Vs. he oiginal ime seies Following he pocedue we have saed above, he bes model ha chaaceizes he behavio of { y o be ARIMA(,,3). Tha is, (.896B.0605B )( B) y = ( +.0056B.0056B 3 B ) ε. () Expanding he auoegessive opeao and he fis diffeence file, we have (.896B +.8356B 3 +.0605B ) y = ( +.0056B.0056B B 3 ) ε. (3) Thus, we can wie (3) as y =.896y.8356y.0605y 3 + +.0056ε. 0056ε ε 3 ε. (4) The final analyical fom of he poposed foecasing model can be wien as y =.896y.8356y.0605y 3 +.0056ε. 0056ε ε 3. (5) Using he above equaion, a plo of he developed model (5), showing a one day ahead foecasing along wih he new ime seies, y, is displayed by Figue 5. {
Pice 4 5 6 7 8 9 30 3 Oiginal Daa Poposed Model 0 0 40 60 80 00 Time Figue 5. Compaisons on Ou Poposed Model VS. Oiginal Time Seies Noe he vey closeness of he wo plos ha eflec he qualiy of he poposed model. Simila o he classical model appoach ha we discussed ealie, we shall use he fis 475 obsevaions y, y,..., o foecas. Then we use he obsevaions { y475 y 476 { y, y,..., y476 o foecas y 477, and coninue his pocess unil we obain foecass all he obsevaions, ha is, { y476, y477,..., y500. Fom equaion (), we can see he elaionship beween he foecasing values of he oiginal seies { x and he foecasing values of 3 days moving aveage seies { y,ha is, x = 3 y x x. (6) Hence, afe we esimaed { y476, y477,..., y500, we can use he above equaion, (6), o solve he foecasing values fo { x. Figue 6 is he esidual plo geneaed by ou poposed model, and followed by Table 3, ha includes he basic evaluaion saisics.
Pice -3 - - 0 3 0 00 00 300 400 500 Time Figue 6. Time Seies Plo fo Residuals fo Ou Poposed Model Table 3. Basic Evaluaion Saisics S S S n 0.00684 0.43759 0.3799 0.069884 Boh of he above displayed evaluaions eflec on accuacy of he poposed model. The acual daily closing pices of sock XYZ fom he 476 h day along wih he foecased pices and esiduals ae given in Table 4. 3
Table 4. Acual and Pediced Pice N Acual Pice Pediced Pice Residuals 476 6.78 6.893-0.3 477 6.75 6.775-0.05 478 6.67 6.7-0.04 479 6.8 6.739 0.076 480 6.73 6.7854-0.0554 48 6.78 6.689 0.0908 48 6.7 6.89-0.559 483 6. 6.307-0.87 484 6.3 6.0808 0.39 485 5.98 6.3603-0.3803 486 5.86 5.9868-0.68 487 5.65 5.8443-0.943 488 5.67 5.75-0.044 489 6.0 5.6499 0.370 490 6.0 5.9650 0.0450 49 6. 6.056 0.0574 49 6.8 6.09 0.0888 493 6.8 6.449 0.35 494 6.39 6.3090 0.080 495 6.46 6.375 0.0848 496 6.8 6.43-0.43 497 6.3 6.46 0.0739 498 6.6 6.964-0.364 499 6.4 6.437 0.0963 500 6.07 6.678-0.978 The Resuls given above aes o he good foecasing esimaes fo he hidden daa. Compaison of he Foecasing Models given by In his secion, we shall compae he wo developed models. The classical pocess is x =.963x.963x.053ε +. 058ε. (7) In ou poposed model, we shall use he following invesion o obain he esimaed daily closing 4
pices of sock XYZ, ha is, y =.896y.8356y.0605y 3 +.0056ε. 0056ε ε 3 (8) in conjuncion wih x = 3 y x x. (9) The able given below is a compaison of he basic saisics used o evaluae he wo models unde invesigaion. Table 5. Basic Compaison on Classical Appoach Vs. Ou Poposed model S S S n Classical 0.00969 0.44587 0.38056 0.0700 Poposed 0.00684 0.43759 0.3799 0.069884 The aveage mean esiduals beween he wo models shown ha he poposed model is oveall appoximaely 54% moe effecive in esimaing one day ahead he closing pice of Foune 500 sock XYZ. Conclusion In he pesen sudy we inoduced a new ime seies model ha is based on he acual sochasic ealizaion of a given phenomenon. The poposed model is based on modifying he given economic ime seies, ime seies, { y { x, and smoohing i wih k-ime moving aveage o ceae a new. We developed he basic analyical pocedues hough he developing pocess of a foecasing model. A sep-by-sep pocedue is memoized fo he final compuaional pocedue fo a nonsaionay ime seies. To evaluae he effeciveness of ou poposed model we seleced a company fom he Foune 500 lis, company XYZ, he daily closing pices of he sock fo 500 days was used as ou ime seies daa, { x, which was as usually nonsaionay. We 5
develop he classical ime seies foecasing model using he Box and Jenkins, mehodology and also ou poposed model, { y, based on a 3-day moving aveage smoohing pocedue. The analyical fom of he wo foecasing models is pesened and a compaison of hem also given. Based on he aveage mean esiduals he poposed model was significanly moe effecive in such em of pedicing of he closing daily pices of sock XYZ. Refeences Akaike, H. (974). A New Look a he Saisical Model Idenificaion, IEEE Tansacions on Auomaic Conol, AC-9, 76-73. Banejee, A., Dolado, J. J., Galbaih, J. W., & Hendy, D. F. (993). Coinegaion, Eo Coecion, and he Economeic Analysis of Non-Saionay Daa, Oxfod Univesiy Pess, Oxfod. Box, G. E. P., Jenkins, G. M., & Reinsel, G. C. (994). Time Seies Analysis: Foecasing and Conol, 3 d ed., Penice Hall, Englewood Cliffs, NJ., 89-99. Box, G. E. P., Jenkins, G. M., & Reinsel, G. C. (994) Time Seies Analysis: Foecasing and Conol, 3 d ed., Penice Hall, Englewood Cliffs, NJ., 4-47. Bockwell, P. J., & Davis, R. A. (996). Inoducion o Time Seies and Foecasing., Spinge, New Yok., Secions 3.3 and 8.3. Dickey, D. A., & Fulle, W. A. (979) Disibuion and he Esimaos fo Auoegessive Time Seies Wih a Uni Roo., Jounal of he Ameican Saisical Associaion, Vol. 74, No. 366, 47-43. Dickey, D. A., Hasza, D. P., & Fulle, W. A. (984). Tesing fo Uni Roos in Seasonal Time Seies., Jounal of he Ameican Saisical Associaion, Vol. 79, No. 386, 355-367. Dubin, J., & Koopman, S. J. (00). Time Seies Analysis by Sae Space Mehods., Oxfod Univesiy Pess. Gadne, G., Havey, A. C., & Phillips, G. D. A. (980). Algoihm AS54. An algoihm fo exac maximum likelihood esimaion of auoegessive-moving aveage models by means of Kalman fileing., Applied Saisics, 9, 3-3. Havey, A. C. (993). Time Seies Models, nd Ediion, Havese Wheasheaf., secions 3.3 and 4.4. Jones, R. H. (980). Maximum likelihood fiing of ARMA models o ime seies wih missing obsevaions., Technomeics, 0, 389-395. 6
Kwiakowski, D., Phillips, P. C. B., Schmid, P., & Shin, Y. (99). Tesing he Null Hypohesis of Saionaiy agains he Alenaive of a Uni Roo., Jounal of Economeics, 54, 59-78. Roges, A. J. (986). Modified Lagange Muliplie Tess fo Poblems wih One-Sided Alenaives, Jounal of Economeics, Noh-Holland., 3, 34-36. Said, S. E., & Dickey, D. A. (984) Tesing fo Uni Roos in Auoegessive-Moving Aveage Models of Unknown Ode., Biomeika, 7, 599-607. Sakamoo, Y., Ishiguo, M., & Kiagawa, G. (986). Akaike Infomaion Cieion Saisics., D. Reidel Publishing Company. Shumway, R. H., & Soffe, D. S. (006). Time Seies Analysis and Is Applicaions: wih R Examples, nd ed., Spinge, New Yok. Tsokos, C. P. (973). Foecasing Models fom Non-Saionay Time Seies-Sho Tem Pedicabiliy of Socks., Mahemaical Mehods in Invesmen and Finance., Noh Holland Publishing Co., 50-63. Wei, W. W. S. (006). Time Seies Analysis: Univaiae and Mulivaiae Mehods, nd ed., Peason Educaion, Inc. 7