In this lecture, we are going to come back to the Akef in the pickoff and apply them to stock returns.
So why are we doing this now in this kind of weird order?
Now, you might at first think these lectures are totally disorganised.
Why are the Arima coding lectures all split up?
Why do we look at the HCF in the pickoff so many lectures ago only to return to them now for stock returns?
Well, there is a method to the madness.
I think it's important to start with the most obvious approach.
First, in the case of a Arima, the most obvious approach, if you have the choice between Otto Arima
and the old school methods, I think most of you would choose Otto Auriemma.
And yet we've seen that Otto Arima does not always give us what we might consider to be the best model.
That is when we disagree with the AKG information criteria.
So the goal of this lecture is to take a step back and consider what would we do if Otto Arima didn't
exist?
OK, so let's start by downloading our S&P 500 at CSFI.
Next, let's import our usual library's pandas dumping matplotlib plot AKF and apply.
Next, let's bring in our Naqvi using a read CSFI.
Next, let's filter out all of Google's clothes prices.
Next, let's write a helper function to calculate the log return of a series, so as input, we're going
to take in a series called Price.
Next, we'll calculate the log price by taking the log of the price.
Next, we call the function to take the first difference over the log price, which is the log return.
OK, so you might be wondering why are we taking the log return, why is this what we care about?
Well, you may have forgotten by this point, but remember that when we apply the AMA model of a Arima,
we want that signal to be stationary and our stationary lectures.
We already established that taking the first difference over the log prices, i.e. the log returns,
yields a stationary signal.
Of course, you could do the test again in this script, but I'll leave that to you as an exercise.
Next will apply a function to calculate the log return on Google stock prices.
Max, let's do a deep dive head to make sure our data frame contains the right thing.
Hey, and it does.
Next, let's plot the chief of Google's log returns.
Remember, this is for choosing the order of the auto regressive model.
OK, so what do we see?
Well, pretty much that there is no autocorrelation for any order greater than zero.
We see a couple values just slightly outside the confidence bounds, but these are likely due to chance,
as you recall, even idee noise can lead to the same plot.
OK, so according to the pickoff, we would choose P equals zero.
Next, let's check out the auto correlation or the Assif.
So this looks pretty much the same as the scarf, in other words, we would choose Q equals zero also.
So what can we conclude if we use the offensive method to choose our Arima orders, we would choose
Arima zero one zero.
What is Arima zero one zero?
Well, that is a random walk.
OK, so maybe that was just a fluke.
Let's now try Apple's stock price instead.
All right.
So this is all the same code as before.
Let's filter out Apple's close price.
Next, let's calculate Apple's log returns.
Next, let's look at the picks for Apple.
OK, so what do we see again, pretty much the same picture.
There are really no significant values and therefore we would choose P equals zero.
OK, so what about the akef?
Again, this looks pretty much exactly like the Earth, so we choose Q equals zero, so what do we conclude?
If we go by the Akef method, we would conclude that Apple's stock price follows a random walk.
OK, let's try again, this time with the IBM.
All right, so here's the akef.
And again, we see the same pattern we choose P equals zero.
How about the Assif?
Again, the same pattern we choose Q equals zero.
Notice how closely the ATF and the ATF tracked each other for all the plots we've looked at, consider
why this might be the case.
It should make sense when you think about the formula for calculating the ATF.
In any case, for IBM is pretty much the same situation.
We choose a zero one zero or in other words, we choose random walk.
OK, so let's try this one more time, this time for Starbucks.
All right, so here's the pickoff.
Now, notice for Starbucks, there's kind of a non-zero value at like three, but I would consider this
pretty unlikely to be actually significant.
I would be comfortable saying that P is equal to zero.
How about for the Akef?
Again, it looks just like the picture.
So let's say Q is equal to zero.
All right, so for every stock we looked at in this lecture, if we use the AKF PKF method of choosing
Arima orders, we would choose a rhema zero one zero every time.
In other words, the Randhawa is actually a pretty nice fitting parsimonious model for stock prices.