Presentation is loading. Please wait.

Presentation is loading. Please wait.

Econ 240 C Lecture 14 1. 2 Part I: Exponential Smoothing Exponential smoothing is a technique that is useful for forecasting short time series where there.

Similar presentations


Presentation on theme: "Econ 240 C Lecture 14 1. 2 Part I: Exponential Smoothing Exponential smoothing is a technique that is useful for forecasting short time series where there."— Presentation transcript:

1 Econ 240 C Lecture 14 1

2 2 Part I: Exponential Smoothing Exponential smoothing is a technique that is useful for forecasting short time series where there may not be enough observations to estimate a Box-Jenkins model Exponential smoothing is a technique that is useful for forecasting short time series where there may not be enough observations to estimate a Box-Jenkins model Exponential smoothing can be understood from many perspectives; one perspective is a formula that could be calculated by hand Exponential smoothing can be understood from many perspectives; one perspective is a formula that could be calculated by hand

3 3 Simple exponential smoothing Simple exponential smoothing, also known as single exponential smoothing, is most appropriate for a time series that is a random walk with first order moving average error structure Simple exponential smoothing, also known as single exponential smoothing, is most appropriate for a time series that is a random walk with first order moving average error structure The levels term, L(t), is a weighted average of the observation lagged one, y(t-1) plus the previous levels, L(t-1): The levels term, L(t), is a weighted average of the observation lagged one, y(t-1) plus the previous levels, L(t-1): L(t) = a*y(t-1) + (1-a)*L(t-1) L(t) = a*y(t-1) + (1-a)*L(t-1)

4 4 Single exponential smoothing The parameter a is chosen to minimize the sum of squared errors where the error is the difference between the observation and the levels term: e(t) = y(t) – L(t) The parameter a is chosen to minimize the sum of squared errors where the error is the difference between the observation and the levels term: e(t) = y(t) – L(t) The forecast for period t+1 is given by the formula: L(t+1) = a*y(t) + (1-a)*L(t) The forecast for period t+1 is given by the formula: L(t+1) = a*y(t) + (1-a)*L(t) Example from John Heinke and Arthur Reitsch, Business Forecasting, 6 th Ed. Example from John Heinke and Arthur Reitsch, Business Forecasting, 6 th Ed.

5 5 observationsSales 1500 2350 3250 4400 5450 6350 7200 8300 9350 10200 11150 12400 13550 14350 15250 16550 17550 18400 19350 20600 21750 22500 23400 24650

6 6 Single exponential smoothing For observation #1, set L(1) = Sales(1) = 500, as an initial condition For observation #1, set L(1) = Sales(1) = 500, as an initial condition As a trial value use a = 0.1 As a trial value use a = 0.1 So L(2) = 0.1*Sales(1) + 0.9*Level(1) L(2) = 0.1*500 + 0.9*500 = 500 So L(2) = 0.1*Sales(1) + 0.9*Level(1) L(2) = 0.1*500 + 0.9*500 = 500 And L(3) = 0.1*Sales(2) + 0.9*Level(2) L(2) = 0.1*350 + 0.9*500 = 485 And L(3) = 0.1*Sales(2) + 0.9*Level(2) L(2) = 0.1*350 + 0.9*500 = 485

7 7 observationsSalesLevel 1500 2350 3250 4400 5450 6350 7200 8300 9350 10200 11150 12400 13550 14350 15250 16550 17550 18400 19350 20600 21750 22500 23400 24650

8 8 observationsSalesLevel 1500 2350500 3250485 4400 5450 6350 7200 8300 9350 10200 11150 12400 13550 14350 15250 16550 17550 18400 19350 20600 21750 22500 23400 24650 a = 0.1

9 9 Single exponential smoothing So the formula can be used to calculate the rest of the levels values, observation #4-#24 So the formula can be used to calculate the rest of the levels values, observation #4-#24 This can be set up on a spread-sheet This can be set up on a spread-sheet

10 10 observationsSalesLevel 1500 2350500 3250485 4400461.5 5450455.4 6350454.8 7200444.3 8300419.9 9350407.9 10200402.1 11150381.9 12400358.7 13550362.8 14350381.6 15250378.4 16550365.6 17550384.0 18400400.6 19350400.5 20600395.5 21750415.9 22500449.3 23400454.4 24650449.0 a = 0.1

