Tuesday, December 10, 2019

Time Series Analysis Essay Sample free essay sample

This ( non surprisingly ) concerns the analysis of informations collected over clip †¦ hebdomadal values. monthly values. quarterly values. annually values. etc. Normally the purpose is to spot whether there is some form in the values collected to day of the month. with the purpose of short term prediction ( to utilize as the footing of concern determinations ) . We will compose yt = response of involvement at clip T ( we normally think of these as every bit spaced in clock clip ) . Standard analyses of concern clip series involve: 1 ) smoothing/trend appraisal 2 ) appraisal of/accounting for seasonality 3 ) appraisal of/exploiting â€Å"serial correlation† These are usually/most e?ectively done on a graduated table where the â€Å"local† fluctuation in yt is about changeless. Smoothing Time SeriesThere are assorted reasonably simple smoothing/averaging methods. Two are â€Å"ordinary traveling averages† and â€Å"exponentially weighted traveling norms. † Ordinary Moving Averages For a â€Å"span† of K periods.vitamin E yt = moving norm through clip t yt + yt?1 + yt?2 +  ·  ·  · + yt?k?1 = K Where seasonal e?ects are expected. it is standard to utilize K = figure of periods per rhythm Exponentially Weighted Moving Averages These weight observations less to a great extent as one moves back in clip from the current period. They are typically computed â€Å"recursively† as vitamin E yt = exponentially weighted moving norm at clip T vitamin E = wyt + ( 1 ? tungsten ) yt?1 vitamin E ( yt?1 is the EWMA from the old period and the current EWMA is a via media between the old EWMA and the current observation. ) e One must get down this recursion someplace and it’s common to take y1 = y1. Notice that w = 1 does no smoothing. while w = 0 smooths so much that the EWMA neer alterations ( i. e. all the values are equal to the ?rst ) . Exercise/Example Table 13. 1 ( page 13-5 ) of the text gives quarterly retail gross revenues for JC Penney. 1996-2001 ( in 1000000s of dollars ) . â€Å"By hand† 1 ) utilizing thousand = 4 ?nd ordinary moving norms for periods 5 through 8. so 2 ) utilizing ( e. g. ) tungsten = . 3. ?nd the exponentially leaden traveling mean values for those periods. t 1 2 3 4 5 6 7 8 yt Span k = 4 MA tungsten = . 3 EWMA 4452 4452 4507 4469 = . 3 ( 4507 ) + . 7 ( 4452 ) 5537 A ! 4789 = . 3 ( 5537 ) + . 7 ( 4469 ) 4452 + 4507 8157 5663 = 1 5799 = . 3 ( 8157 ) + . 7 ( 4789 ) 4 +5537 + 8157 6481 6420 7208 9509 A secret plan of both the original clip series and the K = 4 MA values for the JC Penney information is in Figure 13. 13. page 13-28 of the text. Here is a JMP â€Å"Overlay Plot† version of this image and an indicant of how you can acquire JMP to do the MA’s. Figure 1: JC Penney Gross saless and k = 4 MA Series Figure 2: JMP â€Å"Column Formula† for JC Penney MA’s Computation of EWMAs in JMP doesn’t appear to be simple. Figure 13. 15 on page 13-32 of the text ( that uses a di?erent information set ) shows the e?ect of altering tungsten on how much smoothing is done. The most jaggy secret plan is the ( ruddy ) raw informations secret plan ( w = 1. 0 ) . The ( purple ) tungsten = . 5 EWMA secret plan is smoother. The ( black ) tungsten = . 1 secret plan is smoothest. Here is a secret plan of 3 EWMA series for the JC Penney gross revenues informations. Figure 3: EWMAs for JC Penney Gross saless Data There are other more sophisticated smoothing methods available in statistical package. JMP provides â€Å"splines. † JMP Cubic Spline Smoothers These are available utilizing the â€Å"Fit Yttrium by X† process in JMP. They have a â€Å"sti?ness knob† that lets one adjust how much â€Å"wiggling† the smoothened curve can make. Here are several splines ?t to the JC Penney gross revenues informations. The â€Å"sti?ness knob† is the parametric quantity â€Å"? . † Figure 4: Splines Fit to the JC Penney Data JMP will hive away the smoothened values obtained from these spline drum sanders ( merely as it will hive away predicted values from arrested developments ) in the original informations tabular array. if one chinks on the appropriate ruddy trigon and chooses that option. Typically one wants to â€Å"smooth† a clip series in order to do forecasts/projections into the hereafter. The MA. EWMA. and spline drum sanders don’t truly supply vitamin E prognosiss beyond projecting a current value yt to the following period. period t+1. A possibility for smoothing that provides forecasts other than a current smoothened value is to ?t a simple curve to the series utilizing arrested development. where the â€Å"x† variable is â€Å"t† ( that is. the information vectors are ( 1. y1 ) . ( 2. y2 ) . . . . ) . It is peculiarly easy to ?t â€Å"low order† multinomials ( lines. parabolas. etc. ) to such informations utilizing JMP. These provide extrapolations beyond t he terminal of the information set. JMP Fitting of ( Low Order ) Polynomial Trends to Time Series These are once more handily available utilizing the â€Å"Fit Yttrium by X† process in JMP. ( Conceptually. 1 could besides utilize the multiple arrested development process â€Å"Fit Model† after adding columns to the informations tabular array for powers of t. But we’ll use the more elegant â€Å"Fit Yttrium by X† method. ) Below is a JMP graphic for additive and quadratic ( 1st and 2nd order multinomial ) ?ts to the JC Penney clip series. NOTICE that the extrapolations to a twenty-fifth period from these two multinomials will be rather di?erent! The two ?tted equations are yt = 5903. 2174 + 118. 75261t ? and ? yt = 6354. 9514 + 118. 75261t ? 9. 4274932 ( t ? 12. 5 ) 2 and by snaping on the appropriate ruddy trigons ( following to the â€Å"Linear Fit† or â€Å"Polynomial Fit† ) one can salvage the predicted values into the informations tabular array. ( If one uses the â€Å"Fit Model† process. one can salvage the expression for ?tted equation and acquire JMP to automatically calculate prognosiss into the hereafter by adding rows to the informations tabular array with conjectural t’s in them. ) Figure 5: JMP Fit of Linear and Parabolic Trends to the JC Penney Data As one moves from a line. to a parabola. to a cubic. etc. . ?tted multinomials will be allowed to be more and more wiggly. making a better and better occupation of hitting the aforethought points. but going less and less credible in footings of prognosiss. The happiest circumstance is that where a simple consecutive line/linear tendency seems to supply an equal sum-up of the chief motion of the clip series. Exercise/Example Compute â€Å"by hand† the additive and quadratic prognosiss of y25 ( the gross revenues for the period instantly after the terminal of the informations set ) for the JC Penney gross revenues based on the JMP ?tted equations. These ( rather di?erent ) prognosiss are y25 = 5903. 2174 + 118. 75261 ( 25 ) ? = 8872 and y25 = 6354. 9514 + 118. 75261 ( 25 ) ? 9. 4274932 ( 25 ? 12. 5 ) 2 ? = 7851 Accounting for/Adjusting for SeasonalityThe additive tendency ?t to the JC Penney information misses the seasonality in the information. Largely. the consecutive line in Figure 5 â€Å"over-predicts† in the ?rst 3 quarters of each twelvemonth and â€Å"under-predicts† in the fourth one-fourth of each twelvemonth. ( t = 1. 5. 9. 13. 17. 21 are â€Å"?rst quarter† periods. T = 2. 6. 10. 14. 18. 22 are â€Å"second quarter† periods. etc. ) It is good known that retail gross revenues are typically best in the fourth one-fourth. where the Christmas season goad consumer purchasing. It makes sense in the analysis of concern and economic clip series to seek to set smoothed values ( and prognosiss ) in visible radiation of seasonal e?ects. Here we’ll see several ways of making this. Simple Arithmetic and â€Å"Additive† Adjustment for Seasonal E?ects One simple manner of seeking to account for seasonality is to look at all periods of a given type ( e. g. 1st one-fourth periods where informations are quarterly. or all June ?gures where informations are monthly ) and calculate an mean divergence of the original clip series from the smoothed or ?tted values in those periods. That norm can so be added to smoothed values or prognosiss from a smooth curve in order to account for seasonality. Simple Arithmetic and â€Å"Multiplicative† Adjustment for Seasonal E?ects A 2nd simple manner of seeking to account for seasonality is to look at all periods of a given type ( e. g. 1st one-fourth periods where informations are quarterly. or all June ?gures where informations are monthly ) and calculate an mean ratio of the existent values to the smoothed or ?tted values in those periods. That norm can so be used as a multiplier for smoothened values or prognosiss from a smooth curve in order to account for seasonality. Example The tabular array below gives simple calculation of â€Å"additive† and â€Å"multiplicative† seasonality factors for the 1st one-fourth JC Penney gross revenues. based on the additive tendency ?t to the informations and pictured in Figure 5. Period. t 1 5 9 13 17 21 yt 4452 6481 6755 7339 7528 7522 yt ? 6022 6497 6972 7447 7922 8397 yt ? yt ? yt yt ? ?1570. 7393 ?16. 9975 ?217. 9685 ?108. 9855 ?394. 9503 ?875. 8958 ?3180 5. 5369 Then note that the mean yt ? yt is ? ?3180 = ?530 6 Y and the mean yt/?t is 5. 5369 = . 9228 6 So ?tted values or prognosiss from the line ?t to the JC Penney informations could be adjusted by either add-on of ?530 or generation by. 9228. For illustration. the prognosis for period 25 ( the ?rst period after the terminal of the information in manus and a ?rst one-fourth ) from the additive ?t in Figure 5 alone is 8872. This could be adjusted for the seasonality as either y25 = 8872 + ( ?530 ) = 8342 ? ( doing usage of an â€Å"additive† seasonality accommodation ) or as y25 = 8872 ( . 9228 ) = 8187 ? ( doing usage of a â€Å"multiplicative† seasonality accommodation ) . Exert The tabular array below gives the fourth one-fourth values and ?tted values from the line ?t to the JC Penney informations. Complete the computations. acquire linear and multiplicative seasonality factors. and utilize them to do 4th one-fourth prognosiss for the twelvemonth following the terminal of the information ( this is period t = 28 and the additive ?t entirely undertakings gross revenues of y28 = 5903. 2174 + 118. 75261 ( 28 ) = 9228 ) . ? Period. t 4 8 12 16 20 24 yt 8157 9509 9072 9661 9573 9542 yt ? 6378 6853 7328 7803 8278 8753 yt ? yt ? yt yt ? 1779 1. 2789 2656 1. 3876 1744 1. 2380 Making an linear accommodation y28 = 9228 + ( ? ) = and doing a multiplicative accommodation y28 = 9229 ? ( ? ) = The U. S. authorities studies values of all sorts of economic clip series. In many instances. both â€Å"raw† and â€Å"seasonally adjusted† versions of these are announced. That is. non merely does the authorities announce a value of â€Å"housing starts. † but it besides announces a value of â€Å"seasonally adjusted lodging starts. † If SF is a multiplicative seasonality factor for the peculiar month under treatment. this means that both lodging starts and lodging starts seasonally adjusted lodging starts = SF are reported. Using Dummy Variables in MRL to Account for Seasonality A more sophisticated and convenient agencies of making ( linear ) seasonality accommodations is to use dummy variables in a multiple additive arrested development. That is. if there are thousand seasons. one can believe of doing up Ks ? 1 dummy variables x1. x2. . . . . xk?1 where for period T xj. T = ( 1 if period T is from season J 0 otherwise and so utilizing these in a Multiple Linear Regression. ?tting ( for illustration ) yt ? b0 + b1t + a1x1. T + a2x2. T +  ·  ·  · + ak?1xk?1. t The following ?gure shows the set-up of a JMP information tabular array for the JC Penney informations to do usage of this thought. Figure 6: JMP Data Table Prepared for Using MLR to Account for Seasonality What this method does is allow the â€Å"intercept† of a additive tendency in yt alteration with period. A â€Å"cartoon† screening how this works for the instance where there are thousand = 4 seasons is below. Figure 7: Cartoon for Dummy Variables and Seasonality ( k = 4 Seasons ) To ?t such a â€Å"linear tendency plus season dummies† theoretical account to clip series informations. one can use a multiple additive arrested development plan. JMP’s â€Å"Fit Model† routine incorporates such a plan. The JMP â€Å"Fit Model† duologue box and ensuing study for the JC Penney informations follow. Figure 8: JMP â€Å"Fit Model† Dialogue Box for Using Dummies to Account for Seasonality Figure 9: JMP Report for Suiting Linear Trend Plus Seasonal Dummies to the JC Penney Data The study shows that ?tted values for 4th one-fourth periods Ts are yt = 7858. 8 + 99. 541t ? and. for illustration. ?tted values for 1st one-fourth periods are yt = ( 7858. 8 + ( ?2274. 2 ) ) + 99. 541t ? So. for illustration. 25th period ( the ?rst one-fourth instantly after the terminal of the informations set ) gross revenues would be forecast as y25 = 7858. 8 ? 2274. 2 + 99. 541 ( 25 ) = 8073 ? and twenty-eighth period gross revenues ( fourth one-fourth gross revenues for the twelvemonth after the information terminals ) would be forecast as y28 = 7858. 8 + 99. 541 ( 28 ) = 10. 646 ? Using Consecutive Correlation ( in Residuals ) To Better Predictions Sometimes â€Å"trend plus seasonal e?ect† is all the information carried by a clip series. But there are besides many instances where yet more information can be extracted from the clip series to better on â€Å"trend plus seasonal e?ect† prognosiss. This involves utilizing remainders et = yt ? yt ? ( for yt the â€Å"?tted tendency plus seasonal e?ect† values for the information in manus ) . ? If remainders look like random draws from a ?xed existence. so there is nil left in them to work. But sometimes they exhibit â€Å"serial correlation† that allows us to e?ectively foretell a given remainder from old 1s. That is. sometimes the brace ( et?1. et ) show some additive relationship that can be exploited. When that can be done. anticipations of future remainders can be added to â€Å"trend plus seasonal† prognosiss for future periods. Figure 10 shows the remainders and â€Å"lag 1 residuals† for the additive tendency plus seasonal ?t to the JC Penney gross revenues informations in the informations tabular array. Figure 10: Remainders et and Lag 1 Residuals et?1 for the JC Penney Data Next. there are 3 secret plans. In the ?rst et is plotted against T and in the 2nd. et is plotted against et?1. These secret plans ( in Figures 11 and 12 ) show the same thing in di?erent footings. There is a clip form in the remainders. So back-to-back remainders tend to be large ( positive ) together and little ( negative ) together. That is because the ?tted theoretical account over-predicts early in the information set and late in the information set. and under-predicts in the center of the information set. That can besides be seen if one looks carefully at the 3rd secret plan of both yt versus T and yt versus T ( Figure 13 ) . ? Figure 11: Plot of Residuals versus Period for the JC Penney Data Figure 12: Plot of Residual et versus Lag 1 Residual et?1 for the JC Penney Data Figure 13: JC Penney Gross saless and Fitted Gross saless The form in Figure 12 suggests that one might foretell a remainder from the instantly predating residuary utilizing some signifier of arrested development. Figure 14 shows that utilizing simple additive arrested development of remainders on slowdown 1 remainders gives a ?tted equation et = 30. 26762 + 0. 7593887et?1 ? Notice that this means that from the last point in the JC Penney informations set ( period 24 ) it is possible to foretell the residuary at period 25. since the residuary for period 24 will so be known! That is e25 = 30. 26762 + 0. 7593887e24 ? Figure 14: JMP Report for SLR of Residual on Lag 1 Residual In fact. this line of believing suggests that we can better on the prognosis of Y y25 based entirely on additive tendency plus seasonal ( ?25 = 8073 ) by utilizing y25 + e25 ? ? Looking in the informations tabular array of Figure 10. we see that the residuary in the ?nal period of the information set is e24 = ?705. 74405 and therefore that e25 = 30. 26762 + 0. 7593887 ( ?705. 74405 ) = ?506 ? so that what might be an improved prognosis for period 25 is 8073 + ( ?506 ) = 7567 The basic thought of foretelling remainders from old remainders can be carried even further. One can seek foretelling a remainder on the footing of non merely the instantly predating one. but the instantly predating two ( or more ) . That is. it is possible to regress et on et?1 and et?2 in order to come up with a manner of calculating a following remainder ( and hence bettering a tendency plus seasonal prognosis ) . We will non demo any inside informations here ( for one thing because the thought doesn’t truly o?er any betterment in the JC Penney illustration ) . but the thought should be clear. Case Study-JMP Airline Passenger Count DataIn the â€Å"Sample Data† provided with a JMP installing are some clip series informations. â€Å"Seriesg. jmp† gives 12 old ages worth of monthly air hose rider counts taken from the clip series book of Box and Jenkins. ( The informations are from January 1949 through December 1960 and the counts are in 1000s of passengers. ) This information set can be used to laudably show the subjects discussed here. ( Although we have made usage of the JC Penney informations set for exemplifying intents. it is far smaller than the minimal size that should truly be used in a clip series analysis. The length 144 air hose rider informations set is closer to being of practical size for dependable development of forecasts. ) Figure 15 is a secret plan of the natural rider counts versus clip. Figure 15: Airline Passenger Counts Time Series Figure 15 has a characteristic that is common to many economic clip series of any appreciable length. Namely. as clip goes on. the â€Å"local† or short term fluctuation seems to increase as the general degree of the count additions. Besides. it looks like the general tendency of count versus clip may non be additive. but instead have some upward curvature. It is far easier to ?t and calculate series that don’t have these characteristics. So what we can make is to seek to transform the natural counts. ?t and prognosis with the transformed series. and so â€Å"untransform† to do ?nal readings. That is. we will analyse the ( base 10 ) logarithms of rider counts yt = log10 ( rider count at period T ) Figure 16 is a secret plan of yt and merrily looks â€Å"better† than the original series in Figure 15 for intents of ?tting and prediction. Figure 16: Logarithm of Passenger Counts A ?rst measure in analysis of the yt series is possibly to see how a additive tendency does at depicting the information. We can utilize JMP to make SLR and ?t a line to the ( t. yt ) values and salvage the anticipations. These can so be plotted utilizing â€Å"Overlay Plot† along with the original series to acquire Figure 17. Figure 17: Linear Trend Fit to yt Series Of class. the additive tendency ignores the seasonality in the times series. Since these are monthly informations. we could de?ne 11 monthly index variables. But that would be boring. and merrily the JMP informations tabular array ( partly pictured in Figure 18 ) has the month information coded into it in the signifier of a â€Å"nominal† variable â€Å"Season. † Since â€Å"Season† is a â€Å"nominal† variable ( indicated by the ruddy cap N ) if we tell JMP’s â€Å"Fit Model† modus operandi to utilize it in a multiple arrested development. it will automatically utilize the individual nominal variable to make 12 ? 1 = 11 silent person variables for all but one of the values of â€Å"Season. † That is. we may ?ll in the â€Å"Fit Model† duologue box as in Figure 19 to acquire ?tted values for the â€Å"linear tendency plus seasonal† theoretical account. Figure 18: Partial JMP Data Table for the Airline Passenger Data Figure 19: JMP â€Å"FIT Model† Dialogue Box for Linear Trend Plus Seasonal Fit A partial JMP study for the ?tting indicated in Figure 19 is shown in Figure 20. A secret plan of the ?tted values for the additive tendency plus seasonal theoretical account is shown in Figure 21. Figure 20: Partial JMP Report for Linear Trend Plus Seasonal Fit to yt Figure 21: Linear Trend Plus Seasonal Fit to Logarithms of Passenger Counts Of class. the ?t indicated in Figure 21 is better than the 1 in Figure 17. And the prognosiss provided by the arrested development theoretical account can be extended into the â€Å"future† ( beyond T = 144 that represents the last point in the informations set ) . But there is even more that can be done if one considers the nature of the remainders ? from the arrested development ?t. Figure 22 shows a secret plan of the remainders et = yt ? yt versus T and Figure 23 shows that there is a just sum of correlativity between remainders and lagged remainders. ( This is no surprise given the nature of the secret plan in Figure 22 where â€Å"slow† tendencies in the remainders make 1s near together in clip similar in value. ) Figure 22: Plot of Residuals versus T for the Log Passenger Counts Figure 23: Remainders. Lag 1 Residuals. and Lag 2 Residuals for Log Passenger Counts It is possible ( by analyzing arrested developments of remainders on lagged remainders ) to come to the decision that in footings of foretelling remainders from earlier remainders it su?ces to merely utilize the individual old one ( nil of import is gained by utilizing the two old 1s ) . And in fact. for this job. an appropriate anticipation equation ( coming from SLR of et on et?1 ) is et = ?0. 000153 + 0. 7918985et?1 ? This can be used to set the ?ts/predictions from the additive tendency plus seasonal theoretical account of log counts as ( adjusted degree Fahrenheit it ) t = yt + et ? ? These are plotted along with the original series and the earlier ?tted values yt in Figure 24. There is a little. but clearly discernable betterment in the ? quality of the mold provided by this accommodation for consecutive correlativity in the remainders. Figure 24: Original Values yt. Fitted Values yt. and Adjusted Fitted Values ? ? yt + et ? Notice so that an adjusted prognosis of log rider count for period T = 145 ( the January/Season 1 following the terminal of the informations set ) becomes y145 + e145 = ( 2. 0899065 + ( ?0. 037092 ) + . 0043728 ( 145 ) ) ? ? + ( ?0. 000153 + 0. 7918985 ( ?0. 0377583 ) ) = 2. 65682038 This ?gure is ( of class ) on a log graduated table. We may â€Å"untransform† this value in order to acquire a prognosis for a rider count ( as opposed to a log rider count ) . This is 102. 65682038 = 454 In fact. it is worthwhile to see a ?nal secret plan. that compares the original series of counts to the whole set of values ? e 10yt+?t that map as ?tted values on the original ( count ) graduated table. This is show in Figure 25 ( including the value for period 145. whose aforethought symbol is larger than the others. and represents a prognosis beyond the terminal of the original informations set ) . ? vitamin E Figure 25: Plot of Passenger Counts and Final Fitted Values 10yt+?t ( Including a Prognosis for t = 145 )

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.