Learn how to carry out a Markov switch model in Stata using the mswitch dr command.
The following code will come in handy for this tutorial:
set seed 1234
set obs 1000
gen try = runiform(2,4) + runiform(0,1)
replace try = try+0.5 in 501/1000
gen day = _n
tsset day
regress try day
estat sbsingle
tsline try, xline(501)
mswitch dr try
predict prfed pr