Indirect Estimation of Markov Switching Models with Endogenous Switching