In this lecture, we are going to check our understanding of the Akef and encode this lecture is going
to walk you through a prepared CoLab notebook, although a very good exercise, which I always recommend,
is once you know how this is done, to try and recreate it yourself with as few references as possible.
As always, you can check the lectures, how to code by yourself and how to practice for a more in-depth
discussion.
If there's anything in this lecture you didn't understand or you think I missed a step or didn't explain
why we were doing something, please use the Q&A to inquire.
As usual, you can look at the title of the notebook to determine what notebook we are currently looking
at.
So the first thing we're going to do is import plot and a plot akef from stat's models, these are more
useful than just generic HCF functions that only give you back an array, since these will make a plot
and draw the confidence bounce automatically.
Next, we're going to import numpty and matplotlib.
Next, we're going to generate IDE noise from the standard normal.
Just to build a point of comparison for what we will see later in this lecture, let's plot what this
noise looks like, OK, so I'm pretty sure this is not too surprising.
Next, let's call the function of plot, we'll be looking at auto regressive models first.
And as you know, the relevant plot for that is the notice that I'm using.
The subplots function to manage the size of a plot.
This returns an access object, which I then pass into the plot function.
All right.
So what do we see?
Well, as expected, most of the lagged values are very near zero.
The first value is one, since that's just the autocorrelation of each point with itself.
Notice how there are multiple values in which the pickoff goes just outside the confidence bounds.
However, you have to remember the definition of the confidence interval.
Basically, this is allowed to happen randomly five percent of the time, even when there is no true
correlation.
Since these values are so close to the threshold, we can intuit that it's probably OK to ignore them.
Next, let's create an air one process and test that again to generate this process.
I'm going to create a list called X1 within initial value of zero.
Then I'm going to enter a loop that goes for 1000 iterations inside this loop.
I'm going to create the next value by taking zero point five times the previous value, plus some Gaussian
noise with standard deviation.
At zero point one, we'll call this variable X.
Next, we append X to X1.
When we're outside the loop, we can't explain it to an umpire in the next block, we plot one.
As you can see, it looks pretty stationary and there's no real observable difference between this and
ID noise.
It's not obvious that each value depends on the previous value.
Next, we plot the pickoff for X1, as you can see, we have a value at like one which is far outside
the confidence threshold.
Therefore, if we were to look just at this plot, we would conclude that our TIME series is an A1 process.
And of course, we know that this is true because that is what we just created.
Next, we're going to do another experiment again for an R-1 process.
I'm not going to run through the details of this code again, since it's very similar to last time.
The main difference with this code is that the coefficient for the previous X term is now negative zero
point five instead of positive zero point five.
We'll see what effect this has on the Earth if we look at the plot of the Time series.
Again, it's not at all obvious that this is any different from just plain Idy noise.
All right, so next we look at the picture, this time we see that there is, again, a non-zero value
at like one, but this time it's negative corresponding to the negative coefficient of our R-1 process.
Next, we're going to generate an R2 process, so this time the Time series will depend linearly on
to pass values instead of just one to initialize.
Our list will set the first two values in X two to be zero.
Inside the loop, we use the following equation.
The coefficient for the one value is zero point five.
The second coefficient for the two value is minus zero point three.
And again, we have Gaussian noise with a standard deviation, a zero point one.
From our Time series plot, it is again the case that we probably cannot distinguish this from idee
noise, although the variants in the later parts of the Times series seems to be quite high.
If we look at the pickoff, we can see that there are now two non-zero lag's corresponding to the two
coefficients of our R2 process, the first non-zero value is positive and the second at non-zero value
is negative.
If we were to use this plot to choose the value of P for fitting in auto regressive model, we would
definitely choose to.
So this confirms that this method works.
Next, we're going to generate an five process to initialize X5 or create an array of all zeroes inside
the loop to generate the next value of X. We will make X depend on three different lagged values rather
than all five in particular.
These will be the last value at T minus one, the second class value at T minus two and the fifth less
value at T minus five.
The weights for these will be zero point five minus zero point three and minus zero point six respectively.
Again, we'll add Gaussian noise with mean zero and standard deviation at zero point one.
Notice that when we plot the process is a time series, it definitely looks a little different from
Idy noise and all of the previous plots, there seems to be more of a pattern in a more wavelike structure
to the Time series.
Next, we noticed something interesting with this, even though our Time series does not depend on the
lag, three and like four values, the corresponding values in the pickoff are still non-zero.
So although we generated the process ourselves and we know that it doesn't depend on the three and like
four values, when we fit in ERP model, we will always include those terms.
So this is a sign that just because you have some in between values that don't affect the next value
in a time series, this does not mean that their values will be zero.
All right.
So since this lecture has been pretty long already, I will see you in the next lecture to look at the
akef and moving average models.