10-K Diver Profile picture
17 Apr, 32 tweets, 8 min read
1/

Get a cup of coffee.

In this thread, I'll help you understand Markov Chains.

In life, and in investing, we often come across situations where luck/chance plays a major role.

And Markov Chains are often a great way to model and analyze such situations.
2/

Here's what prompted me to write this thread.

Earlier this week, I conducted a Twitter poll.

In the poll, I posed a question that required a bit of probabilistic reasoning.

The good news: over 10,000 people responded.

The bad news: ~87% got the answer wrong!
3/

Here's the question I asked.

Imagine we have 2 volunteers: Alice and Bob.

We give them each a fair coin.

We ask Alice to keep tossing her coin until she sees a Heads immediately followed by a Tails (ie, the pattern HT).
4/

We ask Bob to keep tossing his coin until he sees two consecutive Heads (ie, the pattern HH).

The question is: on average, who will take more tosses to get to their "target pattern" -- Alice or Bob?

Or will they both on average take the same number of tosses?
5/

More precisely:

Suppose Alice takes A tosses on average to get her HT.

And Bob takes B tosses on average to get his HH.

Then, which is the bigger number: A or B?

Or are they both the same number?
6/

We know Alice and Bob both have fair coins.

So, in any 2 consecutive tosses, Alice's HT is just as likely to show up as Bob's HH.

So, on average, it *seems* like they'll both take the same number of tosses (ie, A = B).
7/

In fact, that's exactly what ~77% of poll respondents said:

8/

But that's *not* the right answer.

The right answer is: on average, Alice's HT will appear in just 4 tosses.

But Bob's HH will take 6 tosses.

That is, A = 4 and B = 6.

Bob, on average, takes longer.

How strange!
9/

Here's the thing:

When it comes to probability, our intuition often leads us astray.

The best way to deal with it is to meticulously write down the various possible outcomes and actually work through the math.

And Markov Chains are handy models for doing just that.
10/

For example, here is Alice's Markov Chain.

It shows that, at any time, Alice can be in one of 4 possible "states" (S0 through S3).

At each state, Alice tosses her coin.

And depending on the outcome of the toss (H or T), she moves to a different state if needed.
11/

For example, S0 is the "start" state. It's where Alice starts her journey.

At S0, Alice tosses her coin.

If it comes up Heads, she follows the orange arrow from S0 (labeled "H"), which takes her to S1.
12/

At S1, Alice has seen a Heads, and is hoping for a Tails next (so she has her HT pattern).

If her toss at S1 comes up Tails, she goes to S2 -- her Win state; HT secured.

But if it comes up Heads instead, she follows the orange arrow from S1, which keeps her at S1 itself.
13/

That's all a Markov Chain is.

There's a bunch of states. At each state, a random event (like a coin toss) happens.

Based on the outcome of this random event, we follow the appropriate arrow to go to the next state.

Once at the next state, we rinse and repeat.
14/

Here's Bob's Markov Chain.

The difference between Alice and Bob is now clear.

When Bob is at S1 and gets unlucky (with a T), he has to "go back to zero" (S0) and start over.

Not so for Alice. Once Alice is at S1, she never ever has to go back to S0.
15/

That's why Bob takes longer!

From time to time, unlike Alice, Bob is forced to start from zero all over again. That's a drag.

Alice is like a drunk who either stays put or marches forward.

But Bob is like a drunk who also stumbles *backwards* on occasion.
16/

The nice thing about Markov Chains is that they allow us to quantify all this.

If we know the initial state (S0 for both Alice and Bob), we can calculate the probability of being in *any* state at *any* time.

There's a simple formula for this.
17/

This formula is "iterative".

That is, if we know the probability of being in each state at time "k" (ie, after "k" coin tosses), the formula gives us the probability of each state at the *next* time "k+1" (ie, after "k+1" coin tosses).
18/

It's quite simple.

We take the probabilities at time "k", and we pre-multiply them by a matrix (known as the Markov matrix or the Transition matrix).

This multiplication gives us the probabilities at time "k+1".

Like so:
19/

Here are the Markov matrices for Alice and Bob.

To get these matrices, we simply take the probability of each Markov Chain "arrow", and place it in the appropriate matrix slot according to the arrow's "From" and "To" states.
20/

Now, we can iterate.

Using repeated Markov matrix pre-multiplications, we get the probability of Alice and Bob being in every possible state at every possible time.

Like so (for times 0 through 4):
21/

At any time, if Alice or Bob has seen their target pattern, they'd be in S2 or S3.

So, we can see that after 4 coin tosses, Alice already has a Pr(S2) + Pr(S3) = 3/16 + 1/2 = 68.75% chance of being done.

But Bob only has a 50% chance of being done by that time.
22/

Getting the *average* time to completion is also not hard.

As "completion at, but not before, time k" is the same as "being in state S2 at time k", we have the following:
23/

So, that's the basic math of Markov Chains.

It's so simple. We move from state to state based on the outcome of chance events like coin flips.

And so powerful. Knowing just the initial state, we can exactly calculate the probability of being in *any* state at *any* time.
24/

So, what lessons can we learn from this exercise?

Key lesson 1. Probability often challenges our intuition.