11 11 Single exponential smoothing The forecast for observation #25 is: L(25) = 0.1*sales(24)+0.9*(24) The forecast for observation #25 is: L(25) = 0.1*sales(24)+0.9*(24) Forecast(25)=Levels(25)=0.1*650+0.9*449 Forecast(25)=Levels(25)=0.1*650+0.9*449 Forecast(25) = 469.1 Forecast(25) = 469.1

12

13 13 Single exponential distribution The errors can now be calculated: e(t) = sales(t) – levels(t) The errors can now be calculated: e(t) = sales(t) – levels(t)

14 14 observationsSalesLevelerror 1500 0 2350500-150 3250485-235 4400461.5-61.5 5450455.4-5.35 6350454.8-104.8 7200444.3-244.3 8300419.9-119.9 9350407.9-57.9 10200402.1-202.1 11150381.9-231.9 12400358.741.3 13550362.8187.2 14350381.6-31.6 15250378.4-128.4 16550365.6184.4 17550384.0166.0 18400400.6-0.6 19350400.5-50.5 20600395.5204.5 21750415.9334.1 22500449.350.7 23400454.4-54.4 24650449.0201.0 a = 0.1

15 15 observationsSalesLevelerror error squared 1500 00 2350500-15022500 3250485-23555225 4400461.5-61.53782.25 5450455.4-5.3528.62 6350454.8-104.810986.18 7200444.3-244.359698.86 8300419.9-119.914376.05 9350407.9-57.93353.58 10200402.1-202.140852.14 11150381.9-231.953780.95 12400358.741.31704.33 13550362.8187.235027.05 14350381.6-31.6996.06 15250378.4-128.416487.67 16550365.6184.434016.68 17550384.0166.027553.51 18400400.6-0.60.37 19350400.5-50.52554.91 20600395.5204.541823.74 21750415.9334.1111594.53 22500449.350.72565.62 23400454.4-54.42960.80 24650449.0201.040412.28 a = 0.1

16 16 observationsSalesLevelerror error squared 1500 00 2350500-15022500 3250485-23555225 4400461.5-61.53782.25 5450455.4-5.3528.62 6350454.8-104.810986.18 7200444.3-244.359698.86 8300419.9-119.914376.05 9350407.9-57.93353.58 10200402.1-202.140852.14 11150381.9-231.953780.95 12400358.741.31704.33 13550362.8187.235027.05 14350381.6-31.6996.06 15250378.4-128.416487.67 16550365.6184.434016.68 17550384.0166.027553.51 18400400.6-0.60.37 19350400.5-50.52554.91 20600395.5204.541823.74 21750415.9334.1111594.53 22500449.350.72565.62 23400454.4-54.42960.80 24650449.0201.040412.28 sum sq res582281.2 a = 0.1

17 17 Single exponential smoothing For a = 0.1, the sum of squared errors is:  errors) 2 = 582,281.2 For a = 0.1, the sum of squared errors is:  errors) 2 = 582,281.2 A grid search can be conducted for the parameter value a, to find the value between 0 and 1 that minimizes the sum of squared errors A grid search can be conducted for the parameter value a, to find the value between 0 and 1 that minimizes the sum of squared errors The calculations of levels, L(t), and errors, e(t) = sales(t) – L(t) for a =0.6 The calculations of levels, L(t), and errors, e(t) = sales(t) – L(t) for a =0.6

18 18 observa tionsSalesLevels 1500 2350500 3250410 4400314 5450365.6 6350416.2 7200376.5 8300270.6 9350288.2 10200325.3 11150250.1 12400190.0 13550316.0 14350456.4 15250392.6 16550307.0 17550452.8 18400511.1 19350444.4 20600387.8 21750515.1 22500656.0 23400562.4 24650465.0 a = 0.6

19 19 Single exponential smoothing Forecast(25) = Levels(25) = 0.6*sales(24) + 0.4*levels(24) = 0.6*650 + 0.4*465 = 776 Forecast(25) = Levels(25) = 0.6*sales(24) + 0.4*levels(24) = 0.6*650 + 0.4*465 = 776

