So in this lecture, we are going to discuss a very important topic when it comes to Financial Times
series, this is the random walk in the corresponding random walk hypothesis to give you a very brief
summary, a random walk is what we implemented when we did price simulations.
This lecture will expand on what we did by taking a more theoretical look at what we've already done
in practice.
The practical part is useful, but the theoretical part is critical for providing you with necessary
insights.
In fact, we'll learn later in this course that the random walk is a special case of a Arima, a very
important time series model.
So what is the random hypothesis?
Well, put simply, it says that stock prices follow a random walk.
Now, of course, you may not know exactly what a random walk is yet, but that's what this lecture
is about now because of the nature of random walks.
If stock prices do, in fact, follow a random walk, then they are unpredictable.
The rest of this lecture will show you how.
But first, let's discuss some of the history behind the random walk hypothesis.
Firstly, the mathematical concept of random walks has existed for a long time.
As you'll see, it's just a mark of process.
And so it's something you would normally learn in probability class.
The random walk hypothesis is specific to finance and stock prices in particular.
It was popularized in the 70s when a book called A Random Walk Down Wall Street was released.
In fact, this was the book that also popularized the efficient market hypothesis.
Note that both the random walk hypothesis and the efficient market hypothesis lead to the same conclusion,
which is that you can't beat the market.
Now, of course, there are people who don't believe in the random hypothesis.
And so another book has come out called A Non Random Walk down Wall Street.
Interestingly, this book came out almost 30 years later after a random walk down Wall Street.
So it's not as if the random hypothesis and the efficient market hypothesis are ideas which are easily
debunked.
In this course, we're actually going to fit models to stock prices and we'll find that sometimes the
best fitting model is, in fact, a random walk.
So what is a random walk?
Well, probably the simplest random walk works like this start at any price.
Then in order to generate the next price, simply pick either plus one or minus one with equal probability.
So P one is equal to P0 plus E one where E one, it can be either minus one or plus one, then generate
P two from P one in the same way by picking either plus one or minus one with equal probability and
then adding it to P1.
Then we find P three and then we find P four and so on.
So this is a random walk.
Basically you can imagine yourself walking on the sidewalk in one dimension at every step you either
decide to take one step to the left or one step to the right based on the result of a coin flip.
Your walk is then a random walk.
Notice one important property of the random walk.
It's impossible to predict the next value.
You only have a 50 percent chance of getting it right.
In other words, your ability to predict the result of your walk is the same as your ability to predict
the result of a series of coin flips.
Now, we know that changes in stock price aren't just minus one and plus one, but can be real valued.
In fact, we spent a lot of time in the previous section of this course trying to figure out what is
the distribution that stock returns follow.
Let's assume for now that the noise term is Gaussian.
What would our algorithm be for generating stock prices?
Again, we start at p0 equal to some arbitrary value.
To find the next price, we first sample E from our Gaussian, then we add a P zero plus one to find
P one the next price.
We do the same thing to generate P2 and P3 and so forth.
This should sound familiar because it's exactly what we did in our price simulation exercise from the
previous lecture.
In fact that was exactly a random walk.
Notice again how we can't predict P one from P zero or equivalently we can't predict P one minus P zero,
which is just E one, which is Gaussian noise.
We can only predict one insofar as we know its expected value.
Here's something interesting we can do that helps us understand why working with log prices is valuable,
the general formula for a random walk with a drift is as follows.
Muse called the drifter, and it's considered to be constant.
If you're thinking of a time series, this would control the trend of the Time series.
E of T is a Gaussian with mean zero and some variance sigma squared.
In this case, time T and part time T minus one are the log prices at time T and time T minus one respectively.
Note that if I take time T minus one to the left hand side, I get a time T minus time T minus one,
which is the log return.
If we were working with nonlawyers returns, this wouldn't be as convenient, since we would need a
P of T minus one in the denominator to represent the return.
What this says is that the log return is just the thing on the right hand side, which is just the Gaussian
with Meenu and Variance Sigma squared.
So the random walk model goes hand in hand with log prices and log returns.
In fact, this model is the basis for the Black-Scholes formula which earned the Nobel Prize in economics.
Now, the big question is, of course, is the random walk hypothesis correct?
Well, let's recognize that there are some hidden assumptions in the random walk model.
First is that the log returns are ID independent and identically distributed.
We have seen that this may not be true because we have observed volatility clustering.
If the volatility changes over time, then by definition it's not identically distributed.
Furthermore, if the volatility in one period has some relationship to nearby periods, that is high.
Volatility is clustered with other high volatility, then it's also not independent.
At the same time, the random walk model is convenient and easy to work with.
We will find that when we fit Arima models to stock prices, sometimes the best fitting model will be
a random walk.
So it wouldn't be wrong to say that sometimes for certain periods of time, stock prices do look like
they follow a random walk.
As with the efficient market hypothesis, it's possible to use statistical tests to determine whether
or not stock prices follow a random walk.
Now, since this is, of course, on Time series, we're going to do some time series analysis on random
walks.
Let's recognize that a random walk is just a specific instance of a Markov chain.
If you've ever taken any of my courses on NLP or reinforcement learning, you should be familiar with
this concept.
The basic idea is this.
Consider the sentence.
The quick brown fox jumps over the lazy dog.
If I gave you the sequence, the quick brown fox jumps over the lazy, how can you predict the next
word of this sentence?
Well, one solution is to build a probability distribution so you have the probability of the word a
time t given the word a time, T minus one, given the word of times you minus two and so on.
We call such a model a language model.
Well, to get to the point, the mark of assumption says this, it says that instead of the word a time
t, depending on all previous words, it only depends on the most immediate preceding word.
That is P of word a time T given word, a time T minus one word at time, T minus two and so on is equal
to P of word a time T given word of time, T minus one.
Now you might think, OK, that's fine, but let's make this a little less abstract.
Suppose I give you the word lazy and I ask you to predict the next word in my sentence.
Of course, there are many possibilities.
It could be lazy dog, but you'd probably be cheating because that's the sentence I gave you earlier.
It might be lazy programmer, who is the author of this course, but again, you're going to use exogenous
data to make your prediction.
How about lazy student?
In fact, it's quite difficult to know with any certainty exactly what the next word will be, given
only a single word.
Consider the word.
The the next word could be practically anything.
So the lesson here is that the mark of assumption is an extremely strong modeling assumption.
At the same time, it's quite useful.
So let's assume we have a Gaussian random, OK, this is excessive T equals to X of T minus one plus
F.T. Where it is Gaussian distributed with mean zero and variance sigma squared.
In this case, we can see that X of T is completely determined by a Gaussian distribution center, that
X of T minus one with a variance sigma squared.
That is, it does not depend on any previous values in the series, not X, a T minus two, not actually
T minus three and so on.
Therefore the Gaussian random walk forms a Markov chain.
So if stock prices follow a Gaussian random walk, then the next obvious question is how do we forecast
remember that because the next step is essentially random.
The best we can do is find the expected value.
Well, the expected value of a Gaussian with mean X of T minus one is just the mean X of T minus one.
So what does this say?
It's saying that if your stock price follows a random walk, then your best guess for the next stock
price in the series is just the previous value.
We cannot do any better than this.
Notice that this justifies our method of filling in missing data, which is to copy the previous stock
price forward in time.
Now, as you know, often when we make estimates and statistics, we also want to quantify how confident
we are in those estimates.
Let's suppose we start at X of T and we want to forecast tall steps into the future to find X of T,
plus how we already know the expected value of X 50 plus how it's just X of T, the same value we started
with.
But what does this variance?
Well, we can use our price simulation formula.
We know that X 50 plus one is equal to acts of T plus T plus one.
Based on that, we also know that X 50 plus to zero to x 50 plus one plus the two plus two, which is
added one to all the time indices.
However, we can substitute X 50 plus one and then we would get X of T plus E plus one plus eight plus
two.
And then we keep following this pattern until we get to 50 plus tau.
So X of T plus tau Ziko to X of T plus F.T. plus one policy of T plus two all the way up to 80 plus
tão.
Now luckily we did something exactly like this in the previous section.
If all the E's are Gaussian with mean zero and variance sigma squared, then there's some as mean zero
and variance tau time sigma squared.
Therefore we can say that the variance in our estimate increases linearly with tau.
More commonly we work with the standard deviation so we can see that the standard deviation of our forecast
increases with the square root of the number of forecasting steps.
Let's consider a well-known theorem from statistics, the central limit theorem.
We know that our forecast, the Time T plus tau is the last known price of T plus the sum of a bunch
of noise terms.
Recall that the central limit theorem says that this sum tends to a Gaussian distribution.
And so even if your returns do not necessarily follow a Gaussian distribution in the short term, what
happens in the long term?
Well, in the long term, you're just adding up a bunch of random variables.
And due to the central limit theorem, their distribution approaches a Gaussian.
I want to end this lecture with a tale about a famous experiment run by The Wall Street Journal in nineteen
eighty eight.
And this experiment called the Dart Throwing Investment Contest, professional stock traders from the
New York Stock Exchange competed against dummy investors who simply threw darts on a board to choose
stocks randomly.
Now, granted, one might argue that throwing darts is not actually random and there may have been better
ways to make random choices.
In any case, they found that professional investors beat the dummy investors sixty one out of one hundred
times and the dummy investors won only 39 out of 100 times.
So you might think it's better to go with a professional investor rather than just picking stocks randomly.
However, the professional investors only beat the market 51 out of 100 times.
This is why it's often advised not to use active investing, although your bank will tell you otherwise.
Just don't forget your bank is there to sell you things, not to give you good advice if you buy into
an actively managed fund.
First of all, you may only have a 50 percent chance of beating the market and on average you will match
the market.
However, the fees for actively managed funds are much higher than passively managed funds.
Therefore, if you invest in the market itself, your fees will be much lower and you will have the
same expected return anyway.