1
00:00:11,040 --> 00:00:16,080
In this lecture, we are going to continue looking at the previous notebook in which we look at the

2
00:00:16,080 --> 00:00:22,290
archives in the archives of signals we generated ourselves to test that our methods of choosing Arima

3
00:00:22,290 --> 00:00:23,820
orders actually works.

4
00:00:24,450 --> 00:00:29,670
So since we've already looked at the archive, this lecture will focus on the AKF and moving average

5
00:00:29,670 --> 00:00:30,280
models.

6
00:00:30,930 --> 00:00:34,090
We'll start by plotting the act for idee noise.

7
00:00:34,620 --> 00:00:39,350
Note that we are now using the function to plot Akef instead of plot pickoff.

8
00:00:39,750 --> 00:00:41,910
However, the syntax is the same.

9
00:00:42,810 --> 00:00:45,840
All right, so what do we see as expected?

10
00:00:45,870 --> 00:00:50,680
There is no autocorrelation between any point in the Time series and any other point.

11
00:00:51,240 --> 00:00:55,820
Therefore, the autocorrelation is one at like zero and zero elsewhere.

12
00:01:00,270 --> 00:01:07,170
Next, we're going to generate and may one process, we'll start by creating an array of size 1000 with

13
00:01:07,170 --> 00:01:11,780
samples from the normal with mean zero and standard deviation at zero point one.

14
00:01:12,660 --> 00:01:14,480
We'll call this array errors.

15
00:01:15,240 --> 00:01:21,270
As you recall, the May one process is generated by adding the current error, plus some coefficient

16
00:01:21,480 --> 00:01:23,010
times the previous errors.

17
00:01:23,730 --> 00:01:26,730
So next, we'll create an empty list called M1.

18
00:01:28,470 --> 00:01:34,080
Then we'll enter a loop that goes for 1000 iterations, the same size as our errors array.

19
00:01:35,010 --> 00:01:40,820
Inside the loop, we'll check whether the Loop iteration index is greater than or equal to one or not.

20
00:01:41,490 --> 00:01:47,640
If it's not, then at zero, which is a special case for AI, greater than or equal to one, we just

21
00:01:47,640 --> 00:01:49,390
have the normal MS1 equation.

22
00:01:50,010 --> 00:01:56,220
Again, I've chosen the coefficient zero point five arbitrarily, so the current value in the Time series

23
00:01:56,250 --> 00:02:02,010
is zero point five times the previous error, plus the current error at Index I.

24
00:02:02,670 --> 00:02:05,570
If I is equal to zero, we have the else block.

25
00:02:06,300 --> 00:02:09,750
Note that when is equal to zero, there is no past value.

26
00:02:09,750 --> 00:02:12,860
Therefore, it's not possible to add any previous error.

27
00:02:13,470 --> 00:02:17,970
Therefore, for the first iteration, X is just equal to the first error.

28
00:02:19,340 --> 00:02:26,330
Outside the statement, we append X to the list May one and then outside the loop, we convert our M

29
00:02:26,330 --> 00:02:28,280
one list into an umpire, A.

30
00:02:34,440 --> 00:02:40,680
In the next block, we plot our MS1 process, note that again, this kind of just looks like regular

31
00:02:40,680 --> 00:02:46,860
noise, it's generally very hard to tell whether something is that may process or an error process just

32
00:02:46,860 --> 00:02:49,200
by looking at a stationary time series.

33
00:02:52,780 --> 00:02:56,590
The next step is to plot the akef for our MS1 array.

34
00:02:57,310 --> 00:03:04,360
All right, so as you can see, we have one non-zero Akef value at like one, which is what we expect

35
00:03:04,900 --> 00:03:11,610
if we were to do this in reverse order, that is, use the HCF plot to find the order of the MACU process.

36
00:03:11,920 --> 00:03:17,410
We would look at this plot and choose Q equals one because that's the maximum non-zero value.

37
00:03:22,470 --> 00:03:28,260
Next, we're going to generate and may to process again, this code is very similar to the previous

