Summer Term 2009 Alber-Ludwigs-Universiä Freiburg Empirische Forschung und Okonomerie Time Series Analysis
Classical Time Series Models Time Series Analysis Dr. Sevap Kesel 2
Componens Hourly earnings: Manufacuring: Major seven counries 1995=100 120 100 80 60 40 Trend: The long-erm general change in he level of he daa wih a duraion of longer han a year. I can be linear, non-linear, i.e. exponenial, quadraic 20 0 Sep-70 Sep-80 Sep-90 Sep-00 600 Hungary: Commodiy oupu: Cemen '000 onnes Seasonal variaions: Regular wavelike flucuaions of consan lengh, repeaing hemselves wihin a period of no longer han a year. 0 year. Dec-82 Dec-85 Dec-88 Dec-91 Dec-94 Dec-97 Dec-00 500 400 300 200 100
Componens Cyclical variaions: Wavelike movemens, quasi regular flucuaions around he long-erm rend, lasing longer han a year. Example: Business cycles 40000 35000 30000 25000 Aus: Dwelling unis approved: Privae: New houses Number 20000 15 10 5 0-5 -10-15 1 4 7 1 0 1 3 1 6 1 9 2 2 2 5 2 8 3 1 3 4 3 7 4 0 4 3 4 6 4 9 5 2 5 5 5 8 6 1 6 4 15000 Dec-70 Dec-75 Dec-80 Dec-85 Dec-90 Dec-95 Dec-00 Irregular Componen: The random variaions of he daa comprise he deviaions of he observed ime series from he underlying paern.
Two models: Componens T: Trend, S: Seasonal, C: Cyclical, I: Irregular Addiive Model: Y = T +S + C +I Muliplicaive Model: Y = T xs x C xi Two ypes of mehods for idenifying he paern: Smoohing and Decomposiion
Smoohing The random flucuaions are removed from he daa by smoohing he ime series. Two echniques Moving averages For a given ime period is he (arihmeic) average of he values in ha ime period and hose close o i. Exponenial Smoohing The exponenially smoohed value for a given ime period is he weighed average of all he available values up o ha period.
SMOOTHING TECHNIQUES They are used o remove, or a leas reduce, he random flucuaions in a ime series so as o more clearly expose he exisence of he oher componens. There are wo ypes of smoohing mehods. Moving averages: A moving average for a given ime period is he (arihmeic) average of he values in ha ime period and hose close o i. Exponenial smoohing: The exponenially smoohed value for a given ime period is he weighed average of all he available values up o ha period. Ex 1:The daily (Monday Friday) sales figures during he las four weeks were recorded in a medium-size merchandising firm.
70 60 Sales 50 40 30 20 10 0 week 1 week 2 week 3 week 4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 This ime series seems o have a sligh upward linear rend and weekly seasonal variaions. Day We calculae 3-day moving averages. Day Sales 3-day moving 3-day moving sum average 1 43 2 45 110.0 36.7 3 22 92.0 30.7 4 25 78.0 26.0 5 31 107.0 35.7 6 51 ec. ec. 110 43 + 45 + 22 = 110 = 36. 67 3 No MA value for he firs (neiher for he las) day.
c) We calculae 5-day moving averages and plo he original ime series and he 3-day, 5-day moving averages (MA(3) and MA(5), respecively) on he same graph. Sales 70 60 50 40 30 20 10 0 MA(3) MA(5) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Day This figure suggess ha he longer he moving average period i. he sronger he smoohing effec, ii. he shorer he smoohed series. When he moving average period is relaively large, along wih he random variaions, he seasonal and cyclical variaions are also removed and only he long-erm rend can be revealed.
The second ype of smoohing echniques is exponenial smoohing. S = wy + ( 1 w) S 1 where S : exponenially smoohed value for ime period ; S -1 : exponenially smoohed value for ime period -1; Y : observed value for ime period ; w : smoohing consan, 0 < w < 1. Noe: a) Assuming ha Y has been observed from = 1, his formula can be applied only from he second ime period. For = 1 we se he smoohed value equal o he observed value, i.e. S 1 = Y 1. b) The smoohing consan deermines he srengh of smoohing, he larger he value of w he weaker he smoohing effec. c) The formula for he exponenially smoohed series can be expanded as follows:
S = wy + ( 1 w) S 1 = wy + (1 w)( wy 1 + (1 w) S 2 ) S -1 2 = wy + w( 1 w) Y 1 + (1 w) S 2 = K = = wy + w K 2 3 1 ( 1 w) Y 1 + w(1 w) Y 2 + w(1 w) Y 3 + + w(1 w) Y1 The exponenially smoohed value for period depends on all available observaions from he firs period hrough period, bu he weighs assigned o pas observaions, w(1-w) i, decline geomerically wih he age of he observaions (i ). Beyond a cerain age he observaions do no really coun since hey do no have measurable effecs on he exponenially smoohed value.
0.7 0.6 0.5 w(1-w) i w = 0.6 0.4 0.3 0.2 0.1 0 w = 0.4 w = 0.2 i 1 2 3 4 5 6 7 8 9 10 This graph shows ha if w = 0.2, w(1 even w(1-w) 10 is subsanial. On he oher hand, if w = 0.6, w(1-w) i approaches zero much faser and a i = 6 i is already negligible. (1-w) i approaches zero relaively slowly and
Decomposiion Trend analysis:y =a+b+ε Cyclical Effec: Assume Y = T xc Cyclical Facor: Seasonal Effec: Assume Y = T xs xi Seasonal Facor: C = Y T y ˆ 100 % y S xi y yˆ = Y T
HOW TO CAPTURE THE TREND, CYCLICAL 1) Trend analysis AND SEASONAL COMPONENTS? Smoohing procedures are used o faciliae he idenificaion of he sysemaic componens of he ime series. If we manage o decompose he ime series ino he rend, seasonal and cyclical componens, hen we can consruc a forecas by projecing hese pars ino he fuure. The easies way of isolaing a long-erm linear rend is by simple linear regression, where he independen variable is he ime variable. y β + β + ε = 0 1 and is equal o 1 for he firs ime period in he sample and increases by one each period hereafer. Afer having creaed his variable, his linear ime rend model can be esimaed as any oher simple linear regression model. Noe: This model is no appropriae if he rend is likely o be non-linear.
Ex 3: The graph below shows Ausralian expors of foowear ($m) from 1988 hrough 2000. 70 Expors: 85: Foowear: ANNUAL $m 60 50 40 30 This ime series has an upward rend, which is perhaps linear, perhaps no. 20 10 1988 1990 1992 1994 1996 1998 2000 a) Esimae a linear rend line by sofware Firs you have o creae a ime variable and hen regress fwexpor on. yˆ = 15.308 + 4. 505 1988 1 14 1989 2 23 1990 3 22 1991 4 30 1992 5 36 1993 ec ec
80 70 60 50 40 30 20 10 0 yˆ = 15.308 + 4. 505 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 fwexpor y-ha Noe: In he firs year of he sample period = 1 no 0. ˆ0 β = 15.308 ˆ1 β = 4.505 In 1987 ( = 0) he rend value of foowear expors is 15.308 $m. $ Each year he rend value of foowear expors increases by 4.505 m. 1) i is yˆ = 15.308 + 4.505 1 = 19.813 $m Therefore, for example, in 1988 ( = 1) i is and in 1999 ( = 12) i is yˆ = 15.308 + 4.505 12 = 69.368 $m
2) Measuring he cyclical effec Assume ha he ime series model is muliplicaive and consiss of only wo pars: he rend and he cyclical componens so ha Y = T C C = Under hese assumpions he cyclical effec can be measured by expressing he acual daa as he percenage of he rend: y yˆ 100% (Ex 3) b) Calculae and plo he percenage of rend. year fwexpor y-ha y/y-ha*100 1988 1 14 19.81 70.66 1989 2 23 24.32 94.58 1990 3 22 28.82 76.32 1991 4 30 33.33 90.01 1992 5 ec. ec. ec. ˆ 14 /19.81*100 Y T 71 So in 1988 he acual expors of foowear were abou 29% below he rend line.
130 120 110 100 Expansion phase Boom 90 80 70 60 Recession y / y ˆ 100 Conracion phase 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 Noe: We have assumed ha he ime series paern does no have a seasonal componen and ha he random variaions are negligible. In Ex 3 he firs of hese assumpions is cerainly saisfied since he daa is annual. However, when hese assumpions are invalid, we should remove he seasonal and random variaions before aemping o idenify he rend and cyclical componens.
3) Measuring he seasonal effec Depending on he naure of he ime series, he seasonal variaions can be capured in differen ways. i. Assume, for example, ha he ime series does no conain a discernible cyclical componen and can be described by he following muliplicaive model Y = T S R = S R T Y This suggess ha dividing he esimaed rend componen (y-ha) ino he ime series we obain an esimae for he produc of he seasonal and random variaions. Seasonal facor: y In order o remove he random variaions from his raio, we average he seasonal facors for each season and adjus hese averages o ensure ha hey add up o he number of seasons. Seasonal indices / yˆ
Ex 4: The graph below shows reail urnover for households goods ($m) for Ausralia from he second quarer of 1982 hrough he fourh quarer of 2000. 5000 Reail urnover: Original: Household good reailing: QUARTERLY $m 4500 4000 3500 3000 2500 2000 This ime series has an upward linear rend and quarerly seasonal variaions. I probably has some cyclical variaions oo, bu his hird componen seems o be less significan han he oher wo. 1500 Dec-82 Dec-85 Dec-88 Dec-91 Dec-94 Dec-97 Dec-00 a) Esimae a linear rend line wih sofware. yˆ = 1589.189 + 36.604
yˆ = 1589.189 + 36.604 b) Calculae he seasonal facors and he seasonal indices. quarer reail y-ha y/y-ha Jun-82 1 1553.2 1625.8 0.955 Sep-82 2 1601.9 1662.4 0.964 Dec-82 3 2052.2 1699.0 1.208 Mar-83 4 1666.0 1735.6 0.960 Jun-83 5 1680.4 1772.2 0.948 Sep-83 6 ec. ec. ec. 1553.2 /1625.8 = 0.955 In order o find he seasonal indices he seasonal facors (y / y-ha) have o be grouped, averaged and, if necessary, adjused.
Year Q1 Q2 Q3 Q4 1982 0.955 0.964 1.208 1983 0.960 0.948 0.962 1.240 1984 0.948 0.890 0.905 1.163 ec. ec. ec. ec. ec. 4.000 0.929 = 0.930 3.997 1998 0.914 0.908 0.909 1.031 1999 0.909 0.922 0.971 1.129 2000 0.973 1.043 0.990 1.144 Sum 16.728 18.062 18.283 21.945 Toal Average 0.929 0.951 0.962 1.155 3.997 Index 0.930 0.951 0.963 1.156 4.000 I Mar = 93.0% I Sep = 96.3% I = 95.1% = 115.6% Jun I Dec These seasonal indices sugges ha in he March, June and Sepember quarers reail urnover is expeced o be 7.0, 4.9 and 3.7% below is rend value, while in he December quarer reail urnover is expeced o be 15.6% above is rend value.
ii. When he ime series model is muliplicaive and has all four pars, i.e. a rend, a cyclical componen, a seasonal componen and random variaions, Y = T C S R he daa is firs divided by (cenered) moving averages, which are supposed o capure he rend and cyclical componens, CMA Y Y = = S R CMA T C = T C Then he seasonal facors and indices are calculaed from hese raio-o-moving averages: Y / CMA and he rend and cyclical componens are esimaed from he cenered moving averages, insead of he original daa. Noe: The order of he cenered moving average mus be equal o he number of seasons. For example, we use 4-quarer CMA if he daa is quarerly and seasonaliy has 4 phases a year, and we use 12-monh CMA if he daa is monhly and seasonaliy has 12 phases a year.
(Ex 4) c) Re-esimae esimae he seasonal componen using he raio-o o- moving average insead of he original daa. quarer reail cma(4) Jun-82 1 1553.2 MISSING Sep-82 2 1601.9 MISSING Dec-82 3 2052.2 1734.2 Mar-83 4 1666.0 1767.3 Jun-83 5 1680.4 1814.0 Sep-83 6 ec. ec. Following he same seps han in par (b) we ge he following seasonal indices: I = 93.0% I = 94.8% I = 96.5% = 115.7% Mar This ime here is no much difference beween he indices compued from he original daa and he indices compued from he cenered moving averages. The seasonal indices can be used o deseasonalise a ime series, i.e. o remove he seasonal variaions from he daa. The seasonally adjused daa (in publicaions usually denoed as sa) ) is obained by dividing he observed, unadjused daa by he seasonal indices. E.g.: For he June quarer of 1982 he seasonally adjused reail urnover is 1553.2 / 94.8 100 = 1638.2 $m Jun Sep I Dec
FORECASTING Afer having sudied he hisorical paern of a ime series, if here is reason o believe ha he mos imporan feaures of he variable do no change in he fuure, we can projec he revealed paern ino he fuure in order o develop forecass. If a ime series exhibis no (or hardly any) rend, cyclical and seasonal variaions, exponenial smoohing can provide a useful forecas for one period ahead: F +1 = S Ex 1: We have applied exponenial smoohing wih w = 0.2 and w = 0.7 on quarerly Ausralian unemployed persons (in housands). Since his ime series does have some seasonal variaions, exponenial smoohing canno be expeced o forecas unemploymen reasonably well. Neverheless, jus for illusraion, le us forecas unemploymen for he firs quarer of 1999.
unemployed S (w=0.7) 1998 1 2461.4 2402.8 2 2210.9 2268.5 3 2221.3 2235.5 4 2102.6 2142.5 1999 1 na This is he smoohed value for he fourh quarer of 1998, and hus he forecas for he firs quarer of 1999. If a ime series exhibis a long-erm (linear) rend and seasonal variaions, we can use regression analysis o develop forecass in wo differen ways. 1) We can forecas using he esimaed rend and seasonal indices as: F = T S = ˆ β + ˆ 0 β ) ( 1 I 2) Alernaively, we can forecas using he esimaed muliple regression model wih a ime variable and seasonal dummy variables. This second approach is beyond he scope of your syllabus.
Ex 2: Forecas reail urnover for households goods for he firs quarer of 2001 applying he firs approach can be implemened as follows. Obain he rend esimae from par a and he March seasonal index from par b so ha = 76, I 76 = I Mar = 0.930 and yˆ = 1589.189 + 36.604 F = y ˆ = (1589.2 + 36.6 76) 0.930 = 4064.8 76 76 We have prediced reail urnover for households goods for he firs quarer of 2001. Suppose we had anoher forecas value of 4203.4 for he same daa and he same ime period using a differen forecasing model. How would we decide which forecas is more accurae?
In rerospec i is easy o answer his quesion, we jus have o calculae he forecas error for each forecasing model. The difference beween he acual and forecas values, i.e. e = y F (Ex 2) f) Suppose ha one quarer passed since we prediced reail urnover for households goods for he firs quarer of 2001. The acual value of reail urnover for households goods in his quarer was 4277.1 $m. Compare he wo forecass from par e.. Which model proved o be more accurae? The forecas errors for he firs quarer of 2001 ( = 76) are he following. Model 1 : e76 = y76 F76 = 4277.1 4064.8 = 212.3 Model 2 : e76 = y76 F76 = 4277.1 4203.4 = 73.7 Boh forecas errors are posiive, i.e. boh models overesimae reail urnover for he firs quarer of 2001, bu he forecas from Model 2 is more accurae.
However, his does no imply by any means ha Model 2 would produce more accurae forecas for all ime periods han Model 1. How can we decide which forecasing model is he mos accurae in a given siuaion? Forecas he variable of ineres for a number of of ime periods using alernaive models and evaluae some measure(s) of forecas accuracy for each of hese models. Among a number of possible crieria ha can be used for his purpose he wo mos commonly used are Mean absolue deviaion: 1 n n = 1 MAD = y F Noe: SSFE 1 n n = 1 SSFE = y F Sum of squares of forecas error: ( ) 2 SSFE is he beer measure if relaively large errors are o be penalised.
Ex 3: Two forecasing models were used o predic he fuure values They are shown nex, ogeher wih he acual values. For each model, we calculae MAD and SSFE o deermine which was more accurae. y F Model 1 Model 2 6.0 7.5 6.3 6.6 6.3 6.7 7.3 5.4 7.1 9.4 8.2 7.5 e Model 1 Model 2-1.5-0.3 0.3-0.1 1.9 0.2 1.2 1.9 e Model 1 Model 2 1.5 0.3 0.3 0.1 1.9 0.2 1.2 1.9 e 2 Model 1 Model 2 2.25 0.09 0.09 0.01 3.61 0.04 1.44 3.61 Toal: 4.9 2.5 7.39 3.75 6.0 7.5-1.5 Model 1 : MAD = 4.9/4=1.225 and SSFE = 7.39/4=1.8475 Model 2 : MAD = 2.5/4=0.625 and SSFE = 3.75/4=0.9375 According o boh crieria Model 2 is he more accurae. (-1.5) 2