我现在打算写一个dating algorithm (Lunde and Timmermann(2004)),这个dating algorithm在 Components of Bull and Bear markets: bull corrections and bear rallies(J. Maheu, T. McCurdy and Yong Song; working paper) 也用到过。
The Lunde and Timmermann (2004) dating algorithm defines a binary market indicator
variable It which takes the value 1 if the stock market is in a bull state at time t
and 0 if it is in a bear state. The stock price at the end of period t is labelled Pt. Our
application of their dating algorithm can be summarized as: use a 6-month window to
locate the initial local maximum or minimum.
Suppose we have a local maximum at time t0, in which case we set Pmaxt0 = Pt0 .
1. Define stopping-time variables associated with a bull market as τmax(Pmaxt0 , t0 | It0 = 1) = inf {t0 + τ : Pt0+τ ≥ Pmaxt0} τmin(Pmaxt0 , t0 | It0 = 1) = inf {t0 + τ : Pt0+τ ≤ 0.8Pmaxt0}
2. One of the following happen. • If τmax < τmin, bull market continues, update the new peak value Pmaxt0+τmax = Pt0+τmax discard previous peak at time t0 and set It0+1 = · · · It0+τmax = 1. Go
to 2 above. • If τmax > τmin, we find a trough at time t0 + τmin and we have been in a bear
market from t0 + 1 to t0 + τmin, It0+1 = · · · = It0+τmin = 0. Record the value Pmint0+τmin = Pt0+τmin and mark time t0 as one peak. Go to 1 below for bear
market.
On the other hand suppose t0 is a local minimum.
1. Bear market stopping times are τmin(Pmint0 , t0 | It0 = 0) = inf{t0 + τ : Pt0+τ ≤ Pmint0} τmax(Pmint0 , t0 | It0 = 0) = inf{t0 + τ : Pt0+τ ≥ 1.2Pmint0}
2. One of the following happens. • If τmin < τmax, bear market continues, update the trough point forward, Pmint0+τmin = Pt0+τmin discard previous trough value at time t0 and set It0+1 = · · · = It0+τmin = 0. Go to 1. • If τmin > τmax we have a peak at t0 + τmax and have been in a bull market
from t0 + 1 to t0 + τmax, It0+1 = · · · = It0+τmax= 1. Record the value Pmaxt0+τmax = Pt0+τmax
and mark time t0 as a trough and go to 1 above for the
bull market.
This process is repeated until the last data point.