Forecasting & Time Series Minggu 6 Learning Objectives • Understand the three categories of forecasting techniques available. • Become aware of the four components that make up a time series. • Understand how to identify which components are present in a specific time series. Learning Objectives, continued • Recognize the forecasting methods available for time series with specific components. • Learn several ways of identifying the forecasting methods with the least forecasting error. • Forecast for time series with specific components using stationary methods, trend methods, and seasonal methods. Introduction to Forecasting Forecasting is the art or science of predicting the future. Forecasting techniques (1) Qualitative techniques: Subjective estimates from informed sources that are used when historical data are scarce or non-existent - Examples: Delphi techniques, scenario writing, and visionary forecast. Introduction to Forecasting, continued (2) Time Series Techniques: Quantitative techniques that use historical data for only the forecast variable to find patterns. - Based on the premise that the factors that influenced patterns of activity in the past will continue to do so in the future. - Examples: moving averages, exponential smoothing, and trend projections Introduction to Forecasting, continued (3) Causal Techniques: Quantitative techniques based on historical data for the variable being forecast, and one or more explanatory variables. - Based on the supposition that a relationship exists between the variable to be forecast and other explanatory time series data. - Examples: regression models, econometric models, and leading indicators Time Series Components • Trend: Long-term upward or downward change in a time series • Seasonal: Periodic increases or decreases that occur within one year • Cyclical: Periodic increases or decreases that occur over more than a single year • Irregular: Changes not attributable to the other three components; non-systematic and unpredictable Components of Time Series Data Trend Seasonal Cyclical Irregular Components of Time Series Data Irregular fluctuations Cyclical Trend 1 2 3 4 5 6 7 Year 8 Seasonal 9 10 11 12 13 Composite Time Series Data 1 2 3 4 5 6 7 Year 8 9 10 11 12 13 Time Series Forecasting Procedure Step 1: Identifying Time Series Form • Trend component – time series plot – trend line • Seasonal component – folded annual time series plot – autocorrelation Step 2: Select Potential Methods • Stationary forecasting methods are effective for a stationary time series, that is one that contains only an irregular component. These methods attempt to eliminate the irregular through averaging. • Trend forecasting methods are effective for time series that contain a trend component. These methods asses the trend component and use it to make projections. • Seasonal forecasting methods are used for a time series that contains a trend, a seasonal and an irregular component. Step 3: Evaluate Potential Methods • Once the appropriate method has been chosen, it is used to forecast the historical data for the time series. The an evaluation is done of how close the estimates approach the actual historical data. • Forecasting Error: A single measure of the overall error of a forecast for an entire set of data. • Error of an Individual Forecast: The difference between the actual value and the forecast of that value. et = Yt - Ft Reasons for Forecast Failure • • • • • • • • Failure to examine assumptions Limited expertise Lack of imagination Neglect of constraints Excessive optimism Reliance on mechanical extrapolation Premature closure Over specification Measurement of Forecasting Error Mean Error (ME): The average of all the errors of forecast for a group of data. Mean Absolute Deviation (MAD): The mean, or average of the absolute values of the errors. Mean Square Error (MSE): The average of the squared errors. Mean Percentage Error (MPE): The average of the percentage errors of a forecast. Mean Absolute Percentage Error (MAPE): The average of the absolute values of the percentage errors of a forecast. Example: Nonfarm Partnership Tax Returns: Actual and Forecast with = .7 Year 1 2 3 4 5 6 7 8 9 10 11 Actual Forecast Error 1402 1458 1402.0 56.0 1553 1441.2 111.8 1613 1519.5 93.5 1676 1584.9 91.1 1755 1648.7 106.3 1807 1723.1 83.9 1824 1781.8 42.2 1826 1811.3 14.7 1780 1821.6 -41.6 1759 1792.5 -33.5 Mean Error for the Nonfarm Partnership Forecasted Data Year 1 2 3 4 5 6 7 8 9 10 11 Actual Forecast Error 1402.0 1458.0 1402.0 56.0 1553.0 1441.2 111.8 1613.0 1519.5 93.5 1676.0 1584.9 91.1 1755.0 1648.7 106.3 1807.0 1723.1 83.9 1824.0 1781.8 42.2 1826.0 1811.3 14.7 1780.0 1821.6 -41.6 1759.0 1792.5 -33.5 524.3 ME e i number of forecasts 524.3 10 52.43 Mean Absolute Deviation for the Nonfarm Partnership Forecasted Data Year 1 2 3 4 5 6 7 8 9 10 11 Actual Forecast Error 1402.0 1458.0 1402.0 56.0 1553.0 1441.2 111.8 1613.0 1519.5 93.5 1676.0 1584.9 91.1 1755.0 1648.7 106.3 1807.0 1723.1 83.9 1824.0 1781.8 42.2 1826.0 1811.3 14.7 1780.0 1821.6 -41.6 1759.0 1792.5 -33.5 |Error| 56.0 111.8 93.5 91.1 106.3 83.9 42.2 14.7 41.6 33.5 674.5 MAD e i number of forecasts 674.5 10 67.45 Mean Square Error for the Nonfarm Partnership Forecasted Data Year 1 2 3 4 5 6 7 8 9 10 11 Actual Forecast Error Error2 1402 1458 1402.0 56.0 3136.0 1553 1441.2 111.8 12499.2 1613 1519.5 93.5 8749.7 1676 1584.9 91.1 8292.3 1755 1648.7 106.3 11303.6 1807 1723.1 83.9 7038.5 1824 1781.8 42.2 1778.2 1826 1811.3 14.7 214.6 1780 1821.6 -41.6 1731.0 1759 1792.5 -33.5 1121.0 55864.2 e 2 MSE i number of forecasts 55864.2 10 5586.42 Mean Percentage Error for the Nonfarm Partnership Forecasted Data Year 1 2 3 4 5 6 7 8 9 10 11 Actual Forecast Error Error % 1402 1458 1402.0 56.0 3.8% 1553 1441.2 111.8 7.2% 1613 1519.5 93.5 5.8% 1676 1584.9 91.1 5.4% 1755 1648.7 106.3 6.1% 1807 1723.1 83.9 4.6% 1824 1781.8 42.2 2.3% 1826 1811.3 14.7 0.8% 1780 1821.6 -41.6 -2.3% 1759 1792.5 -33.5 -1.9% 31.8% ei X 100 i MPE number of forecasts 318 . 10 318% . Mean Absolute Percentage Error for the Nonfarm Partnership Forecasted Data Year 1 2 3 4 5 6 7 8 9 10 11 Actual Forecast Error |Error %| 1402 1458 1402.0 56.0 3.8% 1553 1441.2 111.8 7.2% 1613 1519.5 93.5 5.8% 1676 1584.9 91.1 5.4% 1755 1648.7 106.3 6.1% 1807 1723.1 83.9 4.6% 1824 1781.8 42.2 2.3% 1826 1811.3 14.7 0.8% 1780 1821.6 -41.6 2.3% 1759 1792.5 -33.5 1.9% 40.3% e i 100 Xi MAPE number of forecasts 40.3 10 4.03% Use of Error Measures To identify the best forecasting method • Use error measure to identify the best value for the parameters of a specific method. • Use error measure to identify the best method. • Use MSE and MAD for both of these situations. Note that MSE tends to emphasize large errors. Use of Error Measures, continued Forecast bias is the tendency of a forecasting method to over or under predict. The mean error, ME, measures the forecast bias. Step 4: Make Required Forecasts • The best forecasting method is that with the smallest overall error measurement. • Using a stationary method will make a forecast for one time into the future, Ft+1. This is also the forecast for all future time periods. • Forecasts made using a non-stationary method will not be the same for all time periods in the future. Stationary Forecasting Methods • Naive Forecasting Method • Moving Average Forecasting Method • Weighted Moving Average Forecasting Method • Exponential Smoothing Forecasting Method Naive Forecasting Simplest of the naive forecasting models We sold 532 pairs of shoes last week, I predict we’ll sell 532 pairs this week. t t the forecast for time period t t 1 the value for time period t - 1 F where: F X X t 1 Simple Average Forecasting Method The monthly average last 12 months was 56.45, so I predict 56.45 for September. Ft X t 1 X t 2 X n Month Year January February March April May June July August September October November December 1994 t 3 X t n Cents per Gallon 61.3 63.3 62.1 59.8 58.4 57.6 55.7 55.1 55.7 56.7 57.2 58.0 Month Year January February March April May June July August September October November December 1995 Cents per Gallon 58.2 58.3 57.7 56.7 56.8 55.5 53.8 52.8 Moving Average Forecasting Method • Updated (recomputed) for every new time period • May be difficult to choose optimal number of periods • May not adjust for trend, cyclical, or Update me each period. seasonal effects F t X t 1 X t 2 X n t 3 .... X t n Weighted Moving Average Forecasting Method F W X t 1 t t 1 W t 2 X t 2 W t 3 X t 3 ... W t n X t n t n W i t 1 i Exponential Smoothing Forecasting Method where: t 1 X t 1 F t t 1 the forecast for the next time period (t+1) t the forecast for the present time period (t) t the actual value for the present time period F F F X = a value between 0 and 1 is the exponential smoothing constant Trend Forecasting Methods • Linear Trend Projection Forecasting Method: Forecasting by fitting a linear equation to a time series • Non-linear Trend Projection Forecasting Method: Forecasting by fitting a non-linear equation to a time series Average Hours Worked per Week by Canadian Manufacturing Workers Period Hours 1 37.2 2 37.0 3 37.4 4 37.5 5 37.7 6 37.7 7 37.4 8 37.2 9 37.3 10 37.2 Period Hours Period Hours 11 36.9 21 35.6 12 36.7 22 35.2 13 36.7 23 34.8 14 36.5 24 35.3 15 36.3 25 35.6 16 35.9 26 35.6 17 35.8 27 35.6 18 35.9 28 35.9 19 36.0 29 36.0 20 35.7 30 35.7 Period Hours 31 35.7 32 35.5 33 35.6 34 36.3 35 36.5 Excel Regression Output using Linear Trend Regression Statistics Multiple R 0.782 R Square 0.611 Adjusted R Square 0.5600 Standard Error 0.509 Observations 35 Y X Y data value for period i X time period Y 37.416 0.0614 X i where: 0 1 ti i i i t ANOVA df Regression Residual Total Intercept Period SS MS F 1 13.4467 13.4467 51.91 33 8.5487 0.2591 34 21.9954 Significance F .00000003 Coefficients Standard Error t Stat 37.4161 0.17582 212.81 -0.0614 0.00852 -7.20 P-value .0000000 .00000003 Work Week Excel Graph of Hours Worked Data with a Linear Trend Line 38.0 37.5 37.0 36.5 36.0 35.5 35.0 34.5 0 5 10 15 20 25 Time Period 30 35 Excel Regression Output using Quadratic Trend Regression Statistics Multiple R 0.8723 R Square 0.761 Adjusted R Square 0.747 Standard Error 0.405 Observations Y i 0 1 X ti 2 where: 35 Regression Residual Total Intercept Period Period2 2 32 34 Coefficients 38.16442 -0.18272 0.00337 SS 16.7483 5.2472 21.9954 ti i data value for period i i time period 2 ANOVA df Y X X X 2 ti i the square of the ith period 2 Y 38164 . 0183 . 0 . 003 Xt Xt MS 8.3741 0.1640 F 51.07 Standard Error t Stat 0.21766 175.34 0.02788 -6.55 0.00075 4.49 Significance F 1.10021E-10 P-value 2.61E-49 2.21E-07 8.76E-05 Work Week Excel Graph of Hourly Data with Quadratic Trend Line 38.0 37.5 37.0 36.5 36.0 35.5 35.0 34.5 0 5 10 15 20 Period 25 30 35 Exponential Smoothing with Trend Effects: Holt’s Model Holt’s Model adds consideration of a trend component to the basic exponential smoothing relation. E X (1 )( E T Trend Term Update: T ( E E ) (1 ) T Forecast for Next Period: F E T for k periods in the future: F E k T Smoothed Values: t t t t t 1 t t k t t 1 t 1 t t ) t 1 t 1 Trend Autoregression Method A multiple regression technique in which the independent variables are time-lagged versions of the dependent variable. Autoregression Model with two lagged variables Y b0 b1Y t 1 b2 Y t 2 Autoregression Model with three lagged variables Y b0 b1Y t 1 b2 Y t 2 b3Y t 3 Durbin-Watson Test for Autocorrelation H 0: 0 Ha: 0 et et 1 n D 2 t 2 n e 2 t 1 t where: n = the number of observations If D > If D < If d L d d U , do not reject H0 (there is no significant autocorrelation). L , reject H0 (there is significant autocorrelation). D d U , the test is inconclusive. Overcoming the Autocorrelation Problem • Addition of Independent Variables • Transforming Variables – First-differences approach – Percentage change from period to period – Use autoregression Seasonal Forecasting Methods • Seasonal Multiple Regression Forecasting Method • Seasonal Autoregression Forecasting Method • Winter’s Exponential Smoothing Forecasting Model • Time Series Decomposition Forecasting Method Smoothed Values: Exponential Smoothing with Trend and Seasonality: Winter’s Model E ( X t / S t L (1 )( E t 1 T t 1) t Trend Term Update: T t ( E t E t 1) (1 ) T t 1 SeasonalityUpdate: S t ( X t / E t ) (1 ) S t L Forecast for Next Period: F t 1 ( E t T t ) S t L 1 for k periods in the future: F t k ( E t k T t ) S t L k Time Series Decomposition Forecasting Method Basis for analysis is the multiplicative model Y=T·C·S·I where: T = trend component C = cyclical component S = seasonal component I = irregular component Time Series Decomposition • Determine the seasonality of the time series by computing a seasonal index for each season (each quarter, each month, and so on. • Divide each time series data value by the appropriate seasonal index to deseasonalize it. • Identify a trend model appropriate for the deseasonalized trend model. • Forecast deseasonalized values with the trend model • Multiply the deseasonalized forecasts times the appropriate seasonal index to compute the final seasonalized forecasts. Demonstration Problem 14.6: Household Appliance Shipment Data Year Quarter Shipments 1 1 4009 2 4321 3 4224 4 3944 2 1 4123 2 4522 3 4657 4 4030 3 1 4493 2 4806 3 4551 4 4485 Year 4 5 Quarter Shipments 1 4595 2 4799 3 4417 4 4258 1 4245 2 4900 3 4585 4 4533 Shipments in $1,000,000. Demonstration Problem 14.6: Graph of Household Appliance Shipment Data Shipments 4950 4800 4650 4500 4350 4200 4050 3900 0 4 8 12 Quarter 16 20