28
Ch 4. – Exponential Smoothing – Computing in JMP Example 1: Dow Jones Index (pgs. 176 – 187) To begin we select Modeling > Time Series which will produce a plot of the time series and compute ACF and PACF (discussed later) for the time series. Notice the note that appears to the right of the Modeling drop-down menu. We can see that in addition to the ACF plots, there are options to fit models to the time series and make forecasts from them. Smoothing models are the exponential smoothing models we are examining in Chapter 4. The dialog box to begin modeling the Dow Jones Index is shown below. 1

Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Ch 4. – Exponential Smoothing – Computing in JMP

Example 1: Dow Jones Index (pgs. 176 – 187)

To begin we select Modeling > Time Series which will produce a plot of the time series and compute ACF and PACF (discussed later) for the time series. Notice the note that appears to the right of the Modeling drop-down menu. We can see that in addition to the ACF plots, there are options to fit models to the time series and make forecasts from them. Smoothing models are the exponential smoothing models we are examining in Chapter 4.

The dialog box to begin modeling the Dow Jones Index is shown below.

Notice the time series data must be evenly spaced, i.e. daily, weekly, quarterly, or annually in general.

Below is the default output from the Time Series modeling option.

1

Page 2: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

To fit exponential smoother models we select the model we wish to fit using the Smoothing Model pull-out menu as shown below.

2

Page 3: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Simple exponential smoothing – is appropriate when there is no trend or seasonal pattern in the data, but the mean (or level) of the time series y t is changing slowly over time.

Double exponential smoothing – is appropriate where there is evidence of some linear trends in the data. Simple exponential smoothing will tend to over or under estimate the time series when there are some linear trends in the time series. Simple exponential smoothing with a large λ will decrease the over or under estimate problem, but a double exponential smooth will generally handle it better.

Linear exponential smoothing – is appropriate when both the mean (or level) and the growth rate (slope of linear trends) are changing over time. This is also referred to as Holt’s Trend Corrected exponential smoothing. In situations where a double exponential smooth is appropriate, this method would be appropriate as well.

Seasonal exponential smoothing – is appropriate when there is a seasonal pattern in the time series, but not much in terms of long-term linear trend. In other words, the level is not changing a great deal but there strong seasonal patterns on top of a fairly constant mean (or level).

Winter’s Method – is appropriate when there is a seasonal pattern on top of a long-term trend.

For the Dow Jones Index time series we see there is no evidence of a seasonal effect, but the trend does have some linear trends in, e.g. between

3

Page 4: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

February 2003 and February 2004. We first fit a simple exponential smooth to this time series.

4

Above and to the left are the results of a simple exponential smooth fit to the DJI time series. We can see the optimal λ chosen automatically by JMP is λ=.842, which is quite large. The R2=78.63% which is quite good. The mean absolute percent error (MAPE) = 3.24% and the mean absolute error/deviation (MAD) = 319.94.

The forecasts for the next 25 time periods are shown graphically and as you can see are constant. This is because for a simple exponential smooth the forecasts for the next time periods, regardless of how far into the future we look, is ~yT the last smoothed value from the exponential smooth of the data. The prediction interval gets wider the further out we look as shown by the formula in your notes.

Page 5: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

The residuals plotted versus time are shown above and the ACF plot of the residuals is shown below. The residuals are consistent with white noise as there are no significant autocorrelations at lags > 1.

5

Page 6: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

You can save the actual forecasts as the prediction intervals to the spreadsheet by selecting the Save Prediction Formula from the Model: Simple Exponential Smoothing (Zero to One) drop-down menu.

The columns above are:

