THE UNIVERITY OF TEXA AT AUTIN McCombs chool of Business TA 7.5 Tom hively CLAICAL EAONAL DECOMPOITION - MULTIPLICATIVE MODEL Examples of easonaliy 8000 Quarerly sales for Wal-Mar for quarers a l e s 6000 000 000 0 600000 Quarerly sales for The Gap for quarers 800000 0
Quarerly daa for privae housing sars for 6 quarers 00 00 00 00 Monhly U.. clohing sales for years 6000 000 8000 000 Jan Jan Jan Jan Jan Jan Jan Jan Jan Jan Jan Jan
A ime series is ypically decomposed ino four componens: () easonal componen ( ); () Trend componen (T ); () Cyclical componen (C ); () Irregular componen (I ). The rend and cyclical componens are ofen difficul o separae excep in he long run. (ee he figures on he following page.) For his reason, he rend and cyclical componens are ofen combined ino one componen - he Trend/Cycle componen (TC ). Two ypes of models are used for seasonal decomposiion: () Addiive model: y = T C I or y = TC I () Muliplicaive model: y = T C I or y = TC I We will discuss muliplicaive models since hese are ypically he models ha are used in pracice. Muliplicaive models are used when here is increasing volailiy such as in he sales daa from The Gap (see page ). The reason for he increasing volailiy in ales for The Gap is ha ales grow abou 0% on average beween he hird and fourh quarer every year. A he beginning of he series, where ales are approximaely $00 million, a 0% change in ales from he hird o fourh quarer gives a change of (0.0)($00m) = $0m. A he end of he series, where ales are approximaely $,000 million (i.e. $ billion), a 0% change in ales gives a change of (0.0)($,000m) = $00m.
Copper prices (in consan 997 dollars) ploed for differen lengh periods Copper Prices - 8 Monhs Copper Prices - Years 5.5 6.5.5 5.5 Jan, 956 Jan, 957 Jan, 958 9 9 95 96 97 Copper Prices - Years Copper Prices - 98 Years 5.5.5 9 7.5 5.5 95 956 96 800 850 900 950 000
Calculaion of Cenered Moving Averages Excel preadshee for Compuing Cenered Moving Averages Row A B C D Y 7. 65.0 76.95 ThreeYearMovingAverage (y - y y )/ 75.0 = AVERAGE(A:A) 76.06 = AVERAGE(A:A5) 5 87. 868.78 FiveYearMovingAverage (y - y - y y y )/5 797.9 = AVERAGE(A:A6) 808.8 = AVERAGE(A:A7) 6 969.6 876.6 859. evenyearmovingaverage (y - y - y - y y y y )/7 795.88 = AVERAGE(A:A8) 8.87 = AVERAGE(A:A9) 7 785.69 886.69 895.59 87.8 8 905. 878.8 880.8 879.7 9 9.75 88.07 85.77 0 800.6 86.0 88.9 000 Y and Three-Year Moving Average 800 600 5 6 7 8 9 0 Y ThreeYearMovingAverage 5
Classical easonal Decomposiion for he Muliplicaive Model: y = TC I From here on, he Trend/Cycle componen will be denoed T (raher han TC ). Four eps in a Classical easonal Decomposiion Procedure for a Muliplicaive Model () Compue an iniial esimae of he Trend/Cycle componen T (he esimae is denoed Tˆ ) using he cenered moving average Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y. () Compue y ˆ. This is an esimae of he I componens. T () Compue an esimae of (denoed Ŝ ) by averaging he esimaes of he I componens across corresponding quarers o average ou he I componens. For example, for quarerly daa, he I erm is averaged across all he firs quarers, all he second quarers, ec. () easonally adjus he original daa using y ˆ. 6
Imporan Quesion Regarding ep : How good an esimae is Tˆ of T? To answer his quesion, firs consider annual (simulaed) daa wih no seasonaliy. Therefore, he model is y = T I. Row A B C D Year Trend T Irregular I Daa=Trend*Irregular y = T I 00.000 0.997 99.667 0.000 0.98 0.7 06.090 0.98 0.7 5 09.7 0.877 95.780 6 5.55.05. 7 6 5.97 0.95 08.0 8 7 9.05 0.906 08.97 9 8.987 0.970 9.67 0 9 6.677.66 7.78 0 0.77.0..9 0.878 8.0 8. 0.98 6.056.576 0.85 0.5 5 6.85.09 60.0 6 5 5.59.0 66.88 7 6 55.797.08 58.60 8 7 60.7.05 67.70 9 8 65.85.000 65. 0 9 70..00 7.66 0 75.5.050 8.06 80.6 0.96 7.8 86.09 0.970 80.56 9.60 0.95 8.00 5 97.59 0.897 77.050 6 5 0.79.0 05.69 7 6 09.78 0.796 66.698 8 7 5.659.07.577 9 8.9 0.88 96.5 0 9 8.79 0.976.08 0 5.657 0.99.7 7
Trend Componen 0 60 80 5 7 9 5 7 9 5 7 9 Irregular Componen.5.00 0.75 5 7 9 5 7 9 5 7 9 Daa = Trend*Irregular 0 60 80 5 7 9 5 7 9 5 7 9 8
To ge an esimae of T we will compue a weighed moving average of he y s o average ou he I componens. In paricular, Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y. uppose for he momen here is no irregular componen (i.e. I = in each period ). As shown below, even wih no irregular componen I we canno recover T exacly, alhough we can come very close. Row A B C D E Year Trend T Irregular I Daa = Trend*Irregular y = T I = T () = T 00.000 00.000 0.000 0.000 06.090 06.090 Trend Esimae Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y 06.60 = 0.5*D 0.5*D 0.5*D 0.5*D5 0.5*D6 5 09.7 09.7 09. 6 5.55.55.65 7 6 5.97 5.97 6.00 8 7 9.05 9.05 9.8 9 8.987.987.068 0 9 6.677 6.677 6.760 0 0.77 0.77 0.56.9.9.80 8. 8. 8.5.576.576.670 5 6.85 6.85 6.950 6 5 5.59 5.59 5.58 7 6 55.797 55.797 55.899 8 7 60.7 60.7 60.576 9 8 65.85 65.85 65.9 --- --- --- --- --- --- 5 97.59 97.59 97.88 6 5 0.79 0.79 0. 7 6 09.78 09.78 09.55 8 7 5.659 5.659 5.800 9 8.9.9.7 0 9 8.79 8.79 0 5.657 5.657 9
Now consider he acual daa y = T I. As shown below, we canno recover T exacly because of he variabiliy in he I componen. Row A B C D E Year Trend T Irregular I Daa=Trend*Irregular y = T I 00.000 0.997 99.667 0.000 0.98 0.7 06.090 0.98 0.7 Trend Esimae Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y 0.80 = 0.5*D 0.5*D 0.5*D 0.5*D5 0.5*D6 5 09.7 0.877 95.780 07.6 6 5.55.05. 08.70 7 6 5.97 0.95 08.0. 8 7 9.05 0.906 08.97 7.97 9 8.987 0.970 9.67.0 0 9 6.677.66 7.78 8.77 0 0.77.0..70.9 0.878 8.0 0.05 8. 0.98 6.056 0.68.576 0.85 0.5 9.87 5 6.85.09 60.0 8.767 6 5 5.59.0 66.88 57.90 7 6 55.797.08 58.60 6.00 8 7 60.7.05 67.70 65.6 9 8 65.85.000 65. 69.8 0 9 70..00 7.66 7.7 0 75.5.050 8.06 76.09 80.6 0.96 7.8 78.9 86.09 0.970 80.56 78.98 9.60 0.95 8.00 8.08 5 97.59 0.897 77.050 8. 6 5 0.79.0 05.69 88.90 7 6 09.78 0.796 66.698 97.6 8 7 5.659.07.577 0.07 9 8.9 0.88 96.5. 0 9 8.79 0.976.08 0 5.657 0.99.7 0
0 60 80 5 7 9 5 7 9 5 7 9 Trend Daa=Trend*Irregular 0 60 80 5 7 9 5 7 9 5 7 9 Trend There are wo sources of esimaion error when esimaing T : () Even wih no irregular componen he weighed moving average canno recover T exacly (his is ypically a very small source of error). The only ime T can be recovered exacly is when T = α β (i.e. he rend is linear). () The I componen canno be compleely averaged ou wih a shor weighed moving average. The size of he esimaion error due o I depends on how much variabiliy here is in I (i.e. i depends on wha he variance of I is).
Now consider esimaing T in a full seasonal model (using simulaed quarerly daa). The model is y = T I. Row A B C D E F Time Quarer Trend easonal Irregular Daa=Trend*easonal*Irregular T I y = T I 00.000 0.80 0.969 77.55 Qr 0.000 0.85 0.998 87.8 Qr 06.090.05 0.985 09.7 5 Qr 09.7.0.005.756 6 5.55 0.80 0.977 87.99 7 6 Qr 5.97 0.85 0.989 97.85 8 7 Qr 9.05.05.00 7.95 9 8 Qr.987.0 0.988 57.90 0 9 6.677 0.80 0.980 99.78 0 Qr 0.77 0.85 0.998 0.69 Qr.9.05.008.0 Qr 8..0 0.99 78.9.576 0.80 0.97 0.78 5 Qr 6.85 0.85.00 7.60 6 5 Qr 5.59.05.009 60.70 7 6 Qr 55.797.0 0.98 98.68 8 7 60.7 0.80 0.968.9 9 8 Qr 65.85 0.85.00 0.89 0 9 Qr 70..05 0.997 78.07 0 Qr 75.5.0 0.99 6.57 80.6 0.80 0.97 0.9 Qr 86.09 0.85.006 59.0 Qr 9.60.05 0.98 97.988 5 Qr 97.59.0 0.998 56.067 6 5 0.79 0.80 0.97 58. 7 6 Qr 09.78 0.85 0.990 76. 8 7 Qr 5.659.05 0.987.6 9 8 Qr.9.0.006 90.59 0 9 8.79 0.80.0 88.96 0 Qr 5.657 0.85.09 0. Qr.76.05.0 6. Qr 50.008.0 0.996.686
Trend Componen easonal Componen 50.0 00.00 50 00 0.60 Irregular Componen Daa = Trend*easonal*Irregular.0 5 75.00 5 75 5 0.90 75
To ge an esimae of he T componen we will compue a weighed moving average of y o average ou he and I componens: Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y. uppose for he momen here is no seasonal or irregular componen (i.e. = and I = in each period ). As shown below, even wih no irregular componen I we canno recover T exacly, alhough we can come very close. Row A B C D E F G Quarer Time Trend T easonal Irregular I Daa = Trend*easonal*Irregular y = T I Trend Esimae- No easonal Or Irregular Comp Tˆ = 0.5y - 0.5y - 00.000.00.000 00.000 Qr 0.000.00.000 0.000 Qr 06.090.00.000 06.090 0.5y 0.5y 0.5y 06.60 = 0.5*F 0.5*F 0.5*F 0.5*F5 0.5*F6 5 Qr 09.7.00.000 09.7 09. 6 5.55.00.000.55.65 7 Qr 6 5.97.00.000 5.97 6.00 8 Qr 7 9.05.00.000 9.05 9.8 9 Qr 8.987.00.000.987.068 0 9 6.677.00.000 6.677 6.760 Qr 0 0.77.00.000 0.77 0.56 Qr.9.00.000.9.80 Qr 8..00.000 8. 8.5.576.00.000.576.670 5 Qr 6.85.00.000 6.85 6.950 6 Qr 5 5.59.00.000 5.59 5.58 7 Qr 6 55.797.00.000 55.797 55.899 8 7 60.7.00.000 60.7 60.576 9 Qr 8 65.85.00.000 65.85 65.9 0 Qr 9 70..00.000 70. 70.55 --- --- --- --- --- --- --- --- 0 9 8.79.00.000 8.79 8.9 Qr 0 5.657.00.000 5.657 5.8 Qr.76.00.000.76 Qr 50.008.00.000 50.008
Now suppose here is a seasonal componen bu no irregular componen (i.e. I = in each period so y = T ). As shown below, we can obain an accurae (bu no perfec) esimae of T. Row A B C D E F G Quarer Time Trend T easonal Irregular I Daa = Trend*easonal*Irregular y = T I Trend Esimae- No Irregular Componen Tˆ = 0.5y - 0.5y - 00.000 0.80.000 80.000 Qr 0.000 0.85.000 87.550 Qr 06.090.05.000.95 0.5y 0.5y 0.5y 06.505 = 0.5*F 0.5*F 0.5*F 0.5*F5 0.5*F6 5 Qr 09.7.0.000.055 09. 6 5.55 0.80.000 90.0.55 7 Qr 6 5.97 0.85.000 98.58 6. 8 Qr 7 9.05.05.000 5.75 9.87 9 Qr 8.987.0.000 59.88.8 0 9 6.677 0.80.000 0. 6. Qr 0 0.77 0.85.000 0.906 0.89 Qr.9.05.000..97 Qr 8..0.000 79.950 8.7.576 0.80.000.06.0 5 Qr 6.85 0.85.000.85 7.8 6 Qr 5 5.59.05.000 58.8 5.850 7 Qr 6 55.797.0.000 0.56 55.598 8 7 60.7 0.80.000 8.77 60.08 9 Qr 8 65.85 0.85.000 0.9 65.77 0 Qr 9 70..05.000 78.755 70.909 Qr 0 75.5.0.000 7.956 75.7 80.6 0.80.000.89 80.6 Qr 86.09 0.85.000 58.5 86.56 Qr 9.60.05.000 0.9 9.60 5 Qr 97.59.0.000 56.566 97.07 6 5 0.79 0.80.000 6.6 0.7 7 Qr 6 09.78 0.85.000 77.97 09.96 8 Qr 7 5.659.05.000 6. 6.50 9 Qr 8.9.0.000 88.768.86 0 9 8.79 0.80.000 8.0 8.9 Qr 0 5.657 0.85.000 00.08 6.7 Qr.76.05.000 5.86 Qr 50.008.0.000 5.00 5
Now consider he full model y = T I. If he variabiliy in I is no large we can obain a fairly accurae esimae of T. Row A B C D E F G Quarer Time Trend T easonal Irregular I Daa = Trend*easonal*Irregular y = T I 00.000 0.80 0.969 77.55 Qr 0.000 0.85 0.998 87.8 Qr 06.090.05 0.985 09.7 Trend Esimae Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y 05.667 = 0.5*F 0.5*F 0.5*F 0.5*F5 0.5*F6 5 Qr 09.7.0.005.756 08. 6 5.55 0.80 0.977 87.99.767 7 Qr 6 5.97 0.85 0.989 97.85 5.9 8 Qr 7 9.05.05.00 7.95 9.9 9 Qr 8.987.0 0.988 57.90. 0 9 6.677 0.80 0.980 99.78 5.76 Qr 0 0.77 0.85 0.998 0.69 0.086 Qr.9.05.008.0.080 Qr 8..0 0.99 78.9 7.589.576 0.80 0.97 0.78.98 5 Qr 6.85 0.85.00 7.60 6.70 6 Qr 5 5.59.05.009 60.70 50.9 7 Qr 6 55.797.0 0.98 98.68 5.5 8 7 60.7 0.80 0.968.9 58.6 9 Qr 8 65.85 0.85.00 0.89 6.95 0 Qr 9 70..05 0.997 78.07 69.00 Qr 0 75.5.0 0.99 6.57 7.677 80.6 0.80 0.97 0.9 78.5 Qr 86.09 0.85.006 59.0 8.66 Qr 9.60.05 0.98 97.988 90.596 5 Qr 97.59.0 0.998 56.067 9.98 6 5 0.79 0.80 0.97 58. 00.7 7 Qr 6 09.78 0.85 0.990 76. 07.809 8 Qr 7 5.659.05 0.987.6 5.95 9 Qr 8.9.0.006 90.59.7 0 9 8.79 0.80.0 88.96.75 Qr 0 5.657 0.85.09 0. 0.88 Qr.76.05.0 6. Qr 50.008.0 0.996.686 6
If he variabiliy in I is large, his makes i more difficul o obain an accurae esimae of T. Row A B C D E F G Quarer Time Trend T easonal Irregular I Daa = Trend*easonal*Irregular y = T I 00.000 0.80.009 80.7 Qr 0.000 0.85 0.9 80.697 Qr 06.090.05 0.98 09.5 Trend Esimae Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y.86 = 0.5*F 0.5*F 0.5*F 0.5*F5 0.5*F6 5 Qr 09.7.0.50 77.5 0.79 6 5.55 0.80.7 0.67 5.8 7 Qr 6 5.97 0.85.058 0.69.9 8 Qr 7 9.05.05.07 8.77 9.996 9 Qr 8.987.0 0.908 5.65 8.900 0 9 6.677 0.80 0.998 0.86.969 --- --- --- --- --- --- --- --- Qr 0 5.657 0.85.0 07.5.089 Qr.76.05 0.975 8.55 Qr 50.008.0.0 8.96 50 00 50 00 5 7 9 5 7 9 5 7 9 True Trend Esimae Large I Esimae mall I The full spreadshee o implemen classical decomposiion in a muliplicaive model is given on he nex page. 7
Row A B C D E F G H Quarer Daa y 77.55 Qr 87.8 Qr 09.7 5 Qr.756 6 87.99 7 Qr 97.85 T Esimae Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y 05.667 = 0.5*B 0.5*(BBB5) 0.5*B6 08. = 0.5*B 0.5*(BB5B6) 0.5*B7.767 = 0.5*B 0.5*(B5B6B7) 0.5*B8 5.9 = 0.5*B5 0.5*(B6B7B8) 0.5*B9 xi Esimae y Tˆ.08 = B/C.9 = B5/C5 0.787 = B6/C6 0.8 = B7/C7 8 Qr 7.95 9.9.07 9 Qr 57.90..9 easonalum This column sums he I componens for corresponding quarers 7.59 = UMIF(A$:A$, "Qr ",D$:D$) 9. = UMIF(A$:A$, "Qr ",D$:D$) 5.55 = UMIF(A$:A$, "",D$:D$) 5.976 = UMIF(A$:A$, "Qr ",D$:D$) easonalavg This column is an average of he I componens for corresponding quarers.05 = E/7.0 = E5/7 0.79 = E6/7 0.85 = E7/7 Esimae Ŝ This column forces he componens o average o one 0.79 Copied manually 0.85 Copied manually.05 = *F/UM(F$:F$7).0 = *F5/UM(F$:F$7) 0.79 = *F6/UM(F$:F$7) 0.85 = *F7/UM(F$:F$7).05 Copied manually.0 Copied manually easonaladjy y ˆ 97.976 = B/G 0. = B/G 0.0 = B/G 09.608 = B5/G5.07 = B6/G6.9 = B7/G7.60 = B8/G8.66 = B9/G9 0 99.78 5.76 0.790 0.79 5.68 Qr 0.69 0.086 0.85 0.85 9.58 Qr.0.080.06.05 5.66 Qr 78.9 7.589.97.0 6.969 0.78.98 0.78 0.79 0.006 5 Qr 7.60 6.70 0.867 0.85 8.97 6 Qr 60.70 50.9.06.05 5.9 7 Qr 98.68 5.5.87.0 5.98 8.9 58.6 0.785 0.79 57.08 8
9 Qr 0.89 6.95 0.859 0.85 6.9 0 Qr 78.07 69.00.05.05 69.88 Qr 6.57 7.677.0.0 7.6 0.9 78.5 0.787 0.79 77.0 Qr 59.0 8.66 0.86 0.85 86. Qr 97.988 90.596.09.05 88.90 5 Qr 56.067 9.98..0 96.607 6 58. 00.7 0.790 0.79 99.986 7 Qr 76. 07.809 0.88 0.85 06.6 8 Qr.6 5.95.05.05.88 9 Qr 90.59.7.0.0.075 0 88.96.75 0.85 0.79 8.765 Qr 0. 0.88 0.88 0.85 8.99 Qr 6..05 50.099 Qr.686.0 8.55 easonally Adjused Y 5 95 5 95 9
Excel preadshee for Classical easonal Decomposiion of ales for The Gap Row A B C D E F G H Quarer ales y 0575 Qr 06 Qr 8669 5 Qr 98 6 59980 7 Qr 6760 T Esimae Tˆ = 0.5y - 0.5y - 0.5y 0.5y 0.5y 6866.75 = 0.5*B 0.5*(BBB5) 0.5*B6 80977.500 = 0.5*B 0.5*(BB5B6) 0.5*B7 996.875 = 0.5*B 0.5*(B5B6B7) 0.5*B8 0670.50 = 0.5*B5 0.5*(B6B7B8) 0.5*B9 xi Esimae y Tˆ.077 = B/C.5 = B5/C5 0.8 = B6/C6 0.805 = B7/C7 8 Qr 800 887.50.09 9 Qr 9869 96.75.90 easonalum This column sums he I componens for corresponding quarers 0.57 = UMIF(A$:A$, "Qr ",D$:D$).56 = UMIF(A$:A$, "Qr ",D$:D$) 8.58 = UMIF(A$:A$, "",D$:D$) 8.60 = UMIF(A$:A$, "Qr ",D$:D$) easonalavg This column is an average of he I componens for corresponding quarers.06 = E/0.5 = E5/0 0.85 = E6/0 0.86 = E7/0 Esimae Ŝ This column forces he componens o average o one 0.85 Copied manually 0.86 Copied manually.06 = *F/UM(F$:F$7).5 = *F5/UM(F$:F$7 0.85 = *F6/UM(F$:F$7 0.86 = *F7/UM(F$:F$7.06 Copied manually.5 Copied manually easonaladjales y ˆ 78.7 = B/G 97.7 = B/G 7688.5 = B/G 96. = B5/G5 875.8 = B6/G6 970.6 = B7/G7 9.8 = B8/G8 80.80 = B9/G9 0 060.500 0.865 0.85 76. Qr 775 5786.875 0.8 0.86 576.89 Qr 766 699.50.06.06 6596.0 Qr 5959 78899.5.89.5 86790.00 8 9086.000 0.80 0.85 860. 5 Qr 68 050.65 0.867 0.86 78.6 6 Qr 75 596.75.00.06 0857.9 7 Qr 669 7869.875.5.5 789.5 0
8 0995 5597.75 0.87 0.85 6900.09 9 Qr 599 866.50 0.85 0.86 8589. 0 Qr 0560 080.75 0.99.06 8778.7 Qr 55 96.875.69.5 765.9 --- --- --- --- --- --- --- --- --- 8 75670 88078.5 0.85 0.85 8805.00 9 Qr 77 906.750 0.88 0.86 967. 0 Qr 9886 99.000.08.06 999. Qr.E06 96696.5.5.5 96506.77 88688 000.750 0.88 0.85 9975.7 Qr 8685 060550.500 0.89 0.86 0695.8 Qr.6E06.06 090.68 5 Qr.5E06.5 65.0 easonally Adjused ales for The Gap 600000 800000 0
Algebra used o find he normalizing consan for he seasonal facors in Column G We wan o find a normalizing consan, denoed c, so ha when we divide each of he seasonal facors by c hey average o one, i.e. we wan o find c so ha = c c c c. Using some algebra, his gives = c ( ) = c ( ) c = Therefore, he normalized seasonal facors are ( ), ( ), ( ) and ( ), or equivalenly,,, and. This is he formula used in Column G in he above spreadshees.
easonally adjus sales for The Gap using atools atools insrucions o seasonally adjus daa To use atools in Excel, you mus firs open i ouside Excel by clicking on is icon. Then inside Excel, click on atools in he menu a he op of he Excel screen. (Please noe ha click will always refer o a lef click; if a righ click is needed, I ll wrie righ click ). To run an analysis using atools, you mus firs creae a atools daa se conaining he variable(s) you wan o analyze. To do his, click on Daa e Manager in he op lef hand corner of he atools screen. In he Daa e Manager dialog box, click on New, click on he elec he range icon immediaely o he righ of he Excel Range box, highligh he column in he Excel workshee conaining quarerly sales for The Gap, click OK, and hen click OK again. To seasonally adjus sales, click on Time eries and Forecasing a he op of he atools screen, and hen click on Forecas. In he atools-forecas dialog box, click he box nex o ales, click on Time cale (a his poin in he semeser don worry abou any of he oher opions in he Forecas dialog box), click on Quarerly in he new dialog box ha comes up, click on Deseasonalize, and hen click OK. The seasonally adjused sales daa will be pu ino a new workshee labelled Forecas (he seasonally adjused daa will be in a column labelled Deseason ales par way down he workshee). We will discuss he oher columns in his workshee as he semeser goes along. The columns in he workshee labelled Forecas relaed o seasonally adjused sales are: eason Deseason ales Index ales 0575.00 0.85 78.7 06.00 0.85 97.7 8669.00.05 7688.5 98.00.5 96. 59980.00 0.85 875.9 6760.00 0.85 970.65 800.00.05 9.8 9869.00.5 80.8 75670.00 0.85 8805.05 77.00 0.85 967.7 9886.00.05 999.7 0000.00.5 96506.8 88688.00 0.85 9975. 8685.00 0.85 0695.5 60000.00.05 090.7 50000.00.5 65.09
easonally adjus sales for The Gap using R IMPORTANT: You are no responsible for running R scrips in his class. I have only included he R scrip for his analysis in case you are ineresed. R scrip o decompose sales for The Gap ino rend, seasonal and irregular (random) componens ##################################################################################################################### # # You mus se he working direcory properly # If he R package ggplo is no insalled hen i mus be insalled by yping he command (a he "> promp"): # insall.packages("ggplo") # You mus ype (a he "> promp"): library (ggplo) # To run, ype (a he "> promp"): source("classicaleasonaldecomposiion_ales_thegap.r") # (where ClassicaleasonalDecomposiion_ales_TheGap.R is he name of file conaining he R scrip given below) # ##################################################################################################################### # # Open file for oupu # sink ("C:/Users/shively/Box ync/courses/7_pring05/r_crips/classical_easonal_decomposiion/00pracice.x", append=fale, spli=true) # # Read daa # file <- "ales_thegap_985-95.da" ales_able <- read.able(file, header = FALE, sep = "") colnames(ales_able) <- c("time", "ales") n_obs = nrow(ales_able) ca ("Number of observaions is:", n_obs, "\n", "\n") prin(head(ales_able)) # # Plo ales vs. Time # g = ggplo()
g <- g geom_line(daa=ales_able, aes(time,ales), color="black", ly=) ggsave('plo_ales.pdf', g) shell.exec(file.pah(gewd(), "plo_ales.pdf")) # # ave daa as a ime series objec # ales_ime_series <- s(ales_able[], frequency=) colnames(ales_ime_series) <- "ales" # # Decompose ales ino rend, seasonal and irregular componens, and plo and prin componens # ales_ime_series_componens <- decompose(ales_ime_series, ype="muliplicaive") pdf("plo_seasonal_componens.pdf") plo(ales_ime_series_componens) shell.exec(file.pah(gewd(), "plo_seasonal_componens.pdf")) dev.off () prin (ales_ime_series_componens) # # Close file for oupu # closeallconnecions() Oupu from R Number of observaions is: Time ales 0575 06 8669 98 5 5 59980 6 6 6760 $x Qr Qr Qr Qr 0575 06 8669 98 59980 6760 800 9869 060 775 766 5959 8 68 75 669 5
5 0995 599 0560 55 6 068 0996 50690 676 7 9000 5056 7005 8085 8 58886 6 87 9009 9 6580 699 898677 060000 0 75670 77 9886 0000 88688 8685 60000 50000 $seasonal Qr Qr Qr Qr 0.8509 0.86787.0597.585 0.8509 0.86787.0597.585 0.8509 0.86787.0597.585 0.8509 0.86787.0597.585 5 0.8509 0.86787.0597.585 6 0.8509 0.86787.0597.585 7 0.8509 0.86787.0597.585 8 0.8509 0.86787.0597.585 9 0.8509 0.86787.0597.585 0 0.8509 0.86787.0597.585 0.8509 0.86787.0597.585 $rend Qr Qr Qr Qr NA NA 6866. 80977.5 996.9 0670. 887. 96..5 5786.9 699. 78899. 9086.0 050.6 596. 7869.9 5 5597. 866. 080. 96.9 6 555. 795.6 96.5 5085.5 7 559988. 60778. 60.8 66576.5 8 69775.0 76.8 769.8 76666.0 9 788.6 80768. 877.5 860877. 0 88078. 906.8 99.0 96696. 000.8 060550.5 NA NA 6
$random Qr Qr Qr Qr NA NA.000809.05687 0.97590 0.958 0.9855.08788.05 0.997955 0.9755.0890 0.975959.06 0.9595068.000079 5.09590.0097599 0.99978.099 6.077.0087 0.970097 0.9578 7.05.0776.0599 0.9659 8 0.99598.00055.058885 0.9778 9 0.96070.089.06066 0.9806 0 0.99786.00795.007 0.9979965 0.997 0.9677950 NA NA $figure [] 0.8509 0.86787.0597.585 $ype [] "muliplicaive" ar(,"class") [] "decomposed.s" 7
00000 ales 800000 00000 0 0 0 0 0 Time
Decomposiion of muliplicaive ime series random 0.96.00.0 seasonal rend observed 0.9.0.. e05 6e05 e06 00000 800000 00000 6 8 0 Time