20 20 observa tionsSalesLevelserror error square 1500 00 2350500-15022500 3250410-16025600 4400314867396 5450365.684.47123.36 6350416.2-66.24387.74 7200376.5-176.531150.84 8300270.629.4864.45 9350288.261.83814.38 10200325.3-125.315699.02 11150250.1-100.110023.67 12400190.0210.044080.13 13550316.0234.054747.14 14350456.4-106.411322.57 15250392.6-142.620324.22 16550307.0243.059036.75 17550452.897.29445.88 18400511.1-111.112348.55 19350444.4-94.48920.73 20600387.8212.245037.39 21750515.1234.955172.40 22500656.0-156.024349.97 23400562.4-162.426379.58 24650465.0185.034237.15 Sum of Sq Res533961.9 a = 0.6

21 21 Single exponential smoothing Grid search plot Grid search plot

22

23 23 Single Exponential Smoothing EVIEWS: Algorithmic search for the smoothing parameter a EVIEWS: Algorithmic search for the smoothing parameter a In EVIEWS, select time series sales(t), and open In EVIEWS, select time series sales(t), and open In the sales window, go to the PROCS menu and select exponential smoothing In the sales window, go to the PROCS menu and select exponential smoothing Select single Select single the best parameter a = 0.26 with sum of squared errors = 472982.1 and root mean square error = 140.4 = (472982.1/24) 1/2 the best parameter a = 0.26 with sum of squared errors = 472982.1 and root mean square error = 140.4 = (472982.1/24) 1/2 The forecast, or end of period levels mean = 532.4 The forecast, or end of period levels mean = 532.4

24 24

25 25

26 26 Forecast = L(25) = 0.26*Sales(24) + 0.74L(24) = 532.4

27 27

28 28 Part II. Three Perspectives on Single Exponential Smoothing The formula perspective The formula perspective L(t) = a*y(t-1) + (1 - a)*L(t-1) L(t) = a*y(t-1) + (1 - a)*L(t-1) e(t) = y(t) - L(t) e(t) = y(t) - L(t) The Box-Jenkins Perspective The Box-Jenkins Perspective The Updating Forecasts Perspective The Updating Forecasts Perspective

29 29 Box Jenkins Perspective Use the error equation to substitute for L(t) in the formula, L(t) = a*y(t-1) + (1 - a)*L(t-1) Use the error equation to substitute for L(t) in the formula, L(t) = a*y(t-1) + (1 - a)*L(t-1) L(t) = y(t) - e(t) L(t) = y(t) - e(t) y(t) - e(t) = a*y(t-1) + (1 - a)*[y(t-1) - e(t-1)] y(t) = e(t) -y(t-1) - (1-a)*e(t-1) y(t) - e(t) = a*y(t-1) + (1 - a)*[y(t-1) - e(t-1)] y(t) = e(t) -y(t-1) - (1-a)*e(t-1) or  y(t) = y(t) - y(t-1) = e(t) - (1-a) e(t-1) or  y(t) = y(t) - y(t-1) = e(t) - (1-a) e(t-1) So y(t) is a random walk plus MAONE noise, i.e y(t) is a (0,1,1) process where (p,d,q) are the orders of AR, differencing, and MA. So y(t) is a random walk plus MAONE noise, i.e y(t) is a (0,1,1) process where (p,d,q) are the orders of AR, differencing, and MA.

30 30 Box-Jenkins Perspective In Lab Eight, we will apply simple exponential smoothing to retail sales, a process you used for forecasting trend in Lab 3, and which can be modeled as (0,1,1). In Lab Eight, we will apply simple exponential smoothing to retail sales, a process you used for forecasting trend in Lab 3, and which can be modeled as (0,1,1).

31 31 Box-Jenkins Perspective If the smoothing parameter approaches one, then y(t) is a random walk: If the smoothing parameter approaches one, then y(t) is a random walk:  y(t) = y(t) - y(t-1) = e(t) - (1-a) e(t-1)  y(t) = y(t) - y(t-1) = e(t) - (1-a) e(t-1) if a = 1, then  y(t) = y(t) - y(t-1) = e(t) if a = 1, then  y(t) = y(t) - y(t-1) = e(t) In Lab Eight, we will use the price of gold, which we used in Lab 4, to make this point In Lab Eight, we will use the price of gold, which we used in Lab 4, to make this point

