Assignment week 38 Exponential smoothing of monthly observations of the General Index of the Stockholm Stock Exchange. A. Graphical illustration of data First, construct a graph of the original series of monthly values. Stock_Exchange.txt Time Series Plot of Index 4000 Index 3000 2000 1000 0 1 61 122 183 244 305 Index 366 427 488 549 610 Then construct a graph of the percentage change from month to month. Time Series Plot of Change 30 20 Change 10 0 -10 -20 1 61 122 183 244 305 Index 366 427 488 549 610 Which smoothing techniques (single, double, Holt-Winters) can be used on the original series, which can be used on the series of percentage change. Original series: Series of percentage change: Double (Holt’s) (or Holt-Winters’ (Winters’) method) Single (or Winters’ without trend) B. Exponential smoothing with predefined smoothing parameters Perform single exponential smoothing on the time series of percentage change (of the General Indices). Set the smoothing parameter, , first to 0.9 and then to 0.1. Variable Change is not in the list, due to the initial missing value Copy the nonmissing values to a new column. Smoothing Plot for Change_1949_2 Single Exponential Method 30 Variable Actual Fits Change_1949_2 20 Smoothing Constant Alpha 0.1 Accuracy Measures MAPE 160.999 MAD 3.514 MSD 23.053 10 0 -10 -20 1 61 122 183 244 305 366 Index 427 488 549 Smoothing Plot for Change_1949_2 Single Exponential Method 30 Variable Actual Fits Change_1949_2 20 Smoothing Constant Alpha 0.9 Accuracy Measures MAPE 240.685 MAD 4.382 MSD 35.101 10 0 -10 -20 1 61 122 183 244 305 366 Index 427 488 549 Then study the graphs produced and try to understand how the choice of the smoothing parameter affects the forecasted values. = 0.1 gives very damped predicted values (red curve) wile = 0.9 gives predicted values highly responding to the recent changes in original series. C. Exponential smoothing with automatic parameter setting Let the program choose an optimal value of the smoothing parameter and calculate forecasts for a two-year period (24 months) after the last observed time-point. Construct a graph for the errors in the one-step-ahead forecasts (residuals) in the whole time series and try to judge upon whether the forecasting methods uses earlier observations in the series in an efficient way. Smoothing Plot for Change_1949_2 Single Exponential Method 30 Variable Actual Fits Forecasts 95.0% PI Change_1949_2 20 Are the earlier observations used in an efficient way? Smoothing Constant Alpha 0.0113270 10 Accuracy Measures MAPE 141.322 MAD 3.464 MSD 22.392 0 -10 -20 1 63 126 189 252 315 378 Index 441 504 567 630 Versus Order (response is Change_1949_2) 30 10 Residual Are the residuals serially correlated – Make a visual judgement. 20 0 -10 -20 -30 1 50 100 150 200 250 300 350 400 Observation Order 450 500 550 600 Use also the autocorrelation function on the residual. (MINITAB-Time SeriesAutocorrelation). Autocorrelation Function for RESI1 (with 5% significance limits for the autocorrelations) 1.0 0.8 Autocorrelation 0.6 0.4 0.2 0.0 -0.2 -0.4 -0.6 -0.8 -1.0 1 5 10 15 20 25 30 35 Lag 40 45 50 55 60 65 What do you see in the plot you get? First spike is significantly different from zero, so is also some spikes for larger lags. Residuals seem to be serially correlated. Exponential smoothing of time series with seasonal variation A. Forecasting the employment in USA Perform an exponential smoothing of the time series of monthly employments figures in USA and calculate forecasts for a two-year period (24 month) after the last observed time-point. Labourforce.txt Time Series Plot of Value 68 66 Value 64 62 60 58 56 1 60 120 180 240 300 Index 360 420 480 540 Time series possesses trend and seasonal variation Use Winters’ method Seasonal variation do not seem to change with level Use additive case 600 Winters' Method Plot for Value Additive Method 70 Variable Actual Fits Forecasts 95.0% PI 68 Value 66 Smoothing C onstants A lpha (lev el) 0.2 Gamma (trend) 0.2 Delta (seasonal) 0.2 64 62 Accuracy MA PE MA D MSD 60 Measures 0.370202 0.226105 0.086981 58 56 1 62 124 186 248 310 372 Index 434 496 558 620 Then use a suitable model for time series decomposition to make forecasts for the same period (additive or multiplicative). Time Series Decomposition Plot for Value Additive Model 70.0 Variable Actual Fits Trend Forecasts 67.5 Value 65.0 A ccuracy MAPE MAD MSD 62.5 60.0 57.5 55.0 1 62 124 186 248 310 372 Index 434 496 558 620 Measures 1.41981 0.86505 1.05524 Print out graphs for observed and forecasted values and compare how the seasonal effects are described in each method of forecasting. Which method do you prefer in this case? Observed (and forecasts): Winters' Method Plot for Value Time Series Decomposition Plot for Value Additive Method Additive Model 70 Variable Actual Fits Forecasts 95.0% PI 66 Smoothing C onstants A lpha (lev el) 0.2 Gamma (trend) 0.2 Delta (seasonal) 0.2 64 62 Accuracy MA PE MA D MSD 60 Measures 0.370202 0.226105 0.086981 Variable Actual Fits Trend Forecasts 67.5 65.0 Value 68 Value 70.0 A ccuracy MAPE MAD MSD 62.5 60.0 57.5 58 56 55.0 1 62 124 186 248 310 372 Index 434 496 558 620 1 62 124 186 248 310 372 Index 434 496 558 620 Measures 1.41981 0.86505 1.05524 Forecasts only: From Winters’ method From Decomposition Make a time series plot with both series of forecasts in the same plot Time Series Plot of FORE1, FORE2 68.5 Variable FORE1 FORE2 68.0 Data 67.5 67.0 66.5 66.0 2 4 6 8 10 12 14 Index 16 18 20 22 24 B. Forecasting of monthly mean temperature temperature.txt (title “Stockholm” removed) Time Series Plot of Temperature 25 20 Temperature 15 10 5 0 -5 -10 1 43 86 129 172 215 Index 258 301 344 387 430 Use exponential smoothing to make forecasts of monthly mean temperatures in Stockholm. Try single, double (Holt’s method) and Winters’ method. Study the residuals (the errors in one-step-ahead forecasts) and the forecasts for 24 months after the last observed time-point. Are the one-month-ahead and one-yearahead forecasts realistic? Single exponential smoothing: Smoothing Plot for Temperature Single Exponential Method Versus Order 10 Smoothing Constant A lpha 1.39083 0 Accuracy Measures MAPE 144.034 MAD 3.198 MSD 15.636 10 5 Residual 20 Temperature (response is Temperature) Variable Actual Fits Forecasts 95.0% PI 0 -5 -10 1 -10 -20 1 46 92 138 184 230 276 Index 322 368 414 50 100 150 200 250 Observation Order 300 350 400 Double exponential smoothing (Holt’s method): Smoothing Plot for Temperature Double Exponential Method Variable Actual Fits Forecasts 95.0% PI 0 Temperature -50 Smoothing Constants A lpha (lev el) 0.76251 Gamma (trend) 1.26707 -100 -150 A ccuracy Measures MAPE 146.299 MAD 3.211 MSD 16.528 -200 -250 -300 Versus Order -350 1 46 92 (response is Temperature) 138 184 230 276 322 368 414 Index 20 15 Neither single, nor double exponential smoothing seems to work. Residual 10 5 0 -5 Surprising? -10 1 50 100 150 200 250 Observation Order 300 350 400 Winters’ method: Note that we do not have any particularly pronounced trend in data and shifts in level are (if existing) very modest. Time Series Plot of Temperature 25 20 Temperature 15 10 5 0 -5 -10 1 43 86 129 172 215 Index 258 301 344 387 Try low values of smoothing parameters for level and trend 430 Winters' Method Plot for Temperature Additive Method 20 Variable Actual Fits Forecasts 95.0% PI 10 Smoothing C onstants Alpha (lev el) 0.05 Gamma (trend) 0.01 Delta (seasonal) 0.20 Forecasts much better here Accuracy Measures MA PE 108.557 MA D 2.490 MSD 10.021 0 -10 1 46 92 138 184 230 276 322 Index 368 414 Versus Order (response is Temperature) Residuals become positively correlated 5 Residual Temperature 30 0 -5 -10 1 50 100 150 200 250 Observation Order 300 350 400 Compare with an analysis with default values on smoothing parameters: Winters' Method Plot for Temperature Additive Method 20 Variable Actual Fits Forecasts 95.0% PI 10 Smoothing C onstants A lpha (lev el) 0.2 Gamma (trend) 0.2 Delta (seasonal) 0.2 Accuracy Measures MA PE 95.4625 MA D 1.8182 MSD 5.2691 0 -10 1 46 92 138 184 230 276 Index 322 368 Residuals are much better. 414 Forecasts seem to contain an “artificially” induced trend. Versus Order (response is Temperature) 10 We have to keep on trying. 5 Residual Temperature 30 0 -5 -10 1 50 100 150 200 250 Observation Order 300 350 400 Is there a better way for making forecasts than applying exponential smoothing on the original series?