Displaying 1 result from an estimated 1 matches for "f_s1".
Did you mean:
f_1
2011 Dec 01
1
Estimation of AR(1) Model with Markov Switching
...ity of the markov chain
# use unconditional probabilities
p0_s0 <- (1 - p_s1_s1) / (2 -p_s0_s0 -p_s1_s1)
p0_s1 <- 1-p0_s0
# create variables
p_s0_t_1 <- rep(0, nrow(X))
p_s1_t_1 <- rep(0, nrow(X))
p_s0_t <- rep(0, nrow(X))
p_s1_t <- rep(0, nrow(X))
f_s0 <- rep(0,nrow(X)-1)
f_s1 <- rep(0,nrow(X)-1)
f <- rep(0,nrow(X)-1)
logf <- rep(0, nrow(X)-1)
p_s0_t[1] <- p0_s0
p_s1_t[1] <- p0_s1
# initiate hamilton filter
for(i in 2:nrow(X)) {
# calculate prior probabilities using the TPT
# TPT for this example gives us
# p_si_t_1 = p_si_t_1_si * p_si_t + p_si_t_1...