Okay. Now, we are going to estimate the GARCH model using the rugarch package in R. This package has many useful functions and can estimate very general versions of the GARCH model. For more details, I highly recommend looking at the document called Introduction to the rugarch package, and the Package rugarch written by Alexios Ghalanos. We will use the rugarch package to estimate the GARCH model. Here are the three equations of this model. Again, the mean equation is exactly as we had written it out before, the variance equation is also as exactly as we had written it out before. Similarly, the distribution equation is also exactly as we had written it out before. I have put the normality assumption in red. This is because later on, I will change this assumption. Now, let me tell you what I had to do when I first estimated the GARCH model, it was about 30 years ago. I had the same GARCH model that we are using here. To estimate this model, I had to write hundreds possibly thousands of lines of Fortran code. Of course, it took hours and hours to debug my Fortran code. Now, thanks to the rugarch package, you can do this in just a few R commands. It's just amazing. So let me show you how easy it is to use the rugarch package. We start with using the ugarchspec function to specify which GARCH model we want. There are three important arguments. The variance.model argument tells all the variance equation we want. The mean.model argument tells R the mean equation we want, and the distribution.model argument tells R the distribution of Epsilon. So here are the R commands that I use to do this. Remember to install the rugarch package before you start, then load the rugarch package using the library function. Then, use the ugarchspec function to define the GARCH model we want. Save the specification in an R object called garch.N. I'm not going into the details of the arguments of this function except to say that the variance.model is using a GARCH 1,1, the mean.model is using just a constant term which is the mean, and the distribution.model is using the standard normal distribution. After specifying the GARCH model and saving it in garch.N, we then use the ugarchfit function to estimate it. The ugarchfit function has two arguments. Set the first argument spec to be the GARCH specification. In our case, it is garch.N. Set the second argument data to be the data set we are using which is logret. We will save the output of the ugarchfit function in an R object called fit.garch.N. When R is finished estimating the GARCH model, we can print out fit.garch.N. At the bottom of the white box on this slide, you can see the four parameters of our GARCH model. Mu is the a sub zero in the mean equation. Omega is the Alpha_0 in the variance equation. Alpha1 is the Alpha_1 in the variance equation, and Beta1 is the Beta_1 in the variance equation. Next, we will save some of the output. We use the cbind function to create a variable called save1, which has three columns of data. The first column is the log return series that we used. The second column is the fitted value of daily standard deviation. That is the square root of ht_1 in the variant equation. The third column is the fitted value the Epsilons in that distribution equation. We use the name function to give these three columns the names logret, S, and Z. To track if the GARCH model is doing what we want to do, we run some diagnostic test. First, we check for the specification of that distribution equation. That is the Epsilons have a standard normal distribution. Under this specification, the fitted values of Epsilon_t which are now called z_t should be normally distributed. So the z_ts should have these statistical properties. The mean of z should be zero, its standard deviation should be one, its skewness should be zero, and its kurtosis should be three. Now, the actual values of these four statistics for z_t are given in black on the slide. The z_ts have a mean very close to zero, and a standard deviation very close to one. However, the z_ts are left-skewed because the skewness coefficient is negative and have larger kurtosis than three which is the kurtosis of the normal distribution. So it doesn't look normal. When we perform the Jarque-Bera test of normality, we strongly reject the normality for the Zs. Now, the fact that the Zs do not strictly conform to the GARCH model specification, however, does not mean that the GARCH model is not useful, quite the contrary. Do you remember the kurtosis of our data? It was about 23. The kurtosis of the Zs is 6.44, this is much smaller than 23, but of course, still larger than three. What does this tell us? It tells us that the GARCH model is able to explain quite a lot but not all of the heavy tails of the data. Now, besides that distribution equation, we also want to check for serial correlation and volatility clustering in the fitted value of the Epsilon_Ts which are Zs. The ACFs of the Zs which is in the graph on the left, indicates no serial correlation. The ACF of the absolute values of the Zs which is the graph on the right, also indicates no volatility clustering. We should be particularly happy to see the graph on the right. It tells us that the variance equation in the GARCH model is able to explain all the volatility clustering in our data. So here is the bottom line. The GARCH model with normal errors can explain the volatility clustering in our data, and it can explain some but not all of the heavy tails of the data. To do so, we need to specify the distribution equation by changing the distribution. Now, it is your turn to estimate the GARCH model with the normal distribution in the data you downloaded from Fred.