38
00:03:28,260 --> 00:03:34,740
code, except that now the current value in the Time series depends on three errors, the current error,

39
00:03:34,740 --> 00:03:37,860
the error at like one and the error at like two.

40
00:03:38,520 --> 00:03:44,520
I've given that error at like one, a coefficient of zero point five and the error apply to a coefficient

41
00:03:44,520 --> 00:03:46,150
of a minus zero point three.

42
00:03:46,470 --> 00:03:48,610
Same as the error to process from earlier.

43
00:03:49,590 --> 00:03:55,350
Note that this time I didn't bother to account for the early values in the Time series as special cases.

44
00:03:55,980 --> 00:04:01,500
Recall that in some pie, if you index an array with negative values, it just loops back around the

45
00:04:01,500 --> 00:04:02,070
end.

46
00:04:02,550 --> 00:04:07,430
Since those values are random anyway, it doesn't really affect our results in any negative way.

47
00:04:08,070 --> 00:04:12,060
Therefore, I've decided to keep the code like this for the sake of simplicity.

48
00:04:13,140 --> 00:04:16,590
So there are no special cases for equal zero and I equals one.

49
00:04:21,770 --> 00:04:27,620
Next, we our may to process as a time series, again, it just looks like regular noise.

50
00:04:31,950 --> 00:04:33,660
Next, we plot the akef.

51
00:04:34,080 --> 00:04:40,440
All right, so we see what we expect, there are non-zero values like one and two, which would mean

52
00:04:40,440 --> 00:04:42,540
that we would choose Q equals two.

53
00:04:42,780 --> 00:04:47,070
And we know that this is true because we just created an M to process.

54
00:04:53,760 --> 00:04:59,460
Next, we're going to generate an May three process, the wait for like one is zero point five.

55
00:04:59,610 --> 00:05:04,740
They'll wait for two is minus zero point three and the wait for like three is zero point seven.

56
00:05:05,310 --> 00:05:08,070
Other than that, this code is the same as before.

57
00:05:11,850 --> 00:05:16,710
If we look at our Time series plot, I would say that there is still no discernible difference between

58
00:05:16,710 --> 00:05:18,480
this and the other plots.

59
00:05:23,420 --> 00:05:28,900
Next, if we look at the Akef plot, we see that the largest nonzero lag is three.

60
00:05:29,780 --> 00:05:33,020
Note that there is one other non-zero lag at twenty five.

61
00:05:33,170 --> 00:05:38,900
But again, as per what we know about statistical testing, this is supposed to happen about five percent

62
00:05:38,900 --> 00:05:39,650
of the time.

63
00:05:40,160 --> 00:05:45,950
If we saw this plot and did not know that we were dealing with an M three process, we would still probably

64
00:05:45,950 --> 00:05:49,040
choose May three rather than May 25.

65
00:05:49,610 --> 00:05:55,660
We know intuitively that May 25 is probably unlikely and we would also prefer a simpler model.

66
00:05:56,390 --> 00:06:00,200
We also see that this value is not that far outside of the confidence bounds.

67
00:06:00,530 --> 00:06:03,530
So most likely we would just ignore this as a fluke.

68
00:06:09,950 --> 00:06:12,800
Next, we're going to generate an MI6 process.

69
00:06:13,430 --> 00:06:17,810
All right, so this time I'm not going to read you the weights, but you can feel free to make note

70
00:06:17,810 --> 00:06:19,040
of these if you would like.

71
00:06:22,310 --> 00:06:28,520
When we plot the M6 process, we see that it's still pretty much just looks like all of the other stationary

72
00:06:28,520 --> 00:06:29,890
time series we've looked at.

73
00:06:36,050 --> 00:06:44,190
Next, we plot the Akef for our MSCs process, as you can see, the largest nonzero lag is at like six.

74
00:06:44,990 --> 00:06:49,380
Notice how at like four, the value does not go outside the confidence interval.

75
00:06:49,880 --> 00:06:56,120
However, we would most likely not consider this in May three because of the significant non-zero values

76
00:06:56,150 --> 00:06:57,920
at like five and like six.
