Welcome back to practical time series analysis. In these lectures we're looking at forecasting. We're trying to say something interesting and intelligent about a future state of the system based upon present and past states. We've already seen how to simple exponential smoothing. We will determine a smooth level. We've done double exponential smoothing where we come up with a smooth level and a smooth trend. And now we're going to bring in a seasonal effect with triple exponential smoothing. Our goals in this lecture are somewhat modest. We'll be engaging software and datasets more fully in the next lecture in the follow on to this one. But for this lecture, we're going to try to work you through the basic steps of triple exponential smoothing in such a way that you could state and explain it to a friend or a colleague. There's a really terrific website from Nikolaos Kourentzes to try to capture the difference between additive and multiplicative seasonality. If you want to explain to somebody what a cat is, I think you're going to have a hard time. But if you show them 20 different cats, I think they'll get the idea. In the same spirit, in the readings and in past lectures, we've already discussed additive or multiplicative seasonality. The virtue of this website and the exercises that he has there for you is that you can look at additive and multiplicative seasonality, and try to understand in a very intuitive way, the differences between the two. I mean, as I look here on the additive seasonal series, you can see that there is certainly a repeating pattern. There is a seasonality to this dataset. When I look at the variability, the variability appears to be somewhat constant in time. Okay, perhaps with a little bit of noise. But basically, I don't see any systematic changes in the variability as I move along. Multiplicative seasonality gives you more characters to fanning structure. And the variability really does seem to be in this case growing in time. So there's a difference between additive seasonality, where to look into the future we just add a constant amount. And multiplicative seasonality where we'll multiply by a constant amount. Let's see which one Holt Winters exhibits in their famous example here, Air Passenger Miles. So we have an original source for the data set, but what these guys were looking at was during the 1950s, air passenger miles and essentially the volume of air travel. So as I go from the late 40s to the very early 60s, I certainly would expect the volume of air passenger miles to be increasing, and I think I can talk myself into believing that there'd be a seasonality there as well. And the data set does not disappoint. As I move from the left to the right, I certainly see that there is a season involved here. So I get this repetitive structure every 12 months. And also, as I move from left to right, there's a trend upwards and the variability also seems to be growing. So I see the same essential structure in the data set as I look here. But as I move from left to right, the magnitude of the structure, the size of the structure seems to be increasing. If we take logs, we can look at something that seems to have more apparent additive seasonality. This is an old trick. You know that the log whatever base E, 10, 2 are very common bases that the logarithm is going to take multiplication and turn it into addition. Log of a times b is log a plus log b. So we're not surprised that we can get from multiplicative seasonality to additive based upon taking logs. Now our current methods are pretty disappointing on this data set. If I look on the graph on the left, then I can see the actual time series in black. The forecasts are in red and the amount of error here is I guess I would say unacceptable. There's really, the forecast is not very good using this first kind of simple exponential smoothing. Perhaps a little surprisingly as you move to double exponential smoothing, we still have a pretty poor forecast. So it's really important to include this seasonal effect in our modeling, if we want to have a good forecast. Just as a reminder, the types of exponential smoothing we've been doing, of course, have a geometric series lurking in the background. But there's some simplifications that you can make, as we discussed in the readings. And our terms tend to look like this. We'll take some Greek letter that controls how much of the current value of the system you want to see compared to history. We'll take Greek letter times some sort of fresh new value + 1- Greek letter times the history of the system. So this is the common pattern here. If we want to weight the new information higher, that's going to come at the expense of the history of the system. Triple exponential smoothing, we can look at sums of squares of errors or whatever you like for your criterion of quality. Triple exponential smoothing visually in fact is quite strikingly better. So we seem to be onto something good here with this triple exponential smoothing. We want to be able to include level, trend, and seasonality. So we're going to look at, first, smoothing the level. So x sub n is a data point and this is our seasonal bump. So either adding or subtracting a certain amount. And the way we'll smooth the level is by looking at our smooth level as alpha times fresh value. There's your current data point minus the current seasonal smooth piece. And in fact, we're assuming that there are m data points as we get through a cycle or a season, I think people would say. So seasonal n- m is sitting right here. We've got 1- alpha over on this side times level n plus trend. So the smooth level essentially looks like what we did before, only now instead of just having alpha times x sub n, we're doing a seasonally adjusted level. And we'll try to pick up the seasonal bump differently in a moment. We're going to smooth the trend so the trend, the current smooth trend is going to look like beta times level minus level. Again we're using these smooth levels to try to get rid of the effects of noise, and look at the more persistent, or systematic pieces, plus 1- beta times the history here trend n-1. This is just what we did in the last lecture. Finally, we want to smooth the season, and so we'll bring in a new parameter gamma. We'll take a gamma times and now here we're going to bring in new information as current data point minus the current smooth level and we'll add to that. Now look at this piece, we're going to take 1- gamma times the past smooth seasonal piece. So seasonal at time n is going to look at seasonal at time n- m. So we're going to reach back along the time series to the start of that little cycle going on. And we'll take our old best guess at the seasonal bump and augment it with gamma times this new piece right here. In order to update the forecast for additive seasonality, it's really quite simple and intuitive. We'll get our prediction h into the future as our current smooth level, and now remember what we did. We'll take our smooth trend, that's essentially the step size, and we'll walk up or down depending upon the sign, h steps. So this first piece is accounting for the smooth level then we'll bring in our trend contribution. And we're also going to bring in a seasonal contribution. So we're going to get our seasonal bump as we're looking for the forecast that n + h, so h into the future. So we'll take our seasonal piece here, n + h, and then- m, and that's going to give us the updated forecast using additive seasonality. If you want multiplicative seasonality, then instead of adding you're going to multiply. So instead of adding a fixed amount you multiply by 120%, 150%, whatever's appropriate in your model. Now people enjoy programming will go out and write their own code to find alpha, beta, and gamma, and that's fine. I solute you, but I think for our approach here, we'll let the software find the best values for us, and also do the predictions for us. So at this point, you should be able to turn around to somebody next to you and explain the whole triple exponential smoothing approach. That we're going to smooth level, we're going to smooth trend, we're going to smooth the seasonal contribution. And then for additive seasonality, we'll add the three of them together. And in the multiplicative seasonality, we'll get the seasonal effect as level plus H trend. And then, instead of adding we'll be multiplying by the seasonal bump.