1
00:00:11,050 --> 00:00:17,280
In this lecture, we are going to come back to the Akef in the pickoff and apply them to stock returns.

2
00:00:17,830 --> 00:00:20,750
So why are we doing this now in this kind of weird order?

3
00:00:21,220 --> 00:00:24,520
Now, you might at first think these lectures are totally disorganised.

4
00:00:24,970 --> 00:00:27,320
Why are the Arima coding lectures all split up?

5
00:00:28,000 --> 00:00:34,300
Why do we look at the HCF in the pickoff so many lectures ago only to return to them now for stock returns?

6
00:00:34,840 --> 00:00:36,720
Well, there is a method to the madness.

7
00:00:37,180 --> 00:00:40,150
I think it's important to start with the most obvious approach.

8
00:00:40,150 --> 00:00:46,630
First, in the case of a Arima, the most obvious approach, if you have the choice between Otto Arima

9
00:00:46,630 --> 00:00:50,280
and the old school methods, I think most of you would choose Otto Auriemma.

10
00:00:50,770 --> 00:00:56,790
And yet we've seen that Otto Arima does not always give us what we might consider to be the best model.

11
00:00:57,340 --> 00:01:01,120
That is when we disagree with the AKG information criteria.

12
00:01:01,840 --> 00:01:07,720
So the goal of this lecture is to take a step back and consider what would we do if Otto Arima didn't

13
00:01:07,720 --> 00:01:08,440
exist?

14
00:01:10,650 --> 00:01:14,640
OK, so let's start by downloading our S&amp;P 500 at CSFI.

15
00:01:17,330 --> 00:01:23,180
Next, let's import our usual library's pandas dumping matplotlib plot AKF and apply.

16
00:01:27,460 --> 00:01:31,540
Next, let's bring in our Naqvi using a read CSFI.

17
00:01:34,580 --> 00:01:37,430
Next, let's filter out all of Google's clothes prices.

18
00:01:40,610 --> 00:01:46,640
Next, let's write a helper function to calculate the log return of a series, so as input, we're going

19
00:01:46,640 --> 00:01:48,440
to take in a series called Price.

20
00:01:49,220 --> 00:01:53,000
Next, we'll calculate the log price by taking the log of the price.

21
00:01:53,750 --> 00:01:59,210
Next, we call the function to take the first difference over the log price, which is the log return.

22
00:02:01,930 --> 00:02:07,420
OK, so you might be wondering why are we taking the log return, why is this what we care about?

23
00:02:08,260 --> 00:02:13,510
Well, you may have forgotten by this point, but remember that when we apply the AMA model of a Arima,

24
00:02:13,660 --> 00:02:17,860
we want that signal to be stationary and our stationary lectures.

25
00:02:17,860 --> 00:02:23,380
We already established that taking the first difference over the log prices, i.e. the log returns,

26
00:02:23,680 --> 00:02:25,220
yields a stationary signal.

27
00:02:25,960 --> 00:02:30,700
Of course, you could do the test again in this script, but I'll leave that to you as an exercise.

28
00:02:33,020 --> 00:02:37,790
Next will apply a function to calculate the log return on Google stock prices.

29
00:02:40,700 --> 00:02:45,320
Max, let's do a deep dive head to make sure our data frame contains the right thing.

30
00:02:47,330 --> 00:02:48,590
Hey, and it does.

31
00:02:51,740 --> 00:02:55,250
Next, let's plot the chief of Google's log returns.

32
00:02:55,850 --> 00:02:59,660
Remember, this is for choosing the order of the auto regressive model.

33
00:03:06,140 --> 00:03:07,490
OK, so what do we see?

34
00:03:08,120 --> 00:03:12,990
Well, pretty much that there is no autocorrelation for any order greater than zero.

35
00:03:13,580 --> 00:03:18,820
We see a couple values just slightly outside the confidence bounds, but these are likely due to chance,

36
00:03:19,400 --> 00:03:23,330
as you recall, even idee noise can lead to the same plot.

