Report

Statistics for Business and Economics 7th Edition Chapter 16 Time-Series Analysis and Forecasting Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-1 Chapter Goals After completing this chapter, you should be able to: Compute and interpret index numbers Weighted and unweighted price index Weighted quantity index Test for randomness in a time series Identify the trend, seasonality, cyclical, and irregular components in a time series Use smoothing-based forecasting models, including moving average and exponential smoothing Apply autoregressive models and autoregressive integrated moving average models Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-2 16.1 Index Numbers Index numbers allow relative comparisons over time Index numbers are reported relative to a Base Period Index Base period index = 100 by definition Used for an individual item or measurement Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-3 Single Item Price Index Consider observations over time on the price of a single item To form a price index, one time period is chosen as a base, and the price for every period is expressed as a percentage of the base period price Let p0 denote the price in the base period Let p1 be the price in a second period The price index for this second period is p1 100 p0 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-4 Index Numbers: Example Airplane ticket prices from 2000 to 2008: Index Year Price (base year = 2005) 2000 272 85.0 2001 288 90.0 2002 295 92.2 2003 311 97.2 2004 322 100.6 2005 320 100.0 2006 348 108.8 2007 366 114.4 2008 384 120.0 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall I2001 P2001 288 100 (100) 90 P2005 320 Base Year: P2005 320 I2005 100 (100) 100 P2005 320 I2008 P2008 384 100 (100) 120 P2005 320 Ch. 16-5 Index Numbers: Interpretation I2001 P2001 288 100 (100) 90 P2005 320 I2005 P2005 320 100 (100) 100 P2005 320 I2008 P2008 384 100 (100) 120 P2005 320 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Prices in 2001 were 90% of base year prices Prices in 2005 were 100% of base year prices (by definition, since 2005 is the base year) Prices in 2008 were 120% of base year prices Ch. 16-6 Aggregate Price Indexes An aggregate index is used to measure the rate of change from a base period for a group of items Aggregate Price Indexes Unweighted aggregate price index Weighted aggregate price indexes Laspeyres Index Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-7 Unweighted Aggregate Price Index Unweighted aggregate price index for period t for a group of K items: K p ti 100 iK1 p0i i1 i = item t = time period K = total number of items K p i1 ti K p i1 0i = sum of the prices for the group of items at time t = sum of the prices for the group of items in time period 0 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-8 Unweighted Aggregate Price Index: Example Automobile Expenses: Monthly Amounts ($): Index Year Lease payment Fuel Repair Total (2007=100) 2007 260 45 40 345 100.0 2008 280 60 40 380 110.1 2009 305 55 45 405 117.4 2010 310 50 50 410 118.8 I2010 P 100 P 2004 2001 410 (100) 118.8 345 Unweighted total expenses were 18.8% higher in 2010 than in 2007 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-9 Weighted Aggregate Price Indexes A weighted index weights the individual prices by some measure of the quantity sold If the weights are based on base period quantities the index is called a Laspeyres price index The Laspeyres price index for period t is the total cost of purchasing the quantities traded in the base period at prices in period t , expressed as a percentage of the total cost of purchasing these same quantities in the base period The Laspeyres quantity index for period t is the total cost of the quantities traded in period t , based on the base period prices, expressed as a percentage of the total cost of the base period quantities Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-10 Laspeyres Price Index Laspeyres price index for time period t: q0ip ti 100 iK1 q0ip0i i1 K q0i = quantity of item i purchased in period 0 p 0i = price of item i in time period 0 p ti = price of item i in period t Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-11 Laspeyres Quantity Index Laspeyres quantity index for time period t: K qtip0i 100 iK1 q0ip0i i1 p0i = price of item i in period 0 q0i = quantity of item i in time period 0 q ti = quantity of item i in period t Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-12 16.2 The Runs Test for Randomness The runs test is used to determine whether a pattern in time series data is random A run is a sequence of one or more occurrences above or below the median Denote observations above the median with “+” signs and observations below the median with “-” signs Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-13 The Runs Test for Randomness (continued) Consider n time series observations Let R denote the number of runs in the sequence The null hypothesis is that the series is random Appendix Table 14 gives the smallest significance level for which the null hypothesis can be rejected (against the alternative of positive association between adjacent observations) as a function of R and n Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-14 The Runs Test for Randomness (continued) If the alternative is a two-sided hypothesis on nonrandomness, the significance level must be doubled if it is less than 0.5 if the significance level, , read from the table is greater than 0.5, the appropriate significance level for the test against the twosided alternative is 2(1 - ) Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-15 Counting Runs Sales Median Time --+--++++-----++++ Runs: 1 2 3 4 5 6 n = 18 and there are R = 6 runs Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-16 Runs Test Example n = 18 and there are R = 6 runs Use Appendix Table 14 n = 18 and R = 6 the null hypothesis can be rejected (against the alternative of positive association between adjacent observations) at the 0.044 level of significance Therefore we reject that this time series is random using = 0.05 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-17 Runs Test: Large Samples Given n > 20 observations Let R be the number of sequences above or below the median Consider the null hypothesis H0: The series is random If the alternative hypothesis is positive association between adjacent observations, the decision rule is: Reject H0 if Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall n R 1 2 z z α 2 n 2n 4(n 1) Ch. 16-18 Runs Test: Large Samples (continued) Consider the null hypothesis H0: The series is random If the alternative is a two-sided hypothesis of nonrandomness, the decision rule is: Reject H0 if n R 1 2 z z α/2 2 n 2n 4(n 1) Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall n R 1 2 or z z α/2 2 n 2n 4(n 1) Ch. 16-19 Example: Large Sample Runs Test A filling process over- or under-fills packages, compared to the median OOO U OO U O UU OO UU OOOO UU O UU OOO UUU OOOO UU OO UUU O U OO UUUUU OOO U O UU OOO U OOOO UUU O UU OOO U OO UU O U OO UUU O UU OOOO UUU OOO n = 100 (53 overfilled, 47 underfilled) R = 45 runs Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-20 Example: Large Sample Runs Test (continued) A filling process over- or under-fills packages, compared to the median n = 100 , R = 45 n 100 R 1 45 1 6 2 2 Z 1.206 2 2 n 2n 100 2(100) 4.975 4(n 1) 4(100 1) Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-21 Example: Large Sample Runs Test (continued) H0: Fill amounts are random H1: Fill amounts are not random Test using = 0.05 Rejection Region /2 = 0.025 Rejection Region /2 = 0.025 1.96 0 1.96 Since z = -1.206 is not less than -z.025 = -1.96, we do not reject H0 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-22 16.3 Time-Series Data Numerical data ordered over time The time intervals can be annually, quarterly, daily, hourly, etc. The sequence of the observations is important Example: Year: 2005 2006 2007 2008 2009 Sales: 75.3 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 74.2 78.5 79.7 80.2 Ch. 16-23 Time-Series Plot A time-series plot is a two-dimensional plot of time series data the vertical axis measures the variable of interest the horizontal axis corresponds to the time periods Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall U.S. Inflation Rate Ch. 16-24 Time-Series Components Time Series Trend Component Seasonality Component Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Cyclical Component Irregular Component Ch. 16-25 Trend Component Long-run increase or decrease over time (overall upward or downward movement) Data taken over a long period of time Sales Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Time Ch. 16-26 Trend Component (continued) Trend can be upward or downward Trend can be linear or non-linear Sales Sales Time Downward linear trend Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Time Upward nonlinear trend Ch. 16-27 Seasonal Component Short-term regular wave-like patterns Observed within 1 year Often monthly or quarterly Year n+1 Year n Sales Summer Winter Summer Spring Winter Fall Fall Spring Time (Quarterly) Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-28 Cyclical Component Long-term wave-like patterns Regularly occur but may vary in length Often measured peak to peak or trough to trough 1 Cycle Sales Year Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-29 Irregular Component Unpredictable, random, “residual” fluctuations Due to random variations of Nature Accidents or unusual events “Noise” in the time series Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-30 Time-Series Component Analysis Used primarily for forecasting Observed value in time series is the sum or product of components Additive Model Xt Tt St Ct It Multiplicative model (linear in log form) Xt TtStCtIt where Tt = Trend value at period t St = Seasonality value for period t Ct = Cyclical value at time t It = Irregular (random) value for period t Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-31 16.4 Moving Averages: Smoothing the Time Series Calculate moving averages to get an overall impression of the pattern of movement over time This smooths out the irregular component Moving Average: averages of a designated number of consecutive time series values Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-32 (2m+1)-Point Moving Average A series of arithmetic means over time Result depends upon choice of m (the number of data values in each average) Examples: For a 5 year moving average, m = 2 For a 7 year moving average, m = 3 Etc. Replace each xt with m 1 X *t X t j (t m 1, m 2,, n m) 2m 1 j m Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-33 Moving Averages Example: Five-year moving average First average: x 5* Second average: x *6 x1 x 2 x 3 x 4 x 5 5 x2 x3 x 4 x5 x6 5 etc. Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-34 Example: Annual Data 1 2 3 4 5 6 7 8 9 10 11 etc… Sales 23 40 25 27 32 48 33 37 37 50 40 etc… Annual Sales 60 50 … 40 Sales Year 30 20 10 0 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 1 2 3 4 5 6 7 8 9 10 11 … Year Ch. 16-35 Calculating Moving Averages Let m = 2 Year Sales Average Year 5-Year Moving Average 1 23 3 29.4 2 40 4 34.4 3 25 5 33.0 4 27 6 35.4 5 32 7 37.4 6 48 8 41.0 7 33 9 39.4 8 37 … … 9 37 10 50 11 40 etc… 29.4 23 40 25 27 32 5 Each moving average is for a consecutive block of (2m+1) years Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-36 Annual vs. Moving Average The 5-year moving average smoothes the data and shows the underlying trend Annual vs. 5-Year Moving Average 60 50 40 Sales 30 20 10 0 1 2 3 4 5 6 7 8 9 10 11 Year Annual Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 5-Year Moving Average Ch. 16-37 Centered Moving Averages (continued) Let the time series have period s, where s is even number i.e., s = 4 for quarterly data and s = 12 for monthly data To obtain a centered s-point moving average series Xt*: Form the s-point moving averages x * t .5 s/2 j (s/2)1 x t j s s s s (t , 1, 2,, n ) 2 2 2 2 Form the centered s-point moving averages x *t .5 x *t .5 x 2 * t Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall s s s (t 1, 2,, n ) 2 2 2 Ch. 16-38 Centered Moving Averages Used when an even number of values is used in the moving average Average periods of 2.5 or 3.5 don’t match the original periods, so we average two consecutive moving averages to get centered moving averages Average Period 4-Quarter Moving Average Centered Period Centered Moving Average 2.5 28.75 3 29.88 3.5 31.00 4 32.00 4.5 33.00 5 34.00 5.5 6 36.25 6.5 35.00 etc… 37.50 7 38.13 7.5 38.75 8 39.00 8.5 39.25 9 40.13 9.5 41.00 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-39 Calculating the Ratio-to-Moving Average Now estimate the seasonal impact Divide the actual sales value by the centered moving average for that period xt 100 * xt Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-40 Calculating a Seasonal Index Quarter Sales Centered Moving Average 1 2 3 4 5 6 7 8 9 10 11 … 23 40 25 27 32 48 33 37 37 50 40 … 29.88 32.00 34.00 36.25 38.13 39.00 40.13 etc… … … Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ratio-toMoving Average 83.7 84.4 94.1 132.4 86.5 94.9 92.2 etc… … … x3 25 100 * (100) 83.7 x3 29.88 Ch. 16-41 Calculating Seasonal Indexes (continued) Fall Fall Fall Quarter Sales Centered Moving Average 1 2 3 4 5 6 7 8 9 10 11 … 23 40 25 27 32 48 33 37 37 50 40 … 29.88 32.00 34.00 36.25 38.13 39.00 40.13 etc… … … Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ratio-toMoving Average 83.7 84.4 94.1 132.4 86.5 94.9 92.2 etc… … … 1. Find the median of all of the same-season values 2. Adjust so that the average over all seasons is 100 Ch. 16-42 Interpreting Seasonal Indexes Suppose we get these seasonal indexes: Season Seasonal Index Interpretation: Spring sales average 82.5% of the annual average sales Spring 0.825 Summer 1.310 Summer sales are 31.0% higher than the annual average sales Fall 0.920 etc… Winter 0.945 = 4.000 -- four seasons, so must sum to 4 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-43 16.5 Exponential Smoothing A weighted moving average Weights decline exponentially Most recent observation weighted most Used for smoothing and short term forecasting (often one or two periods into the future) Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-44 Exponential Smoothing (continued) The weight (smoothing coefficient) is Subjectively chosen Range from 0 to 1 Smaller gives more smoothing, larger gives less smoothing The weight is: Close to 0 for smoothing out unwanted cyclical and irregular components Close to 1 for forecasting Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-45 Exponential Smoothing Model Exponential smoothing model xˆ 1 x1 xˆ t α xˆ t 1 (1 α )x t where: (0 α 1; t 1,2,, n) xˆ t = exponentially smoothed value for period t xˆ t -1 = exponentially smoothed value already computed for period i - 1 xt = observed value in period t = weight (smoothing coefficient), 0 < < 1 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-46 Exponential Smoothing Example Suppose we use weight = .2 xˆ t 0.2 xˆ t 1 (1 0.2)x t Time Period (i) 1 2 3 4 5 6 7 8 9 10 etc. Sales (Yi) 23 40 25 27 32 48 33 37 37 50 etc. Forecast from prior period (Ei-1) Exponentially Smoothed Value for this period (Ei) -23 26.4 26.12 26.296 27.437 31.549 31.840 32.872 33.697 etc. 23 (.2)(40)+(.8)(23)=26.4 (.2)(25)+(.8)(26.4)=26.12 (.2)(27)+(.8)(26.12)=26.296 (.2)(32)+(.8)(26.296)=27.437 (.2)(48)+(.8)(27.437)=31.549 (.2)(48)+(.8)(31.549)=31.840 (.2)(33)+(.8)(31.840)=32.872 (.2)(37)+(.8)(32.872)=33.697 (.2)(50)+(.8)(33.697)=36.958 etc. Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall xˆ 1 = x1 since no prior information exists Ch. 16-47 Sales vs. Smoothed Sales Fluctuations have been smoothed 60 50 NOTE: the smoothed value in this case is generally a little low, since the trend is upward sloping and the weighting factor is only .2 Sales 40 30 20 10 0 1 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall 2 3 4 5 6 7 Time Period Sales 8 9 10 Smoothed Ch. 16-48 Forecasting Time Period (t + 1) The smoothed value in the current period (t) is used as the forecast value for next period (t + 1) At time n, we obtain the forecasts of future values, Xn+h of the series xˆ nh xˆ n (h 1,2,3 ) Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-49 Exponential Smoothing in Excel Use Data / Data Analysis / exponential smoothing The “damping factor” is (1 - ) Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-50 Forecasting with the Holt-Winters Method: Nonseasonal Series To perform the Holt-Winters method of forecasting: Obtain estimates of level xˆ t and trend Tt as xˆ 1 x 2 T2 x 2 x1 xˆ t (1 α)(xˆ t 1 Tt 1 ) αx t (0 α 1; t 3,4,, n) Tt (1 β)Tt 1 β(xˆ t xˆ t 1 ) (0 β 1; t 3,4,, n) Where and are smoothing constants whose values are fixed between 0 and 1 Standing at time n , we obtain the forecasts of future values, Xn+h of the series by xˆ nh xˆ n hTn Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-51 Forecasting with the Holt-Winters Method: Seasonal Series Assume a seasonal time series of period s The Holt-Winters method of forecasting uses a set of recursive estimates from historical series These estimates utilize a level factor, , a trend factor, , and a multiplicative seasonal factor, Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-52 Forecasting with the Holt-Winters Method: Seasonal Series (continued) The recursive estimates are based on the following equations xt Ft s (0 α 1) Tt (1 β)Tt 1 β(xˆ t xˆ t 1 ) (0 β 1) xˆ t (1 α)(xˆ t 1 Tt 1 ) α xt Ft (1 γ )Ft s γ xˆ t (0 γ 1) Where xˆ t is the smoothed level of the series, Tt is the smoothed trend of the series, and Ft is the smoothed seasonal adjustment for the series Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-53 Forecasting with the Holt-Winters Method: Seasonal Series (continued) After the initial procedures generate the level, trend, and seasonal factors from a historical series we can use the results to forecast future values h time periods ahead from the last observation Xn in the historical series The forecast equation is xˆ nh (xˆ t hTt )Ft hs where the seasonal factor, Ft, is the one generated for the most recent seasonal time period Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-54 16.6 Autoregressive Models Used for forecasting Takes advantage of autocorrelation 1st order - correlation between consecutive values 2nd order - correlation between values 2 periods apart pth order autoregressive model: x t γ φ1x t 1 φ2 x t 2 φp x t p εt Random Error Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-55 Autoregressive Models (continued) Let Xt (t = 1, 2, . . ., n) be a time series A model to represent that series is the autoregressive model of order p: x t γ φ1x t 1 φ2 x t 2 φp x t p εt where , 1 2, . . .,p are fixed parameters t are random variables that have mean 0 constant variance and are uncorrelated with one another Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-56 Autoregressive Models (continued) The parameters of the autoregressive model are estimated through a least squares algorithm, as the values of , 1 2, . . .,p for which the sum of squares SS n 2 (x γ φ x φ x φ x ) t 1 t 1 2 t 2 p t p t p 1 is a minimum Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-57 Forecasting from Estimated Autoregressive Models Consider time series observations x1, x2, . . . , xt Suppose that an autoregressive model of order p has been fitted to these data: x t γˆ φˆ1x t 1 φˆ2 x t 2 φˆp x t p εt Standing at time n, we obtain forecasts of future values of the series from xˆ t h γˆ φˆ1xˆ t h1 φˆ2 xˆ t h2 φˆp xˆ t hp (h 1,2,3,) ˆ n j is the forecast of Xt+j standing at time n and Where for j > 0, x for j 0 , x ˆ n j is simply the observed value of Xt+j Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-58 Autoregressive Model: Example The Office Concept Corp. has acquired a number of office units (in thousands of square feet) over the last eight years. Develop the second order autoregressive model. Year 2002 2003 2004 2005 2006 2007 2008 2009 Units 4 3 2 3 2 2 4 6 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-59 Autoregressive Model: Example Solution Develop the 2nd order table Use Excel to estimate a regression model Excel Output Coefficients I n te rc e p t 3.5 X V a ri a b l e 1 0.8125 X V a ri a b l e 2 -0 . 9 3 7 5 Year 2002 2003 2004 2005 2006 2007 2008 2009 xt 4 3 2 3 2 2 4 6 xt-1 -4 3 2 3 2 2 4 xt-2 --4 3 2 3 2 2 xˆ t 3.5 0.8125xt 1 0.9375xt 2 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-60 Autoregressive Model Example: Forecasting Use the second-order equation to forecast number of units for 2010: xˆ t 3.5 0.8125x t 1 0.9375x t 2 xˆ 2010 3.5 0.8125(x2009 ) 0.9375(x2008 ) 3.5 0.8125(6) 0.9375(4) 4.625 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-61 Autoregressive Modeling Steps Choose p Form a series of “lagged predictor” variables xt-1 , xt-2 , … ,xt-p Run a regression model using all p variables Test model for significance Use model for forecasting Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-62 Chapter Summary Discussed weighted and unweighted index numbers Used the runs test to test for randomness in time series data Addressed components of the time-series model Addressed time series forecasting of seasonal data using a seasonal index Performed smoothing of data series Moving averages Exponential smoothing Addressed autoregressive models for forecasting Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall Ch. 16-63