Part of the work of being a trainer is that I am relatively free to pursue some research to improve on my training materials so I got back to some R programming this week.
My statistical programming is rusty again and I have to get back to the basics of understanding data frames and how to put simple packages in my R Studio. And this means dealing with some stuff that professionals find trivial like manipulation of dates and processing the finance data from Yahoo Finance.
Fortunately, I was able to get some useful thing done within the last 2 days. I downloaded historical STI information and was able to measure the duration of market crashes.
I wrote a simple program in R to track crashes on the STI.
This program adopts the following rules :
- A crash occurs when the market dips 30% from the previous market peak.
- The timing of the start of the crash will then be set at the timing of the market peak.
- A recovery occurs when the market goes up 30% from the previous market trough.
- The timing of the market recovery will then be set to the timing of the market trough.
Unfortunately, I can only fetch market data as far back as 1987.
My program them screen dumps the crash data, which I reproduce here.
------
Crash from 1607.1 To 1079.5
From date:
1990-03-27
Recovery at date :
1990-10-11
------
Crash from 2493.7 To 1073.5
From date:
1996-02-06
Recovery at date :
1998-01-12
------
Crash from 1698.8 To 805.04
From date:
1998-03-19
Recovery at date :
1998-09-04
------
Crash from 2582.94 To 1241.29
From date:
2000-01-03
Recovery at date :
2001-09-21
------
Crash from 1808.41 To 1213.82
From date:
2002-03-19
Recovery at date :
2003-03-10
------
Crash from 3875.77 To 1456.95
From date:
2007-10-11
Recovery at date :
2009-03-09
From this dump, we can safely say that the longest period that we will need to endure from a market peak to market trough is 2 years. The longest period is not our most recent recession on 2007, but during 1996-1998 when we had the Asian Currency Crises.
My R program allows me to vary the conditions of a crash. If I set a crash to be 10% from a market peak and a recovery to be 10% from a market trough, I will, of course, see a lot more crashes in my program output but with a shorter duration.
Moving forward, this program will be added to my list of teaching materials for my workshop.
And in case you are wondering, we are not in a crash situation yet.
Over the next few weeks, I will be trying to determine whether an objective asset allocation between stocks and bonds would exist. Will post my findings here.
Hmm your definition of recovery being +30% from the trough understates major recessionary periods --- becoz Singapore market goes down much more than 30% on the down leg.
ReplyDeleteI would consider recovery time as simply the time taken to get back to the previous high, with dividends reinvested. Btw with dividends reinvested Singapore stocks in general have exceeded their 2007 high, even though the STI is still below it.
Maybe you can use the MSCI S'pore TR Net data from their web site.
Hi chris
ReplyDeleteCan you do a correlation analysis between STI ETF, compared to HK index, China index and US index? Your analysis is indeed insightful!
Gimme a day or two, i already have some code for this.
ReplyDeleteMy rule of thumb is that it takes 1yr for the market peak to trough. Maybe it is more useful to look at when one shd enter the stock market after market has peaked
ReplyDelete