This function implements the dating algorithm of Bry and Boschan (1971) to identify Bull and Bear states
run_dating_alg(index)vector containing the stock price index
A logical vector that contains TRUE for Bull states and FALSE for Bear states
Bry, G. and Boschan, C. (1971). Cyclical Analysis of Time Series: Selected Procedures and Computer Programs. NBER.
Pagan, A. R. and Sossounov, K. A. (2003). A Simple Framework for Analysing Bull and Bear Markets. Journal of Applied Econometrics, 18 (1), 23-46.
Gonzalez, L., Powell, J. G., Shi, J., and Wilson, A. (2005). Two Centuries of Bull and Bear Market Cycles. International Review of Economics and Finance, 14 (4), 469-486.