# Simple replication of Hamilton (1989) as in
# Kim and Nelson (1999: 79, 220)
data(HamiltonGDP)
set.seed(1)
m2 <- msvar(HamiltonGDP, p=1, h=2, niterblkopt=20)
# Now plot the filtered probabilities of a recession
# Compare to Kim and Nelson (1999: 79, 220)
fp.rec <- ts(m2$fp[,1], start=tsp(gdp)[1], freq=tsp(gdp)[3])
plot(fp.rec)Run the code above in your browser using DataLab