In this lecture, we are going to continue looking at the previous notebook in which we look at the
archives in the archives of signals we generated ourselves to test that our methods of choosing Arima
orders actually works.
So since we've already looked at the archive, this lecture will focus on the AKF and moving average
models.
We'll start by plotting the act for idee noise.
Note that we are now using the function to plot Akef instead of plot pickoff.
However, the syntax is the same.
All right, so what do we see as expected?
There is no autocorrelation between any point in the Time series and any other point.
Therefore, the autocorrelation is one at like zero and zero elsewhere.
Next, we're going to generate and may one process, we'll start by creating an array of size 1000 with
samples from the normal with mean zero and standard deviation at zero point one.
We'll call this array errors.
As you recall, the May one process is generated by adding the current error, plus some coefficient
times the previous errors.
So next, we'll create an empty list called M1.
Then we'll enter a loop that goes for 1000 iterations, the same size as our errors array.
Inside the loop, we'll check whether the Loop iteration index is greater than or equal to one or not.
If it's not, then at zero, which is a special case for AI, greater than or equal to one, we just
have the normal MS1 equation.
Again, I've chosen the coefficient zero point five arbitrarily, so the current value in the Time series
is zero point five times the previous error, plus the current error at Index I.
If I is equal to zero, we have the else block.
Note that when is equal to zero, there is no past value.
Therefore, it's not possible to add any previous error.
Therefore, for the first iteration, X is just equal to the first error.
Outside the statement, we append X to the list May one and then outside the loop, we convert our M
one list into an umpire, A.
In the next block, we plot our MS1 process, note that again, this kind of just looks like regular
noise, it's generally very hard to tell whether something is that may process or an error process just
by looking at a stationary time series.
The next step is to plot the akef for our MS1 array.
All right, so as you can see, we have one non-zero Akef value at like one, which is what we expect
if we were to do this in reverse order, that is, use the HCF plot to find the order of the MACU process.
We would look at this plot and choose Q equals one because that's the maximum non-zero value.
Next, we're going to generate and may to process again, this code is very similar to the previous
code, except that now the current value in the Time series depends on three errors, the current error,
the error at like one and the error at like two.
I've given that error at like one, a coefficient of zero point five and the error apply to a coefficient
of a minus zero point three.
Same as the error to process from earlier.
Note that this time I didn't bother to account for the early values in the Time series as special cases.
Recall that in some pie, if you index an array with negative values, it just loops back around the
end.
Since those values are random anyway, it doesn't really affect our results in any negative way.
Therefore, I've decided to keep the code like this for the sake of simplicity.
So there are no special cases for equal zero and I equals one.
Next, we our may to process as a time series, again, it just looks like regular noise.
Next, we plot the akef.
All right, so we see what we expect, there are non-zero values like one and two, which would mean
that we would choose Q equals two.
And we know that this is true because we just created an M to process.
Next, we're going to generate an May three process, the wait for like one is zero point five.
They'll wait for two is minus zero point three and the wait for like three is zero point seven.
Other than that, this code is the same as before.
If we look at our Time series plot, I would say that there is still no discernible difference between
this and the other plots.
Next, if we look at the Akef plot, we see that the largest nonzero lag is three.
Note that there is one other non-zero lag at twenty five.
But again, as per what we know about statistical testing, this is supposed to happen about five percent
of the time.
If we saw this plot and did not know that we were dealing with an M three process, we would still probably
choose May three rather than May 25.
We know intuitively that May 25 is probably unlikely and we would also prefer a simpler model.
We also see that this value is not that far outside of the confidence bounds.
So most likely we would just ignore this as a fluke.
Next, we're going to generate an MI6 process.
All right, so this time I'm not going to read you the weights, but you can feel free to make note
of these if you would like.
When we plot the M6 process, we see that it's still pretty much just looks like all of the other stationary
time series we've looked at.
Next, we plot the Akef for our MSCs process, as you can see, the largest nonzero lag is at like six.
Notice how at like four, the value does not go outside the confidence interval.
However, we would most likely not consider this in May three because of the significant non-zero values
at like five and like six.