In this lecture, we will be talking about the autocorrelation function. Objectives are the following. We will define the autocorrelation function. We will obtain so-called correlograms using acf() routine in R, and we will estimate autocorrelation coefficients at different lags, again, using acf() routine in R. Before we define autocorrelation function, we assume the weak stationarity. Remember weak stationarity, no systematic change in mean, no systematic change in variation, no periodic fluctuations. Okay, so autocorrelation coefficient between Xt and Xt+k, remember, the most important part here is the time difference between these two random variables. Which is k, is going to be defined rho k, which is gamma k over gamma 0, gamma k being auto covariance coefficient of lag k, gamma 0 is auto covariance coefficient at lag 0. Which is the first auto covariance coefficient, and this rho k, which is autocorrelation coefficient, is always between -1 and 1. But of course, you can estimate it because we do not have a statistic process, you always have a time series, which is just one realization of the statistic process. You're going to estimate it with rk, which is ck/c0, remember, ck, it was our estimation for auto covariance coefficient at lag k, and c0 is alpha covariance estimation for auto covariance coefficient at lag 0. There's another way of writing rk, if we write the formula for ck and c0, you obtain that rk is basically the division of these two sums. Here, x bar is basically the sample average. So, we're going to use acf() routine when we calculate autocorrelation coefficients and to obtain also correlograms. We have already used acf() routine by using type b in covariance to get the auto covariance coefficiency. This time, we're not going to specify the types, or we will get exact autocorrelation function. The plot that it gives us are basically autocorrelation coefficients at different lags. And using as a height graph, and the graph is going to be called correlogram. And it always starts at 1 because r0 is basically c0/c0, which is 1. Let's look at the purely random process we generated in the last video lecture. Remember, purely random process was only basically generated from normal distribution and put some transient structure on it. There is no special pattern in that time series. That's why we call it purely rhyme and process. And I'm going to use acf() routine, which will give me autocorrelation coefficient at every lag for a few lag, 20 or 30. And it will give me a plot, which is going to be called correlogram. And I give a title to it, it's called correlogram of a purely random process. If I run this routine, I get the following plot. Here, you see, I have R0, which is 1, it always will start 1. Then later on, I do not have much correlation between all the different lags. Just because we generated this data as a purely random process, that you do not expect to see the correlation within different lags. These dash lines are basically showing the significance level. So this plot tells us that there are not much significant lags in the previous steps. And there are two of them, and maybe these two can be attributed directly to a chas. And I have a correlogram until lag 20. We can actually change this and make it until lag 40 and so forth. If we go back and put this on the parentheses, then we'll not only get plot, we'll also get autocorrelation coefficients. And here we have, we have autocorrelation coefficient. This is R0, remember, R0 is always 1. And then we have R1, which is 0.18, this is 0.04. And then basically, we have nonsignificant autocorrelations until lag 20. So what have you learned in this lecture? You have learned the definition of autocorrelation function, which we abbreviate as acf. You have learned how to produce correlograms using acf() routine. And also, by using acf() routine, you learned how to estimate autocorrelation coefficients at different lags of a time series.