For the full likelihood conditional on the regimes we obtain, using (4.3) and (4.6)
T
L(X|St,λ) = l(Xp∣Sp,λ) ∏ l(xt∣St,X-ι,λ). (4.7)
t=p+1
Integrating over all possible states gives the unconditional likelihood
T
L(X∣λ) = l(Xp∣λ) ∩ l(xt∣X-ι,λ). (4.8)
t=p+1
4.1.2 Generating the Regimes S using Gibbs-Sampling
We generate the regimes S with the help of multi-move Gibbs sampling. The idea is to obtain
the T elements in S within one draw conditional on λ and the observed data X . The starting
point is to make use of the structure of the underlying Markov chain. The density of the regimes
p(S ∣X, λ) can easily be rearranged in a multiplicative relationship as
p(S∣X, λ) = p(S1,... ,ST∣X,λ)
= p(ST ∣X, λ)p(ST -1,... ,S1∣ST,X-1,λ)
= p(ST ∣X, λ)p(ST -1∣ST, X-1, λ)p(ST -2,... ,S1∣ST-1,X-2,λ)
T-1
= p(Sτ∣X,λ) ∏p(St∣St+ι,xt,λ). (4.9)
t=1
Knowing p(ST ∣X, λ) and p(St∣St+1, xt, λ) we could first draw ST. Conditional on ST it would
then possible to obtain ST-1, and again conditional on ST-1 we could draw ST-2 etc.
With some algebra one can show that
pijp(St = i∣xt,λ)
p(St i|St+1 j,xt,λ) k-^k /a I w' (4.10)
z=1 pzjp(St = z∣xt, λ)
That means that given the matrix of transition probabilities P, it only requires P(St∣xt, λ)
to compute p(St∣St+1, xt, λ). p(St∣xt, λ) can in turn be determined using the filter proposed by
Hamilton (1989). This procedure demands initial values for S0. We will briefly outline in the
following how these may reasonably be chosen.
4.1.3 Deriving the Initial Probabilities
Using the filter of Hamilton (1989) to compute p(ST ∣X, λ) requires initial values for p(S0∣X). By
assuming that the economy was in a steady state in t = 0, we may use steady-state probabilities
for p(S0 ∣X). The general condition for a steady-state probability is given by
P ∙ p(So∣X)= p(So∣X),
16
(4.11)