1 / 40

Time Series Analysis

Time Series Analysis. Autocorrelation Naive & Simple Averaging Moving Averages Exponential Smoothing Regression Analysis. Time Series Models. Trends: linear moving average, exponential smoothing, Regression, growth curves Seasonality:

andrew
Download Presentation

Time Series Analysis

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Time Series Analysis • Autocorrelation • Naive & Simple Averaging • Moving Averages • Exponential Smoothing • Regression Analysis

  2. Time Series Models • Trends: • linear moving average, exponential smoothing, Regression, growth curves • Seasonality: • classical decomposition, multiple regression, time series & Box-Jenkins • Cyclical: • classical decomposition, economic indicators, econometric models, multiple regression and Box-Jenkins

  3. Evaluating Methods • Forecasting method is selected - many times by intuition, previous experience, or computer resource availability • Divide the data into two sections - an initialization part and a test part • Use the forecast technique to determine the fitted values for the initialization data set • Use the forecast technique to forecast the test data set and determine the forecast errors • Evaluate errors (MAD, MPE, MSE, MAPE) • Use the technique, modify, or develop new model

  4. Naive Models • Recent periods are the best predictors of the future • Adjustments to naive models Trend Rate of Change

  5. Use 1990-95 as initialization Use 1996 as the test data set Forecast the first period in 1996 Forecast error: Forecast for the remaining 1996 quarters and calculate the error - what do you see happening?

  6. Naïve Models: Trended Data • Nonstationary - data values increase over time

  7. Naïve Methods: Rate of Change Can also use Naïve models for seasonal forecasts - data indicates that Quarter 1 seems to be higher than 2,3,4.

  8. Averaging Methods • Simple Averages - quick, inexpensive (should only be used on stationary data) • Moving Averages - a constant number specified at the outset and a mean computed for the most recent observations - such as a 3 or 4 period moving average. • Works best with stationary data. • The larger the order of the moving average, the greater the smoothing effect. Larger n when there are wide, infrequent fluctuations in the data. • By smoothing recent actual values, removes randomness.

  9. If you suspect seasonality, with quarterly data, it makes sense to use a 4-period moving average (monthly data would use a 12 period moving average). The larger the number of periods, the smoother the fluctuations become.

  10. How many periods? • To determine how many periods to use for a moving average, remember: • The smaller the number, the more weight given to recent periods. • A smaller number is desirable when there are sudden shifts in the level of the series. • The greater the number, less weight is given to more recent periods. • A larger number is desirable when there are wide or infrequent fluctuations in the data

  11. Double Moving Averages • Double Moving Averages - designed to handle trending data. One set of moving averages is calculated and then a second set is calculated as a moving average of the first set. • Weighted Moving Average - place more weight on recent observations. Sum of the weights needs to equal 1.

  12. More on Moving Averages • Moving averages are used with quarterly or monthly data to help examine the components within a time series. • Used as a forecast, large-order moving averages pays very little attention to fluctuations in the data series • Minitab does a great job with SMA. However, you will need to use Excel to calculate DMA.

  13. Moving average Data Rents Length 15.0000 NMissing 0 Moving Average Length: 3 Accuracy Measures MAPE: 1.404 MAD: 9.806 MSD: 132.676 Row Period Rents AVER1 Predict Error 1 1 654 * * * 2 2 658 * * * 3 3 665 659.000 * * 4 4 672 665.000 659.000 13.0000 5 5 673 670.000 665.000 8.0000 6 6 671 672.000 670.000 1.0000 7 7 693 679.000 672.000 21.0000 8 8 694 686.000 679.000 15.0000 9 9 701 696.000 686.000 15.0000 10 10 703 699.333 696.000 7.0000 11 11 702 702.000 699.333 2.6667 12 12 710 705.000 702.000 8.0000 13 13 712 708.000 705.000 7.0000 14 14 711 711.000 708.000 3.0000 15 15 728 717.000 711.000 17.0000 Stat, Time Series, Moving Average Enter the variable name and the number of periods - this example uses a 3 period moving average. MAPE, MAD and MSE (noted as MSD for Mean Squared Deviations) is automatically calculated. Row Period FORE1 Lower Upper 1 16 717 694.424 739.576

  14. Formulas for DMA 1. In Excel, Calculate a SMA. 2. Calculate the DMA from the SMA with a SMA using the same number of periods 3. Compute the differences between SMA and DMA. This value is noted as a. 4. Calculate an adjustment factor (similar to the slope in regression) that measures the change over the series, noted as b. 5. Calculate the forecast p periods into the future (usually 1) 6. Calculate the error for each period

  15. Weekly Rents DMA example

  16. Cell Formulas Excel has a built-in Moving Average function within the Data Analysis tool pack - but it is only a SMA.

  17. Prediction Intervals • A good way to test to see if your model has good predictability to is look at the probability that the actual values will be within a 95% interval. • If n<30, use ta/2,n-1

  18. Exponential Smoothing Methods • Single Exponential Smoothing (Averaging) • Tracking • Double Exponential Smoothing • Holt’s Method • Winter’s Model

  19. Exponential Smoothing Methods • Continually revising a forecast in light of more recent experiences. Averaging (smoothing) past values of a series in a decreasing (exponential) manner. The observations are weighted with more weight being given to the more recent observations

  20. Exponential Smoothing Methods • When looking at the formula - it is really the old forecast plus a times the error in the old forecast • To get started, we need a smoothing constant, an initial forecast, and an actual value. Can use the first actual as the forecast value or you can average the first n observations. Minitab’s default is 6. • The smoothing constant serves as the weighting factor. When a is close to 1, the new forecast will include a substantial adjustment for any error that occurred in the preceding forecast. When a is close to 0, the new forecast is very similar to the old forecast. Iterative procedure to chose a by minimizing MSE. • The smoothing constant is not an arbitrary choice - but generally falls between .1 and .5. If we want predictions to be stable and random variation smoothed, use a small a. If we want a rapid response a larger a value is required.

  21. Use Minitab to generate output!!! Row Time Sales SMOO1 Predict RESI1 1 1 500 500.000 500.000 0.000 2 2 350 485.000 500.000 -150.000 3 3 250 461.500 485.000 -235.000 4 4 400 455.350 461.500 -61.500 5 5 450 454.815 455.350 -5.350 6 6 350 444.334 454.815 -104.815 7 7 200 419.900 444.334 -244.334 8 8 300 407.910 419.900 -119.900 9 9 350 402.119 407.910 -57.910 10 10 200 381.907 402.119 -202.119 11 11 150 358.716 381.907 -231.907 12 12 400 362.845 358.716 41.284 13 13 550 381.560 362.845 187.155 14 14 350 378.404 381.560 -31.560 15 15 250 365.564 378.404 -128.404 16 16 550 384.007 365.564 184.436 17 17 550 400.607 384.007 165.993 18 18 400 400.546 400.607 -0.607 19 19 350 395.491 400.546 -50.546 20 20 600 415.942 395.491 204.509 21 21 750 449.348 415.942 334.058 22 22 500 454.413 449.348 50.652 23 23 400 448.972 454.413 -54.413 24 24 650 469.075 448.972 201.028 Row Period Forecast Lower Upper 1 25 469.075 157.978 780.172 Outside tracking interval Single Exponential Smoothing Data Sales Length 24.0000 NMissing 0 Smoothing Constant Alpha: 0.1 Accuracy Measures MAPE: 38.9 MAD: 127.0 MSD: 24261.7 Note that a is set to .1 and that the initial forecast value is the first actual value

  22. The small a here smooths the data.

  23. Row Time Sales Smooth Predict Error 1 1 500 500.000 500.000 0.000 2 2 350 410.000 500.000 -150.000 3 3 250 314.000 410.000 -160.000 4 4 400 365.600 314.000 86.000 5 5 450 416.240 365.600 84.400 6 6 350 376.496 416.240 -66.240 7 7 200 270.598 376.496 -176.496 8 8 300 288.239 270.598 29.402 9 9 350 325.296 288.239 61.761 10 10 200 250.118 325.296 -125.296 11 11 150 190.047 250.118 -100.118 12 12 400 316.019 190.047 209.953 13 13 550 456.408 316.019 233.981 14 14 350 392.563 456.408 -106.408 15 15 250 307.025 392.563 -142.563 16 16 550 452.810 307.025 242.975 17 17 550 511.124 452.810 97.190 18 18 400 444.450 511.124 -111.124 19 19 350 387.780 444.450 -94.450 20 20 600 515.112 387.780 212.220 21 21 750 656.045 515.112 234.888 22 22 500 562.418 656.045 -156.045 23 23 400 464.967 562.418 -162.418 24 24 650 575.987 464.967 185.033 Row Period Forecast Lower Upper 1 25 575.987 246.364 905.610 Single Exponential Smoothing Data Sales Length 24.0000 NMissing 0 Smoothing Constant Alpha: 0.6 Accuracy Measures MAPE: 36.5 MAD: 134.5 MSD: 22248.4 You can only forecast for 1 period - because the formula requires actual data from the current period. If you forecast more than 1 period, it will remain the same as a 1 period forecast.

  24. The large a in this example responds quickly to the data.

  25. Tracking • Use a tracking signal (measure of errors over time) and setting limits. For example, if we forecast 10 periods, count the number of negative and positive errors. If the number of positive errors is substantially less or greater than n/2, then the process is out of control. • Can also use 95% prediction interval (1.96 * sqrt (MSE)). If the forecast error is outside of the interval, use a new optimal a. • Looking back at the .1 single exponential smoothing: 1.96*sqrt(24261) = +-305 Observation #21 is out-of-control. We need to re-evaluate alpha level because this technique is biased.

  26. Double Exponential Smoothing • Also known as Brown’s Method. Used to forecast a series with a linear trend.

  27. Double Exponential Smoothing • Uses a single coefficient, alpha, for both smoothing operations. Calculates the difference between single and double smoothed values as a measure of trend (at). It then adds this value to the single smoothed value together with an adjustment for the current trend (bt). • In Minitab, use the same a value for the trend and level. Do NOT optimize for Brown’s Method! • Minitab sets the initial value for the smoothed series and trend adjustment by calculating the trend’s slope and intercept using the least square’s method. • If you use Excel, use the Actual values of period 1 to estimate the single and double exponentially smoothed values. Realize that Excel is assuming there is no trend present and will tend to underestimate!

  28. Before running Brown’s method; here is single exponential for Rental data with a set to .2

  29. Row Time Rents Smooth Predict Error 1 1 654 654.750 655.250 -1.2500 2 2 658 658.891 659.486 -1.4857 3 3 665 664.034 663.389 1.6106 4 4 672 670.074 668.789 3.2107 5 5 673 674.406 675.343 -2.3430 6 6 671 675.980 679.300 -8.3003 7 7 693 684.928 679.547 13.4533 8 8 694 691.988 690.647 3.3530 9 9 701 699.346 698.244 2.7563 10 10 703 704.826 706.043 -3.0427 11 11 702 707.421 711.035 -9.0353 12 12 710 711.311 712.185 -2.1852 13 13 712 714.235 715.725 -3.7255 14 14 711 715.232 718.054 -7.0536 15 15 728 721.953 717.922 10.0781 Row Period Forecast Lower Upper 1 16 726.255 714.351 738.160 Double Exponential Smoothing Data Rents Length 15.0000 NMissing 0 Smoothing Constants Alpha (level): 0.4 Gamma (trend): 0.4 Accuracy Measures MAPE: 0.6978 MAD: 4.8589 MSD: 36.7840 The SMOOTH value is a Minitab does NOT output the value of b you can calculate the value of b1 by taking Prediction for period 2 and subtracting the Smooth value for period 1. You can store the b in Mintab by selecting the TREND option in Results.

  30. Notice that the MSE is much lower than single exponential smoothing and that the smoothed value is much closer to the data. This is due to the trending.

  31. Remember, large a responds rapidly to the data.

  32. The low a has smoothed the data.

  33. Setting the best a • The a level should always be between 0 and 1. However, Minitab is known for violating this rule. We will generally use .1 to .5. It becomes an art and a science in picking the “correct” level - stay with the objective of minimizing MSE. This may require running different levels and comparing MSE values.

  34. Holt’s Method • Extension of Brown’s double exponential smoothing but it uses two coefficients. • a is the smoothing constant for the level • b is the trend smoothing constant - used to remove random error • Using Minitab, select the OPTIMAL - but realize, Minitab will violate the a between 0 and 1.

  35. Winter’s Method • Extends Holt’s Method to include an estimate for seasonality. • a is the smoothing constant for the level • b is the trend smoothing constant - used to remove random error • g smoothing constant for seasonality • This fun formula removes seasonal effects. The forecast is modified by multiplying by a seasonal index. We will calculate this seasonal index in Chapter 8.

  36. Row Time Sales Smooth Predict Error 1 1 500 615.051 563.257 -63.257 2 2 350 365.798 328.859 21.141 3 3 250 249.233 222.565 27.435 4 4 400 421.495 375.344 24.656 5 5 450 415.817 367.063 82.937 6 6 350 281.175 249.255 100.745 7 7 200 216.030 195.221 4.779 8 8 300 352.436 315.576 -15.576 9 9 350 342.438 300.945 49.055 10 10 200 230.704 202.255 -2.255 11 11 150 141.989 121.863 28.137 12 12 400 234.808 201.294 198.706 13 13 550 322.295 292.949 257.051 14 14 350 276.632 263.306 86.694 15 15 250 218.565 211.335 38.665 16 16 550 434.487 423.599 126.401 17 17 550 539.216 532.584 17.416 18 18 400 355.337 351.428 48.572 19 19 350 266.412 264.999 85.001 20 20 600 582.413 586.284 13.716 21 21 750 645.882 650.706 99.294 22 22 500 462.731 468.626 31.374 23 23 400 354.980 360.255 39.745 24 24 650 699.938 712.712 -62.712 Row Period Forecast Lower Upper 1 25 778.179 622.470 933.889 2 26 521.917 352.933 690.902 3 27 393.430 209.778 577.082 4 28 716.726 517.321 916.132 Winters' multiplicative model Data Sales Length 24.0000 NMissing 0 Smoothing Constants Alpha (level): 0.4 Gamma (trend): 0.1 Delta (seasonal): 0.3 Accuracy Measures MAPE: 15.21 MAD: 63.55 MSD: 7636.86 Multiplicative model because we are multiplying the seasonal index by the current smoothed and trend values. Can use the Storage option to store trend and seasonal results.

  37. More on Winter’s • In order to Forecast, you would need to have all three estimates. Use Minitab to forecast. • On the exam, you would be required to state the forecast from the output. For Brown’s, Holt, & Winter’s you will not need to calculate a forecast. You should be able to calculate a forecast for Moving averages and Simple exponential smoothing. You should also be able to develop Prediction intervals, track the forecast, and determine the best forecast by comparing MSEs. • Do not try to memorize formula’s but do know the differences between Models

  38. For next time • We will run all models from Chapter 4 and compare with MSE and also track the errors based on 95% intervals using the data from Case 3.3. Key in this data.

More Related