32 32 Box-Jenkins Perspective The levels or forecast, L(t), is a geometric distributed lag of past observations of the series, y(t), hence the name “exponential” smoothing The levels or forecast, L(t), is a geometric distributed lag of past observations of the series, y(t), hence the name “exponential” smoothing L(t) = a*y(t-1) + (1 - a)*L(t-1) L(t) = a*y(t-1) + (1 - a)*L(t-1) L(t) = a*y(t-1) + (1 - a)*ZL(t) L(t) = a*y(t-1) + (1 - a)*ZL(t) L(t) - (1 - a)*ZL(t) = a*y(t-1) L(t) - (1 - a)*ZL(t) = a*y(t-1) [1 - (1-a)Z] L(t) = a*y(t-1) [1 - (1-a)Z] L(t) = a*y(t-1) L(t) = {1/ [1 - (1-a)Z]} a*y(t-1) L(t) = {1/ [1 - (1-a)Z]} a*y(t-1) L(t) = [1 +(1-a)Z + (1-a) 2 Z 2 + …] a*y(t-1) L(t) = [1 +(1-a)Z + (1-a) 2 Z 2 + …] a*y(t-1) L(t) = a*y(t-1) + (1-a)*a*y(t-2) + (1-a) 2 a*y(t-3) + …. L(t) = a*y(t-1) + (1-a)*a*y(t-2) + (1-a) 2 a*y(t-3) + ….

33 33 The Updating Forecasts Perspective Use the error equation to substitute for y(t) in the formula, L(t) = a*y(t-1) + (1 - a)*L(t-1) Use the error equation to substitute for y(t) in the formula, L(t) = a*y(t-1) + (1 - a)*L(t-1) y(t) = L(t) + e(t) y(t) = L(t) + e(t) L(t) = a*[L(t-1) + e(t-1)] + (1 - a)*L(t-1) L(t) = a*[L(t-1) + e(t-1)] + (1 - a)*L(t-1) So L(t) = L(t-1) + a*e(t-1), So L(t) = L(t-1) + a*e(t-1), i.e. the forecast for period t is equal to the forecast for period t-1 plus a fraction a of the forecast error from period t-1. i.e. the forecast for period t is equal to the forecast for period t-1 plus a fraction a of the forecast error from period t-1.

34 34 Part III. Double Exponential Smoothing With double exponential smoothing, one estimates a “trend” term, R(t), as well as a levels term, L(t), so it is possible to forecast, f(t), out more than one period With double exponential smoothing, one estimates a “trend” term, R(t), as well as a levels term, L(t), so it is possible to forecast, f(t), out more than one period f(t+k) = L(t) + k*R(t), k>=1 f(t+k) = L(t) + k*R(t), k>=1 L(t) = a*y(t) + (1-a)*[L(t-1) + R(t-1)] L(t) = a*y(t) + (1-a)*[L(t-1) + R(t-1)] R(t) = b*[L(t) - L(t-1)] + (1-b)*R(t-1) R(t) = b*[L(t) - L(t-1)] + (1-b)*R(t-1) so the trend, R(t), is a geometric distributed lag of the change in levels,  L(t) so the trend, R(t), is a geometric distributed lag of the change in levels,  L(t)

35 35 If the smoothing parameters a = b, then we have double exponential smoothing If the smoothing parameters a = b, then we have double exponential smoothing If the smoothing parameters are different, then it is the simplest version of Holt- Winters smoothing If the smoothing parameters are different, then it is the simplest version of Holt- Winters smoothing Part III. Double Exponential Smoothing

36 36 Part III. Double Exponential Smoothing Holt- Winters can also be used to forecast seasonal time series, e.g. monthly Holt- Winters can also be used to forecast seasonal time series, e.g. monthly f(t+k) = L(t) + k*R(t) + S(t+k-12) k>=1 f(t+k) = L(t) + k*R(t) + S(t+k-12) k>=1 L(t) = a*[y(t)-S(t-12)]+ (1-a)*[L(t-1) + R(t-1)] L(t) = a*[y(t)-S(t-12)]+ (1-a)*[L(t-1) + R(t-1)] R(t) = b*[L(t) - L(t-1)] + (1-b)*R(t-1) R(t) = b*[L(t) - L(t-1)] + (1-b)*R(t-1) S(t) = c*[y(t) - L(t)] + (1-c)*S(t-12) S(t) = c*[y(t) - L(t)] + (1-c)*S(t-12)

