Fit autoregressive Markov switching models to a univariate time series using the package MSwM.
MSM.fit(y, p, nregime = 2, include.mean = T, sw = NULL)
MSM.fit
returns an object of class codeMSM.lm or MSM.glm
, depending on the input model.
a time series.
AR order.
the number of regimes.
a logical value for including constant terms.
logical values for whether coefficients are switching. The length of sw
has to be equal to the number of coefficients in the model plus include.mean.