search for: p_s1_s0

Displaying 1 result from an estimated 1 matches for "p_s1_s0".

Did you mean: p_s1_s1
2011 Dec 01
1
Estimation of AR(1) Model with Markov Switching
...ults would be welcome. Given below is my R code # markov switching regime model # generate data for a AR(1) markov switching model with the following pars # state 0: y_t = 2 + 0.5 * y_{t-1} + e_t # state 1: y_t = 0.5 + 0.9 * y_{t-1} + e_t # where e_t ~ N(0,1) # transition probabilities p_s0_s1 = p_s1_s0 = 0.20 # generate realisations of the state gamma_s0 <- qnorm(0.8) gamma_s1 <- qnorm(0.2) gamma <- rep(0,100) state <- rep(0,100) # choose initial state at t=0 to be state 0 gamma[1] <- gamma_s0 state[1] <- 0 for(i in 2:100) { if(rnorm(1) < gamma[i-1]) { gamma[i] <...