37 37 Part IV. Dickey Fuller Tests: Trend

38 38 Stochastic Trends: Random Walks with Drift We have discussed earlier in the course how to model the Total Return to the Standard and Poor’s 500 Index We have discussed earlier in the course how to model the Total Return to the Standard and Poor’s 500 Index One possibility is this time series could be a random walk around a deterministic trend” One possibility is this time series could be a random walk around a deterministic trend” Sp500(t) = exp{a + d*t +WN(t)/[1-Z]} Sp500(t) = exp{a + d*t +WN(t)/[1-Z]} And taking logarithms, And taking logarithms,

39 39 Stochastic Trends: Random Walks with Drift Lnsp500(t) = a + d*t + WN(t)/[1-Z] Lnsp500(t) = a + d*t + WN(t)/[1-Z] Lnsp500(t) –a –d*t = WN(t)/[1-Z] Lnsp500(t) –a –d*t = WN(t)/[1-Z] Multiplying through by the difference operator,  = [1-Z] Multiplying through by the difference operator,  = [1-Z] [1-Z][Lnsp500(t) –a –d*t] = WN(t-1) [1-Z][Lnsp500(t) –a –d*t] = WN(t-1) [LnSp500(t) – a –d*t] - [LnSp500(t-1) – a –d*(t- 1)] = WN(t) [LnSp500(t) – a –d*t] - [LnSp500(t-1) – a –d*(t- 1)] = WN(t)  Lnsp500(t) = d + WN(t)  Lnsp500(t) = d + WN(t)

40 40 So the fractional change in the total return to the S&P 500 is drift, d, plus white noise So the fractional change in the total return to the S&P 500 is drift, d, plus white noise More generally, More generally, y(t) = a + d*t + {1/[1-Z]}*WN(t) y(t) = a + d*t + {1/[1-Z]}*WN(t) [y(t) –a –d*t] = {1/[1-Z]}*WN(t) [y(t) –a –d*t] = {1/[1-Z]}*WN(t) [y(t) –a –d*t]- [y(t-1) –a –d*(t-1)] = WN(t) [y(t) –a –d*t]- [y(t-1) –a –d*(t-1)] = WN(t) [y(t) –a –d*t]= [y(t-1) –a –d*(t-1)] + WN(t) [y(t) –a –d*t]= [y(t-1) –a –d*(t-1)] + WN(t) Versus the possibility of an ARONE: Versus the possibility of an ARONE:

41 41 [y(t) –a –d*t]=b*[y(t-1)–a–d*(t-1)]+WN(t) [y(t) –a –d*t]=b*[y(t-1)–a–d*(t-1)]+WN(t) Or y(t) = [a*(1-b)+b*d]+[d*(1-b)]*t+b*y(t-1) +wn(t) Or y(t) = [a*(1-b)+b*d]+[d*(1-b)]*t+b*y(t-1) +wn(t) Subtracting y(t-1) from both sides’ Subtracting y(t-1) from both sides’  y(t) = [a*(1-b)+b*d] + [d*(1-b)]*t + (b-1)*y(t-1) +wn(t)  y(t) = [a*(1-b)+b*d] + [d*(1-b)]*t + (b-1)*y(t-1) +wn(t) So the coefficient on y(t-1) is once again interpreted as b-1, and we can test the null that this is zero against the alternative it is significantly negative. Note that we specify the equation with both a constant, So the coefficient on y(t-1) is once again interpreted as b-1, and we can test the null that this is zero against the alternative it is significantly negative. Note that we specify the equation with both a constant, [a*(1-b)+b*d] and a trend [d*(1-b)]*t [a*(1-b)+b*d] and a trend [d*(1-b)]*t

42 42 Example Lnsp500(t) from Lab 2 Lnsp500(t) from Lab 2

