Timeseries forecasting

32
Time Series Forecasting Outline: 1. Measuring forecast error 2. The multiplicative time series model 3. Naïve extrapolation 4. The mean forecast model 5. Moving average models 6. Weighted moving average models 7. Constructing a seasonal index using a centered moving average 8. Exponential smoothing

description

Time series forecasting

Transcript of Timeseries forecasting

  • 1. Time Series Forecasting Outline: 1. Measuring forecast error 2. The multiplicative time series model 3. Nave extrapolation 4. The mean forecast model 5. Moving average models 6. Weighted moving average models 7. Constructing a seasonal index using a centered moving average 8. Exponential smoothing

2. Forecast error Forecasting Convenience Store Ice Sales (1) Forecasted Month/Year Value(2) Actual Value(3) = (2) (1) ErrorJuly 2000$390$423$33Aug 2000450429-21Sept 200028930112 3. 3 measures of forecast error Mean absolute deviation Mean square error Root mean square error. 4. Actual PredictedTimeAverage Absolute Error (AAE) is given by: 1 AAE = mmY t t Yt= 1Where Yt is the actual value of variable that we seek to forecast and Yt is the fitted or forecasted value of the variable. 5. Actual PredictedTimeMean Square Error (MSE) is given by: 1 MSE = mm(Yi i ) 2 Y t= 1Where Yt is the actual value of variable that we seek to forecast and Yt is the fitted or forecasted value of the variable.You can think of MSE as the average forecast error. If we have a perfect forecast, then MSE = 0. 6. ActualPredictedTimeRoot Mean Square Error (root MSE) is given by: rootMSE =1 mm(Yt t ) 2 Y t= 1Root MSE is a statistic that is typically is reported by forecasting software applications 7. The time path of a variable (such as monthly sales of building materials by supply stores) is produced by the interaction of 4 factors or components. These components are: 1. The trend component (T) 2. The seasonal component (S) 3. The cyclical component (C); and 4. The irregular component (I) 8. The trend component (T) Trend is the gradual, longrun (or secular) evolution of the variables that we are seeking to forecast. 9. Factors affecting the trend component of a time series Population changes Demographic changes. For example, spending for healthcare services is likely to rise due to the aging of the population. Sales of fast food are up due to the secular increase in the female labor force participation rate. Technological change. Sales of music on DVD have slumped due to Ipods. Typewriter sales have plumetted. Changes in consumer tastes and preferences. 10. Linear trends 4020Trend = 10 25t0-20-40Trend = -50 + .8t -60 102030405060708090100 11. Non-linear, increasing trend 40003000Trend = 10 + .3t + .3t2 200010000 102030405060708090100 12. Non-linear, decreasing trend 1000Trend = 10 - .4t - .4t20 -1000 -2000 -3000 -4000 -5000 102030405060708090100 13. The seasonal component (S)Many series display a regular pattern of variability depending on the time of year. For example, sales of toys and scotch whiskey peak in December each year. Ice cream sales are higher in summer months than in winter months. Car sales tend typically to be strong in May and June and weaker in November and December. 14. The cyclical component (C) The time path of a series can be influenced by business cycle fluctuations. For example, we expect housing starts to decline in the contractionary phase of the business cycle. The same holds true for federal or state tax receipts The time path of spending for consumer durable goods is also shaped by cyclical forces. Spending for capital goods is likewise cyclical. The movie industry has the reputation for being counter-cyclicalfor example, it flourished during the Depression. 15. The irregular component (I) The irregular component of the series, sometimes called white noise, is the remaining variability (relative to trend) that cannot be explained by seasonal or cyclical factors. The irregular component is an unexpected, non-recurring factor that affects the series. For example, hamburger sales plunge due to panic about E-Coli bacteria. Production of trucks slumps because of a strike at a GM parts plant in Ohio. Airline slump after 9/11. A cold snap affects July ice cream sales in upstate NY. 16. If you have a well-designed forecasting model, then forecasting errors should be mainly accounted for by irregular factors 17. The modelYt = Tt St Ct ItWhere: Yt is the value of the time series variable in period t (month t, quarter t, etc.) Tt trend component of the series in period t St is the seasonal component of the series in period t Ct is the cylical component of the series at period t; and It is the irregular component of the series in period t. 18. The trend component (T) is measured in the units in which the time series itself is measured. So, for example, the trend component for state revenues would be measured in dollars; whereas the trend component for steel production might be measured in tons. 19. The Problem: Forecast Sales of Home Furnishing Stores, October-December, 2007 The data: We have monthly data of sales of home furniture stores January 1992 to July 2007 (187 monthly observations). The data are expressed in millions of current dollars, not seasonally adjusted 20. t 1 2 3 4 5 6 7 8 9 10 11 12 " " 187 The DataYr 1992 1992 1992 1992 1992 1992 1992 1992 1992 1992 1992 1992 " " 2007Mo 1 2 3 4 5 6 7 8 9 10 11 12 " " 7$ 1460 1453 1556 1622 1675 1759 1789 1814 1721 1839 1925 2246 " " 4803 21. Sales of Home Furnishing Stores, 1992-2007 (millions of dollars, NSA)7000 6000 5000 4000 3000 2000 1000 929496980002Year/MonthSource: Economagic.com0406 22. Our first step is to estimate the trend component of our series. This is accomplished using a ordinary least squares, or OLS for short.OLS is a method of finding the line, or curve, of best fit. The trend function of best fit is the one that minimizes the squared sum of the vertical distances of the sample points (the actual monthly values of home furnishing sales) from the trend line (fitted values of monthly building materials sales). 23. Let: Yt be the actual value of furniture store sales in month t; Let t be the trend value of furniture store sales in month t. The trend function we are seeking satisfies the following condition: 187 MIN . (Y t Yt ) 2 t =1 24. We estimate a linear trend function with Excel. It is displayed on the next slide. 25. R2 = 0.83t 26. Actual and Trend Values of Hom Furniture Sales (in millions)7000 6000 5000 4000 3000 2000 1000 92949698 00 Year/Month Actual02 TREND0406 27. Seasonal Index Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov DecIndex 0.8799 0.8475 0.9823 0.9004 0.9939 1.0197 0.9729 1.0487 1.0042 0.9962 1.123 1.2969If you sum the monthly values and divide by 12, you get 1.00. Later we show a simple technique for computing a seasonal index. 28. Performing an in-sample forecast of home furnishing sales An in-sample forecast means we are forecasting home furshing sales for those months for which we already have data that have been used to estimate the trend, seasonal, and other components. Comparing forecasted, or fitted values of home furnishing sales with actual time series data gives us an idea of how well this performs. We will assume that the cyclical index is equal to 1 (Ct = 1). This is a poor assumption since our period contains two business cycle contractions. 29. Lets give an example how we use this model to Home furnishing sales for a particular month, say, April 1998 . t = 76 for this month FApr 98 = Tt St Ct FApr 98 = [(17.62 76) +1475] 0.900 1 = $2,532.71 30. In-Sample Forecast of Home Furnishing Sales Using Multiplicative Model7000 6000 5000 4000 3000 2000 1000 9496Multiplcative model98 00 Year/Month020406Home furnishing sales (millions) 31. Residuals from In-sample Forecast of Home Furnishing Sales (in millions)300Recession is shaded200 100 0 -100 -200 -300 9496MSE = $103.2759800 Year/Month020406 32. Forecasting Using the Multiplicative ModeltYr/MoTrendSeasonalCyclicalForecast1902007/Oct4822.80.99620.9994799.6691912007/Nov4840.421.1230.9795321.641922007/Dec4858.041.29690.9756142.882