That's why ~87% of FinTwit got my poll question wrong.

They relied on *intuition* rather than *math*.
25/

But chance and uncertainty are everywhere in life.

So, it's important to learn how to reason correctly about probabilistic situations -- using systematic mathematical techniques, *without* relying on our intuition.

As Charlie Munger puts it:
26/

Key lesson 2. As far as possible, we should avoid putting ourselves in situations where a single turn of bad luck could force us to start over from zero.

This was Bob's problem. That's why he took longer than Alice in our example.
27/

In investing, the equivalent is using too much leverage, naked options, trading on margin, etc.

By doing these things, we put ourselves in a position where short-term volatility and chance events could wipe us out, forcing us to essentially start from zero all over again.
28/

Key lesson 3. It's important to familiarize ourselves with "the classics" -- great ideas from multiple disciplines.

Markov Chains are not new; they date back to 1906.

But to this day, they're heavily used in various fields -- from engineering to biology.
29/

Such classic ideas that have withstood the test of time are often worthy of study.

They frequently help us think more clearly -- and thereby understand the world better.

They're good candidates for adding to our "latticework of mental models", as Charlie Munger puts it.
30/

One last thought.

Remember the game "Snakes and Ladders"?

That's a Markov Chain.

Each square on the board is a "state" we can be in. We transition between states based on random events (in this case, die rolls).

Once we know a concept, we start seeing it everywhere!
31/

Thank you very much for reading to the end of yet another long thread -- this one somewhat more mathematical than usual!

Please stay safe. Enjoy your weekend!

/End
ERROR:

In Tweet 14 above, I made a mistake in the picture showing Bob's Markov Chain.

The label on state S2 should have said "Seen HH", not "Seen HT". Corrected pic below.

Sorry about that! And many thanks to Rex Mayne (@r_mayne) for catching it and alerting me!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with 10-K Diver

10-K Diver Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @10kdiver

10 Apr
1/

Get a cup of coffee.

In this thread, I'll walk you through the basics of leverage -- in our personal lives and in the companies we invest in.
2/

Imagine we have an idea for a business.

To start the business, we need to put in $1M.

In return, the business will generate $250K for us every year -- for 10 years.

So, our upfront investment is $1M. But over the next 10 years, we get to take out $250K * 10 = $2.5M.
3/

This is an "unleveraged" annual return (IRR) of about 21.4%.

"Unleveraged" means we don't borrow any money.

That is, we use our own money for the initial $1M investment.

For more on IRRs and how to calculate them:
Read 29 tweets
3 Apr
1/

Get a cup of coffee.

In this thread, I'll tell you a story about a man and his dog.

This will help you think more clearly about volatility, risk, and the relationship between the two.
2/

This is Mr. Biswas Singh.

Friends call him "Biz".

He's 50 years old. He owns and operates several gas stations and convenience stores around town.
3/

This is Spock.

He's a 4 year old Golden Retriever who belongs to Biz.

He's a Good Boy.
Read 26 tweets
27 Mar
1/

Get a cup of coffee.

In this thread, I'll help you understand the connections between "earnings growth" and "return on capital".

This will help you analyze businesses better, and thus become a better investor.
2/

Imagine we have 2 businesses, S and F.

S is a Slow Growth business. Its earnings grow at 6% per year.

F is a (relatively) Fast Growth business. Its earnings grow at 9% per year.

Both businesses are trading at 15 times earnings.

Which is the better investment?
3/

We may be tempted to answer that F is the better investment.

After all, both S and F are trading at the same price (15 times earnings).

But with F, we get 9% growth -- compared to just 6% for S.

Sounds like a no-brainer.
Read 26 tweets
14 Mar
1/

Get a cup of coffee.

In this thread, I'll help you understand Lifestyle Creep, and why it's important to minimize it to the extent possible.

This will help you answer *the* most important question in all of personal finance: should you get that daily latte or not?
2/

As we get older, we tend to have more money.

At work, we become better skilled and more experienced at our jobs. So we get promotions and raises.

Also, our investment portfolios and 401(k)s become bigger -- as compounding starts to kick in.

So we feel richer.
3/

Over time, this feeling of being richer leads us to consume more (ie, spend more money).

We buy bigger houses. We drive nicer cars. We treat ourselves more often to nice meals at fine restaurants.

We splurge.
Read 39 tweets
6 Mar
1/

Get a cup of coffee.

In this thread, I'll show you a simple way to work out a fair price to pay for a wonderful business. Image
2/

As Buffett likes to say: Image
3/

So, whenever we buy a stock, it's a good idea to ask ourselves 2 questions:

a) Is this a wonderful business? And,

b) Is it available at a fair price?
Read 33 tweets
20 Feb
1/

Get a cup of coffee.

In this thread, I'd like to share with you a simple way to measure and track your progress towards financial independence.
2/

Financial independence is an end goal.

To define this goal properly, you need to answer 2 key questions.

(i) When would you consider yourself financially independent? And,

(ii) In how much time do you want to get there?
3/

Typically, financial independence means:

a) You won't have to work another day in your life for money, and

b) You and your family will still be able to live comfortably to the end of your days.
Read 40 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!