This is a brain teaser. You've been warned.
The S&P 500 is in a bear market (defined as the 50-day MA being below the 200-day MA) 30.8% of the time. Also, the S&P 500 has experienced single-day 4% declines 0.242% of the time. Of the times we experienced single-day selloffs exceeding 4%, 75.7% of the time we were in a bear market.
How much more likely are we to experience single-day losses exceeding 4% now that we're in a bear market, compared to the likelihood of such an event in a bull market?
Odds are you stopped reading this puzzle after the first three sentences. In the unlikely event that you're still with me, I've created a link to some code that holds the answer. It's a prolog script whose knowledge-base is derived from data-mining in R.
This comment has been removed by the author.
ReplyDeleteMy guess:
ReplyDeleteUsing Bayes' rule, it is 0.5948 % i.e. more than double the usual
p(Bear) = 30.8%
P(Decline) = 0.242%
p(Bear|Decline) = 75.7%
p(Decline|Bear) *p (Bear) = p(Bear|Decline) * P(Decline)
=> P(Decline|Bear)
= 75.7 * 0.242
------------
30.8
How much more likely are we to experience single-day losses exceeding 4% now that we're in a bear market?
ReplyDelete@Ravi the answer is in the form of ...
We are n times more likely to experience a single-day loss exceeding 4% in a bear market.
@Ravi, I see you actually did approximate your answer. You achieved the correct numerator. I could have asked the question a little better though. I was meaning to compare two regimes and should have specified the differences between the two unique states versus a unique state and the entire universe ...
ReplyDeleteLet me rephrase the question in the original post, and thanks for your answer. Did you extract Bayes from the code? Prolog reads like a sentence.
Thanks for sharing the puzzles, posts and R code. It has been motivating for me to follow along.
ReplyDeleteI can't read prolog though. I just did Bayes' from the machine learning books.
All the best and keep the posts coming.
Doing bayes by the book (no clue about prolog I'm afraid), the reasoning I followed was identical to Ravi's:
ReplyDeleteP(Decline | Bear) = P(Bear | Decline)*P(Decline)/P(Bear)
=> 0.757*0.0242/0.308 = 5,94%
P(Decline | Bull) = ( 1 - P(Bear | Decline) )*P(Decline)/( 1 - P(Bear) )
=> (1-0.757)*0.0242/(1-0.308) = 8,49%
Which means that
P(Decline | Bull) / P(Decline | Bear) = 0.69 (?)
Did I break something!? Or am i just dullwitted with Bayes.
Your posts are awesome, Milk.
Correction uno, P(Decline | Bull) / P(Decline | Bear) = 0.69 (?) i wrote it the other way around.
ReplyDeleteCorrection dos its 0.242% not 2.42% like my calculation implies.
But two wrongs make a right and the factor of 10 that I misplaced in 0.00242 gets cancelled in the final division anyway.
And finally i cannot for the life of me decipher the prolog.
@Adri you have the correct equations for P(Decline | Bear) and for P(Decline | Bull), including the correct numbers up to the "=" sign. I copied your equation into an R console and got the same answer that the Prolog code generates.
ReplyDeleteBut the answer is not 0.69.
Also, your correction uno is identical to the original error.
Making these simple errors are very easy to do, and that's why I organized the Prolog code the way I did. It's still possible to encode the wrong numbers, but less likely to inflict simple errors.
You are also correct to say that the 0.242 error, since it was duplicated, cancelled itself out. And this is disturbing to me.
Cheers.
Thanks!
ReplyDeleteYou live and you learn (how to use a calculator)
Second time lucky perhaps?
P(decline | bear)=0.5947%
P(decline | bull)=0.0849%
Making it 7 times more likely to experience a decline in a bear market than in a bull market.
I'm far away from an R console I'm afraid, on a cramped mobile browser making calculations in the sand (and botching them in google's calculator).
Thanks again and I look forward to your next post
Adri
@Adri, Yes! Fine work indeed.
ReplyDelete