43 43

44 44

45 45

46 46

47 47 Part V. Intervention Analysis

48 48 Intervention Analysis The approach to intervention analysis parallels Box-Jenkins in that the actual estimation is conducted after pre- whitening, to the extent that non- stationarity such as trend and seasonality are removed The approach to intervention analysis parallels Box-Jenkins in that the actual estimation is conducted after pre- whitening, to the extent that non- stationarity such as trend and seasonality are removed Example: preview of Lab 8 Example: preview of Lab 8

49 49 Telephone Directory Assistance A telephone company was receiving increased demand for free directory assistance, i.e. subscribers asking operators to look up numbers. This was increasing costs and the company changed policy, providing a number of free assisted calls to subscribers per month, but charging a price per call after that number. A telephone company was receiving increased demand for free directory assistance, i.e. subscribers asking operators to look up numbers. This was increasing costs and the company changed policy, providing a number of free assisted calls to subscribers per month, but charging a price per call after that number.

50 50 Telephone Directory Assistance This policy change occurred at a known time, March 1974 This policy change occurred at a known time, March 1974 The time series is for calls with directory assistance per month The time series is for calls with directory assistance per month Did the policy change make a difference? Did the policy change make a difference?

51 51

52 52 The simple-minded approach

53 53

54 54

55 55

56 56 Principle The event may cause a change, and affect time series characteristics The event may cause a change, and affect time series characteristics Consequently, condider the pre-event period, January 1962 through February 1974, the event March 1974, and the post-event period, April 1974 through December 1976 Consequently, condider the pre-event period, January 1962 through February 1974, the event March 1974, and the post-event period, April 1974 through December 1976 First difference and then seasonally difference the entire series First difference and then seasonally difference the entire series

57 57 Analysis: Entire Differenced Series

58 58

59 59

60 60

61 61

62 62 Analysis: Pre-Event Differences

63 63

64 64

65 65

66 66 So Seasonal Nonstationarity It was masked in the entire sample by the variance caused by the difference from the event It was masked in the entire sample by the variance caused by the difference from the event The seasonality was revealed in the pre- event differenced series The seasonality was revealed in the pre- event differenced series

67 67

68 68 Pre-Event Analysis Seasonally differenced, differenced series Seasonally differenced, differenced series

69 69

70 70

71 71

72 72

73 73 Pre-Event Box-Jenkins Model [1-Z 12 ][1 –Z]Assist(t) = WN(t) – a*WN(t-12) [1-Z 12 ][1 –Z]Assist(t) = WN(t) – a*WN(t-12)

74 74

75 75

76 76

77 77 Modeling the Event Step function Step function

78 78 Entire Series Assist and Step Assist and Step Dassist and Dstep Dassist and Dstep Sddast sddstep Sddast sddstep

79 79

80 80

81 81

82 82 Model of Series and Event Pre-Event Model: [1-Z 12 ][1 –Z]Assist(t) = WN(t) – a*WN(t-12) Pre-Event Model: [1-Z 12 ][1 –Z]Assist(t) = WN(t) – a*WN(t-12) In Levels Plus Event: Assist(t)=[WN(t) – a*WN(t-12)]/[1-Z]*[1-Z 12 ] + (-b)*step In Levels Plus Event: Assist(t)=[WN(t) – a*WN(t-12)]/[1-Z]*[1-Z 12 ] + (-b)*step Estimate: [1-Z 12 ][1 –Z]Assist(t) = WN(t) – a*WN(t-12) + (-b)* [1-Z 12 ][1 –Z]*step Estimate: [1-Z 12 ][1 –Z]Assist(t) = WN(t) – a*WN(t-12) + (-b)* [1-Z 12 ][1 –Z]*step

83 83

84 84

85 85 Policy Change Effect Simple: decrease of 387 (thousand) calls per month Simple: decrease of 387 (thousand) calls per month Intervention model: decrease of 397 with a standard error of 22 Intervention model: decrease of 397 with a standard error of 22

86 86


Download ppt "Econ 240 C Lecture 14 1. 2 Part I: Exponential Smoothing Exponential smoothing is a technique that is useful for forecasting short time series where there."

Similar presentations


Ads by Google