You are on page 1of 10

# Time Series Analysis This (not surprisingly) concerns the analysis of data collected over time ...

weekly values, monthly values, quarterly values, yearly values, etc. Usually the intent is to discern whether there is some pattern in the values collected to date, with the intention of short term forecasting (to use as the basis of business decisions). We will write t response of interest at time = t y (we usually think of these as equally spaced in clock time). Standard analyses of business time series involve: smoothing/trend assessment 1)assessment of/accounting for seasonality 2) assessment of/exploiting "serial correlation" 3) ectively done on a scale where the "local" variation These are usually/most e is approximately constant. t y in Smoothing Time Series There are various fairly simple smoothing/averaging methods. Two are "ordinary moving averages" and "exponentially weighted moving averages."periods, k For a "span" of Ordinary Moving Averages t moving average through time = et y = 1 k t y + +2 t y +1 t y +t y k ects are expected, it is standard to use Where seasonal e number of periods per cycle = k These weight observations less Exponentially Weighted Moving Averages heavily as one moves back in time from the current period. They are typically computed "recursively" as t exponentially weighted moving average at time = et y 1e t y ) w +(1 t wy =ey( 1 t is the EWMA from the previous period and the current EWMA is a compromise between the previous EWMA and the current observation.) 1y = e . 1y One must start this recursion somewhere and its common to take smooths so much = 0 w does no smoothing, while = 1 w Notice that rst). that the EWMA never changes (i.e. all the values are equal to the Table 13.1 (page 13-5) of the text gives quarterly retail Exercise/Example sales for JC Penney, 1996-2001 (in millions of dollars). "By hand" 1) using nd ordinary moving averages for periods 5 through 8, then 2) using = 4 k nd the exponentially weighted moving average values for those , 3. = w (e.g.) periods.EWMA 3. = w MA = 4 k Span t ty 4452 4452 1