Actual DJI – original time series (y t ¿

DJI Prediction Formula – the smoothed or fitted values (~y t ¿

Time – duh?

6

Page 7: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Predicted DJI – the same as DJI Prediction Formula

Std Error Pred DJI - s in the formulae in class unless it is a future forecast in which case is equal to s√1+(τ−1) λ2 for τ ≥1.

Residual DJI – are the one-step ahead forecast errors for the original time series. These are used to compute SSE etc. which are minimized to find an optimal λ.

Upper (.95) DJI – upper limit of the prediction interval.

Lower (.95) DJI – lower limit of the prediction interval.

These columns will be the same for all forecast smoothers, how the predicted values and the standard errors for prediction are computed of course will change with the smoothing model used.

We now consider a double exponential smooth model fit to this times series. You DO NOT need to start from scratch, you can actually just select that option from the same menu we used to fit the simple exponential smooth.

This will fit the double exponential smooth and show the summary statistics for the fit right next to those from the simple exponential smooth as shown below.

7

Page 8: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

We can see the double exponential smooth has a smaller R2, thus there appears to be no advantage to this approach over the simple exponential smooth.

8

We see the predictions or forecasts made from a double exponential smooth have a linear trend. The prediction intervals get large fast.

Page 9: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Linear Exponential Smoothing (a.k.a. Holt’s Trend Corrected)

Example: Weekly Thermostat Sales (Thermostat.JMP)

As we can see this time series as a long term increasing trend, and the growth rate appears to fluctuate with time, thus a linear exponential smooth or possibly a double exponential seems appropriate. Fitting both a double exponential and linear trend exponential smooth to this time series produces very similar results. (R2=.557)

9

Page 10: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

The estimated smoothing parameters for double exponential and linear smooths are shown below. There is one optimal parameter for the double exponential smooth (simple exponential smoothing with = .161 twice) and two optimal parameters for the linear trend smooth ( and

10

Page 11: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

The prediction intervals for future forecasts for the next 25 weeks of thermostat sales are very similar, though it appears the linear trend

11

Page 12: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

exponential is a bit narrower.

The predictions for the linear exponential smooth are shown below.

12

Page 13: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

13

Page 14: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Holt-Winters Method

Holt-Winter’s Method of exponential smoothing is for time series with both a long-term trend and a seasonal trend on top of it.

Example: Monthly Liquor Sales (1980-2000) – (U.S. Monthly Liquor Sales.JMP)

The time series and ACF & PACF (soon to be discussed) are shown above. The time series clearly exhibits a long-term trend with a strong seasonal trend on top. The seasonal variation however seems get larger over time! This may present a problem!

14

Page 15: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Fitting a Holt-Winter’s exponential smooth this time series yields the results shown below.

The R2 = 98.8% indicating a very good fit to the time series. The trend weight is essentially 0, suggesting the linear trend part of the smooth is not strong and level smooth essentially takes care of the long-term trend.

The residuals exhibit a non-constant variation.

15

Page 16: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

There is a multiplicative form of the Holt-Winter’s Method which will model the non-constant nature of the seasonal variation, however it is not implemented in JMP. One way to handle the non-constant seasonal variation is to take the natural log (or any other base) of the liquor sales before smoothing. The log base 10 of the liquor sales (i.e. log10(Liquor Sales)) is shown below. Note: I just called the logged time series ln(LS).

The residuals now appear to have constant variation.

16

Page 17: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

The forecasts of liquor sales in the log scale for next 25-months are shown below.

17

To back-transform the predictions to the original scale we need exponentiate the results, i.e.

Original scale=10prediction

Page 18: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

The prediction intervals for liquor sales in the next 25 months are shown above. The highlighted columns were obtained by using the JMP calculator to back-transform the Upper CL and Lower CL in the two preceding columns.

The Lower PI and Upper PI formulae in the JMP calculator are shown below.

After back-transforming we have what should prove to be very good forecasts for the liquor sales for the next 25 months; assuming the current trends continue.

18

Page 19: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

In the forecast library from CRAN there are a number of exponential smoothers that can be used to fit an exponential smooth model and make forecasts.

> Sales.ts = ts(Sales,start=1980,frequency=12)> tsdisplay(Sales.ts)

Additive Holt-Winter’s Fit> liquor.hw = hw(Sales.ts,seasonal="additive")> summary(liquor.hw)

Forecast method: Holt-Winters' additive method

Model Information:ETS(A,A,A)

Call: hw(x = Sales.ts, seasonal = "additive")

Smoothing parameters: alpha = 0.3335 beta = 1e-04 gamma = 0.4983

Initial states: l = 636.7332 b = 3.4108 s=513.0279 12.4489 -29.1804 -53.4223 24.0255 61.7841

19

Page 20: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

1.913 -6.7716 -88.659 -96.9889 -198.7712 -139.406

sigma: 54.367

AIC AICc BIC 4671.698 4673.403 4732.772

Training set error measures: ME RMSE MAE MPE MAPE MASE -0.02626900 54.36696148 38.55693750 -0.05075231 3.30142685 0.26527642

Forecasts: Point Forecast Lo 80 Hi 80 Lo 95 Hi 95Jan 2008 1551.706 1482.032 1621.380 1445.149 1658.264Feb 2008 1513.810 1440.358 1587.262 1401.475 1626.145Mar 2008 1689.579 1612.532 1766.625 1571.746 1807.411Apr 2008 1721.138 1640.655 1801.621 1598.050 1844.226May 2008 1805.449 1721.669 1889.229 1677.318 1933.580Jun 2008 1817.071 1730.117 1904.026 1684.085 1950.057Jul 2008 1943.510 1853.491 2033.530 1805.838 2081.183Aug 2008 1832.384 1739.400 1925.369 1690.177 1974.592Sep 2008 1770.948 1675.089 1866.807 1624.344 1917.552Oct 2008 1782.941 1684.288 1881.593 1632.065 1933.816Nov 2008 1817.635 1716.265 1919.005 1662.603 1972.667Dec 2008 2467.998 2351.188 2584.807 2289.353 2646.642Jan 2009 1592.625 1473.509 1711.742 1410.452 1774.798Feb 2009 1554.729 1433.348 1676.110 1369.093 1740.365Mar 2009 1730.498 1606.893 1854.103 1541.460 1919.535Apr 2009 1762.057 1636.266 1887.848 1569.676 1954.438May 2009 1846.368 1718.427 1974.309 1650.699 2042.037Jun 2009 1857.990 1727.933 1988.047 1659.085 2056.895Jul 2009 1984.429 1852.289 2116.570 1782.338 2186.520Aug 2009 1873.303 1739.111 2007.496 1668.074 2078.533Sep 2009 1811.867 1675.652 1948.082 1603.544 2020.189Oct 2009 1823.859 1685.651 1962.068 1612.487 2035.231Nov 2009 1858.554 1718.378 1998.729 1644.174 2072.934Dec 2009 2508.917 2357.169 2660.664 2276.838 2740.995

20

Page 21: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Multiplicative Holt-Winter’s Fit

> liquor.mhw = hw(Sales.ts,seasonal=”multiplicative”)> summary(liquor.mhw)

Forecast method: Holt-Winters' multiplicative method

Model Information:ETS(M,A,M)

Call: hw(x = Sales.ts, seasonal = "multiplicative")

Smoothing parameters: alpha = 0.6154 beta = 0.0104 gamma = 1e-04

Initial states: l = 539.7408 b = 4.4147 s=1.389 1.0075 0.9774 0.9615 1.0217 1.0484 0.9986 0.9956 0.9295 0.9261 0.8494 0.8953

sigma: 0.0299

AIC AICc BIC 4396.707 4398.412 4457.781

Training set error measures: ME RMSE MAE MPE MAPE MASE -0.9843634 42.7434366 30.3659230 -0.1179324 2.3613634 0.2089212

Forecasts: Point Forecast Lo 80 Hi 80 Lo 95 Hi 95Jan 2008 1572.505 1512.278 1632.732 1480.395 1664.614Feb 2008 1492.283 1424.853 1559.712 1389.158 1595.407Mar 2008 1627.464 1543.911 1711.018 1499.680 1755.249Apr 2008 1633.908 1540.770 1727.045 1491.466 1776.349May 2008 1750.419 1641.347 1859.490 1583.608 1917.229Jun 2008 1756.259 1637.971 1874.547 1575.354 1937.165Jul 2008 1844.296 1711.170 1977.423 1640.698 2047.895Aug 2008 1797.695 1659.551 1935.838 1586.423 2008.967Sep 2008 1692.285 1554.585 1829.986 1481.690 1902.880Oct 2008 1720.667 1573.067 1868.267 1494.933 1946.402Nov 2008 1774.231 1614.380 1934.082 1529.759 2018.703Dec 2008 2446.580 2215.791 2677.368 2093.619 2799.540Jan 2009 1577.369 1422.001 1732.738 1339.754 1814.985Feb 2009 1496.898 1343.307 1650.489 1262.001 1731.795Mar 2009 1632.496 1458.369 1806.623 1366.192 1898.801Apr 2009 1638.958 1457.564 1820.352 1361.540 1916.377May 2009 1755.828 1554.519 1957.138 1447.952 2063.705Jun 2009 1761.685 1552.757 1970.613 1442.157 2081.213Jul 2009 1849.993 1623.349 2076.637 1503.371 2196.616Aug 2009 1803.246 1575.312 2031.180 1454.652 2151.841Sep 2009 1697.510 1476.372 1918.648 1359.308 2035.711Oct 2009 1725.978 1494.482 1957.473 1371.936 2080.020Nov 2009 1779.706 1534.175 2025.236 1404.199 2155.212Dec 2009 2454.127 2106.167 2802.086 1921.969 2986.285

21

Page 22: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Other exponential smoothers are also available in the forecast package.

ses – this function performs simple exponential smoothing. holt – this function performs linear exponential smooth (Holt Trend

Corrected), which is very comparable to double exponential smoothing.

hw – does Holt-Winter’s seasonal smoothing as shown above. Both additive and multiplicative options are available.

Even though it is in appropriate to apply simple exponential and linear exponential smoothing to these data, I will demonstrate the use of these smoothers for the liquor sales data.

> Sales.ses = ses(Sales.ts,h=24)> Sales.ses Point Forecast Lo 80 Hi 80 Lo 95 Hi 95Jan 2008 1841.114 1586.415 2095.814 1451.585 2230.644Feb 2008 1841.114 1584.635 2097.594 1448.863 2233.366Mar 2008 1841.114 1582.867 2099.362 1446.159 2236.070Apr 2008 1841.114 1581.111 2101.118 1443.473 2238.755May 2008 1841.114 1579.367 2102.862 1440.806 2241.423Jun 2008 1841.114 1577.634 2104.595 1438.156 2244.073Jul 2008 1841.114 1575.913 2106.316 1435.524 2246.705Aug 2008 1841.114 1574.203 2108.026 1432.909 2249.320Sep 2008 1841.114 1572.504 2109.725 1430.310 2251.919Oct 2008 1841.114 1570.815 2111.414 1427.727 2254.502Nov 2008 1841.114 1569.137 2113.092 1425.161 2257.068Dec 2008 1841.114 1567.469 2114.760 1422.610 2259.619Jan 2009 1841.114 1565.812 2116.417 1420.075 2262.154Feb 2009 1841.114 1564.164 2118.065 1417.555 2264.674Mar 2009 1841.114 1562.526 2119.703 1415.050 2267.179

22

Page 23: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

Apr 2009 1841.114 1560.897 2121.332 1412.559 2269.670May 2009 1841.114 1559.278 2122.951 1410.083 2272.146Jun 2009 1841.114 1557.669 2124.560 1407.621 2274.608Jul 2009 1841.114 1556.068 2126.161 1405.173 2277.056Aug 2009 1841.114 1554.476 2127.753 1402.739 2279.490Sep 2009 1841.114 1552.893 2129.336 1400.318 2281.911Oct 2009 1841.114 1551.319 2130.910 1397.910 2284.319Nov 2009 1841.114 1549.753 2132.476 1395.515 2286.713Dec 2009 1841.114 1548.195 2134.033 1393.134 2289.095

> plot(Sales.ses)

> Sales.holt = holt(Sales.ts,h=24)> Sales.holt Point Forecast Lo 80 Hi 80 Lo 95 Hi 95Jan 2008 1884.332 1634.814 2133.851 1502.727 2265.938Feb 2008 1888.402 1638.260 2138.543 1505.844 2270.960Mar 2008 1892.471 1641.707 2143.236 1508.960 2275.982Apr 2008 1896.541 1645.153 2147.928 1512.077 2281.005May 2008 1900.610 1648.599 2152.621 1515.193 2286.028Jun 2008 1904.680 1652.045 2157.314 1518.308 2291.051Jul 2008 1908.749 1655.491 2162.008 1521.424 2296.075Aug 2008 1912.819 1658.936 2166.701 1524.539 2301.099Sep 2008 1916.888 1662.381 2171.395 1527.653 2306.123Oct 2008 1920.958 1665.826 2176.089 1530.768 2311.148Nov 2008 1925.027 1669.271 2180.783 1533.882 2316.173Dec 2008 1929.097 1672.715 2185.478 1536.995 2321.198Jan 2009 1933.166 1676.160 2190.172 1540.109 2326.223Feb 2009 1937.235 1679.604 2194.867 1543.222 2331.249Mar 2009 1941.305 1683.047 2199.562 1546.334 2336.276Apr 2009 1945.374 1686.491 2204.258 1549.447 2341.302

23

Page 24: Technology - Winona State Universitycourse1.winona.edu/bdeppa/FIN 335/Handouts/Ch 4... · Web viewThe trend weight is essentially 0, suggesting the linear trend part of the smooth

May 2009 1949.444 1689.935 2208.953 1552.559 2346.329Jun 2009 1953.513 1693.378 2213.649 1555.670 2351.357Jul 2009 1957.583 1696.821 2218.345 1558.782 2356.384Aug 2009 1961.652 1700.263 2223.041 1561.893 2361.412Sep 2009 1965.722 1703.706 2227.738 1565.003 2366.440Oct 2009 1969.791 1707.148 2232.434 1568.113 2371.469Nov 2009 1973.861 1710.590 2237.131 1571.223 2376.498Dec 2009 1977.930 1714.032 2241.828 1574.333 2381.528

> plot(Sales.holt)

24