In this video, I'd like to talk a little bit about stationarity and what it means for a time series to be stationary. The things that you can do in order to make a time series stationary and that's to the process of differencing. So here, we have some graphs of four times series. To get a sense of what I mean by stationary, we're going to look at these graphs. The first one here you can see is it looks like there's a line there, and then there's about the same amount of variance up above the line and down below the line. This one is less, but it's not too bad. But here on the bottom, you can clearly see the data is not stationary. This one has a trend. This one, you can see the variance explodes as we go through time. So what does it mean for a time series to be stationary? So what is stationarity? A time series is stationary when its statistical properties such as the mean, the variance, and the covariance remain unchanged over time. So here, we can see the mean. I'm looking at time series 1, the mean is pretty constant, it remains unchanged over time and the variance around it looks to be constant. It's not exact. It's not perfect, but it seems to be falling consistently within some range. Time series 2, a little bit less so. But here, the time series 3, we can see that there's a trend upward, so the mean is not constant. Then time series 4, we can see that the variance is not constantly time. It's actually getting bigger and bigger as we go forward in time. There are two types of stationary that I'd like to discuss: strong and weak stationarity. So a strong, sometimes not a strict-sense stationary, is a time series if the joint probability distribution remains unchanged when shifted along any time period. So here's an example. Here, we have a time series. The mean, this is generated. So I know the mean is two, and has a variance of one. Okay. So there it is, and that's a strong stationary time series. Like I said, when I mean strong, the probability distribution is the same for every time period. So what does that mean when the probability distribution is the same? The joint probability distribution is the same. You can think of a probability distribution as the odds table. What are the odds of rolling a six if you have two dice, a pair of dice? You can roll a one and a five, a three and a three, or a two and a four, and those are the different combinations out of 36 different possible combinations to roll a six. Similarly with strong stationary, the probability distribution is the same. So the idea is that you will get the same random draw from this distribution with strong stationarity. So the concept of strong stationarity is a little too rigorous for practical use. So there's another concept of weak stationarity, and that's where the mean is constant over time. The covariance is zero over time, and there's a finite variance, and basically that means it's constant, and it sits on a band like it does here. So what's the difference between weak and strong stationarity? As I mentioned before, with the strong stationary, the probability distribution is identical as we go through time, and that also means that the mean and the variance is constant through time. But in weak stationarity is just the mean and the covariance that are the same, but not necessarily the probability distribution. So you can imagine, there might be different probability distributions with a mean of zero, but they're not exactly the same probabilities. In other words, the odds of getting a random draw are slightly different from period to period, but the averages are always the same and the covariance is always zero. So here's some time series that are non-stationary. Here, we see the trend as I mentioned before. Here's one where the variance seems to be exploding as we go through time. So why do we need stationarity? A stationary time series helps prediction become easier because the statistical properties in the future will be the same as they are now. So in weak stationarity, we have a constant mean, a constant variance, and no covariance. So before building any forecast model, we want to make the test for stationarity.