(This article was first published on Timely Portfolio, and kindly contributed to R-bloggers)
When I spotted the bfast R package, I could not resist attempting to apply it to identify bull and bear markets. For all the details that I do not understand, please see the references:
I believe the result on the S&P 500 (even with a high h and only one iteration) is a fairly close marker for bull and bear markets, and I thoroughly enjoyed applying forestry techniques to financial time series.
![]() |
| From TimelyPortfolio |
![]() |
| From TimelyPortfolio |
![]() |
| From TimelyPortfolio |
To leave a comment for the author, please follow the link and comment on his blog: Timely Portfolio.
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...




Zero Inflated Models and Generalized Linear Mixed Models with R.
Zuur, Saveliev, Ieno (2012).