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 …