OK, so the next step in our notebook, now that we know how the forecast function works, is to actually
use the forecast function to see how our model behaves.
We'll start by plotting the conditional volatility that our model has learned from some arbitrary date
I chose beforehand.
As you recall, I've stored this in a column called Arche one.
Now, the reason I chose this date is because the conditional volatility on this day has a very high
value compared to the others, as you can see.
So what we want to observe is how does the forecast evolve over time starting from this value?
OK, so just keep in your mind that this date is 2011, 08, 09.
The next step is to create a forecast, well, sit index to true, although this isn't needed and will
set start equal to August one, which includes the date of interest.
The next step is to check the variance of our forecast for the dates surrounding our start date.
This is just so we can observe once again that any date before the start date we passed in the forecast,
we'll have not a number of values.
OK, so we can see that any date before August one does not have a forecast.
The next step as a sanity check is to get the shape of a single row of our variance forecast.
So as you can see, we have five hundred values, which is what we set for the horizon.
The next step is to get the index of the date we are interested in.
The reason we want to do this is we would like to know what the date is, 500 steps ahead, since that
will be the end of our forecast.
OK, so the index of interest is four zero to.
The next step is to check the index value at four zero two plus five hundred.
Again, this represents the end of our forecast.
OK, so the date at the end of our forecast is 12, 13, 08, 06.
The next step is to take what we've just learned and store our variance forecast in our to data frame,
so for the first index into the log function.
Notice I've passed in 2011, 08, 10 up to 2013, 08, 06.
For the second index, we're going to create a new column called Arche one forecast.
On the right side, you can see that we're getting the variance forecasts for 2011, 08, 09.
I've also converted this into an umpire, Ray, since we do not want this to be represented as a series
or a data frame.
If we did use a series or a data frame, it would not have the right indices to match up with the other
two.
So it's simpler to just convert it into an umpire.
Furthermore, notice that we take the square root since we want the volatility.
OK, so the next step is to plot our forecast, along with the predicted conditional volatility.
Note that I've set the dates to surround at the beginning of our forecast, but to cut off around 2012,
as you'll see, the forecast will converge much faster than the full five hundred steps.
OK, so as expected, what we see is that the volatility forecast starts off at a very high value and
then gets lower and lower until it converges.
The next step is to get the index for another specially chosen date, which is 2011, 08 17.
So the reason I chose this date is because this date happens to have an uncharacteristically low volatility.
The goal of all this is to see for ourselves that no matter where the volatility starts from, they
end up converging to the same value.
OK, so the index of interest is four zero eight.
The next step is to check the end date of our forecast, which is four zero eight plus five hundred.
As you can see, it's 12, 08, 14.
So the next step is to grab a forecast for the second date and stored in our data data frame.
This code is pretty much the same as what we had before, except we have different dates and have stored
this in a new column called Arche one for Carcillo.
OK, so the next step is to plot both forecasts at the same time.
So we can see that the result is what I've said you should expect, no matter what the starting volatility
is, both forecasts end up converging to the same value.
So the next step in this script will be to show that this value, which the forecasts converge to,
is actually the theoretical, unconditional variance.
So let's start by using the results objects from earlier and looking at the programs attribute.
So we can see that this is a series that stores Mu, Omega and Alpha1.
The next step is to use the formula we derived earlier for the unconditional variance.
This is a mega divided by one minus Alpha one.
OK, so we get about one point four.
The next step is to check the final value of our first forecast, which started at a very high number,
as you recall.
As you can see, the final value is the same, which is about one point for.
The next step is to check the final value of our second forecast, which started at a very low number.
Again, you can see that the final value is still the same.
About one point four.