7(4452) . 3(4507) + . 4469 = 4507 2 7(4469) . 3(5537) + . 4789 = 5537 3 5663 = 8157 4 1 4 4452 + 4507 +5537 + 8157 ! 7(4789) . 3(8157) + . 5799 = 6481 5 6420 6 7208 7 9509 8 MA values for the JC = 4 k A plot of both the original time series and the Penney data is in Figure 13.13, page 13-28 of the text. Here is a JMP "Overlay Plot" version of this picture and an indication of how you can get JMP to make the MAs.MA Series = 4 k Figure 1: JC Penney Sales andFigure 2: JMP "Column Formula" for JC Penney MAs Computation of EWMAs in JMP doesnt appear to be simple. Figure 13.15 ect of erent data set) shows the e on page 13-32 of the text (that uses a di on how much smoothing is done. The most jagged plot is the w changing EWMA plot is smoother. 5. = w ). The (purple) 0. = 1 w (red) raw data plot ( plot is smoothest. Here is a plot of 3 EWMA series for 1. = w The (black) the JC Penney sales data.Figure 3: EWMAs for JC Penney Sales DataThere are other more sophisticated smoothing methods available in statistical software. JMP provides "splines." These are available using the "Fit Y by X" JMP Cubic Spline Smoothers ness knob" that lets one adjust how procedure in JMP. They have a "sti t much "wiggling" the smoothed curve can do. Here are several splines ness knob" is the parameter " to the JC Penney sales data. The "sti ".Figure 4: Splines Fit to the JC Penney DataJMP will store the smoothed values obtained from these spline smoothers (just as it will store predicted values from regressions) in the original data table, if one clicks on the appropriate red triangle and chooses that option. Typically one wants to "smooth" a time series in order to make forecasts/projections into the future. The MA, EWMA, and spline smoothers dont really provide A +1 t to the next period, period et y forecasts beyond projecting a current value . possibility for smoothing that provides forecasts other than a current smoothed " vari- x t a simple curve to the series using regression, where the " value is to

). It is particularly ,... )2 ,y (2 , )1 ,y (1 " (that is, the data vectors are t able is " t "low order" polynomials (lines, parabolas, etc.) to such data using easy to JMP. These provide extrapolations beyond the end of the data set. These are JMP Fitting of (Low Order) Polynomial Trends to Time Series again conveniently available using the "Fit Y by X" procedure in JMP. (Conceptually, one could also use the multiple regression procedure "Fit But well t Model" after adding columns to the data table for powers of . use the more elegant "Fit Y by X" method.) Below is a JMP graphic for linear and quadratic (1st and second order polynots to the JC Penney time series. NOTICE that the extrapolations to a mial) tted erent! The two 25th period from these two polynomials will be quite di equations are t 75261 . 2174 + 118 . = 5903 t y and 5) . 12 t 4274932( . 9 t 75261 . 9514 + 118 . = 6354 t y 2 and by clicking on the appropriate red triangles (next to the "Linear Fit" or "Polynomial Fit") one can save the predicted values into the data table. (If onetted equation for formula uses the "Fit Model" procedure, one can save the and get JMP to automatically compute forecasts into the future by adding rows s in them.) t to the data table with hypotheticalFigure 5: JMP Fit of Linear and Parabolic Trends to the JC Penney Datatted polynomials As one moves from a line, to a parabola, to a cubic, etc., will be allowed to be more and more wiggly, doing a better and better job ng less and less believable in terms of of hitting the plotted points, but becomi forecasts. The happiest circumstance is that where a simple straight line/linear trend seems to provide an adequate summary of the main movement of the time series. Compute "by hand" the linear and quadratic forecasts of Exercise/Example (the sales for the period immediately after the end of the data set) for the 25 y tted equations. JC Penney sales based on the JMP erent) forecasts are These (quite di 75261(25) . 2174 + 118 . = 5903 25 y = 8872and 5) . 12 4274932(25 . 9 75261(25) . 9514 + 118 . = 6354 25 y 2 = 7851

Accounting for/Adjusting for Seasonality t to the JC Penney data misses the seasonality in the data. The linear trend rst 3 quarters Mostly, the straight line in Figure 5 "over-predicts" in the = t of each year and "under-predicts" in the 4th quarter of each year. ( are "sec- 22 , 18 , 14 , 10 , 6 , = 2 t rst quarter" periods, are " 21 , 17 , 13 , 9,5,1 ond quarter" periods, etc.) It is well known that retail sales are typically best in the 4th quarter, where the Christmas season spurs consumer buying.It makes sense in the analysis of business and economic time series to try to ects. Here well adjust smoothed values (and forecasts) in light of seasonal e consider several ways of doing this. One ects Simple Arithmetic and "Additive" Adjustment for Seasonal E simple way of trying to account for seasonality is to look at all periods of a given type (e.g. 1st quarter periods where data are quarterly, or all June gures where data are monthly) and compute an average deviation of the tted values in those periods. original time series from the smoothed or to smoothed values or forecasts from a added That average can then be smooth curve in order to account for seasonality. ects Simple Arithmetic and "Multiplicative" Adjustment for Seasonal E A second simple way of trying to account for seasonality is to look at all periods of a given type (e.g. 1st quarter periods where data are quarterly, orgures where data are monthly) and compute an average ratio of all June tted values in those periods. That the actual values to the smoothed or for smoothed values or forecasts multiplier average can then be used as a from a smooth curve in order to account for seasonality. The table below gives simple computation of "additive" and "multi- Example plicative" seasonality factors for the 1st quarter JC Penney sales, based on the t to the data and pictured in Figure 5. linear trendt y t y t y t t y Period, ty t y 7393 1570 1 4452 6022. 9975 16 5 6481 6497. 9685 217 9 6755 6972. 9855 108 13 7339 7447. 9503 394 17 7528 7922. 8958 875 21 7522 8397. 5.5369 3180 is t y t y Then note that the average 3180 6 530 = is t y/t y and the average 5369 . 5