37
00:03:24,260 --> 00:03:28,520
OK, so according to the pickoff, we would choose P equals zero.

38
00:03:33,040 --> 00:03:36,340
Next, let's check out the auto correlation or the Assif.

39
00:03:41,370 --> 00:03:47,470
So this looks pretty much the same as the scarf, in other words, we would choose Q equals zero also.

40
00:03:48,090 --> 00:03:55,560
So what can we conclude if we use the offensive method to choose our Arima orders, we would choose

41
00:03:55,560 --> 00:03:57,260
Arima zero one zero.

42
00:03:57,870 --> 00:03:59,610
What is Arima zero one zero?

43
00:04:00,060 --> 00:04:01,650
Well, that is a random walk.

44
00:04:04,860 --> 00:04:06,940
OK, so maybe that was just a fluke.

45
00:04:07,230 --> 00:04:09,450
Let's now try Apple's stock price instead.

46
00:04:10,230 --> 00:04:10,590
All right.

47
00:04:10,590 --> 00:04:12,450
So this is all the same code as before.

48
00:04:12,600 --> 00:04:14,880
Let's filter out Apple's close price.

49
00:04:18,180 --> 00:04:20,540
Next, let's calculate Apple's log returns.

50
00:04:24,100 --> 00:04:26,530
Next, let's look at the picks for Apple.

51
00:04:30,780 --> 00:04:34,960
OK, so what do we see again, pretty much the same picture.

52
00:04:35,430 --> 00:04:41,010
There are really no significant values and therefore we would choose P equals zero.

53
00:04:45,900 --> 00:04:47,940
OK, so what about the akef?

54
00:04:52,220 --> 00:04:59,510
Again, this looks pretty much exactly like the Earth, so we choose Q equals zero, so what do we conclude?

55
00:05:00,080 --> 00:05:06,210
If we go by the Akef method, we would conclude that Apple's stock price follows a random walk.

56
00:05:11,150 --> 00:05:14,210
OK, let's try again, this time with the IBM.

57
00:05:17,030 --> 00:05:18,940
All right, so here's the akef.

58
00:05:20,820 --> 00:05:24,660
And again, we see the same pattern we choose P equals zero.

59
00:05:27,160 --> 00:05:28,420
How about the Assif?

60
00:05:32,090 --> 00:05:35,160
Again, the same pattern we choose Q equals zero.

61
00:05:36,290 --> 00:05:42,680
Notice how closely the ATF and the ATF tracked each other for all the plots we've looked at, consider

62
00:05:42,680 --> 00:05:44,050
why this might be the case.

63
00:05:44,570 --> 00:05:48,700
It should make sense when you think about the formula for calculating the ATF.

64
00:05:49,580 --> 00:05:53,010
In any case, for IBM is pretty much the same situation.

65
00:05:53,030 --> 00:05:57,320
We choose a zero one zero or in other words, we choose random walk.

66
00:06:01,280 --> 00:06:05,030
OK, so let's try this one more time, this time for Starbucks.

67
00:06:07,920 --> 00:06:09,740
All right, so here's the pickoff.

68
00:06:13,680 --> 00:06:18,750
Now, notice for Starbucks, there's kind of a non-zero value at like three, but I would consider this

69
00:06:18,750 --> 00:06:21,340
pretty unlikely to be actually significant.

70
00:06:22,350 --> 00:06:25,020
I would be comfortable saying that P is equal to zero.

71
00:06:28,120 --> 00:06:29,590
How about for the Akef?

72
00:06:32,370 --> 00:06:34,340
Again, it looks just like the picture.

73
00:06:34,500 --> 00:06:36,630
So let's say Q is equal to zero.

74
00:06:38,360 --> 00:06:45,020
All right, so for every stock we looked at in this lecture, if we use the AKF PKF method of choosing

75
00:06:45,020 --> 00:06:49,170
Arima orders, we would choose a rhema zero one zero every time.

76
00:06:49,760 --> 00:06:55,940
In other words, the Randhawa is actually a pretty nice fitting parsimonious model for stock prices.
