Filtered inference of operative latent states in Markov-switching dynamic regression data

returns filtered state probabilities `FS`

= filter(`Mdl`

,`Y`

)`FS`

from conducting optimal conditional inference of the probabilities of the operative latent states in the regime-switching data `Y`

. The Markov-switching dynamic regression model `Mdl`

models the data. `filter`

uses a recursive application of Bayes' rule, as in Hamilton [3].

uses additional
options specified by one or more name-value pair arguments. For example, `FS`

= filter(`Mdl`

,`Y`

,`Name,Value`

)`'Y0',Y0`

initializes the dynamic component of each submodel by using the presample response data `Y0`

.

`filter`

proceeds iteratively from an initial estimate of the state distribution `S0`

to estimates in `FS`

by using forecasts from the current data history at each time step. `smooth`

refines current estimates of the state distribution that `filter`

produces by iterating backward from the full sample history `Y`

.

[1]
Chauvet, M., and J. D. Hamilton. "Dating Business Cycle Turning Points." In *Nonlinear Analysis of Business Cycles (Contributions to Economic Analysis, Volume 276)*. (C. Milas, P. Rothman, and D. van Dijk, eds.). Amsterdam: Emerald Group Publishing Limited, 2006.

[2]
Hamilton, J. D. "A New Approach to the Economic Analysis of Nonstationary Time Series and the Business Cycle." *Econometrica*. Vol. 57, 1989, pp. 357–384.

[3]
Hamilton, J. D. "Analysis of Time Series Subject to Changes in Regime." *Journal of Econometrics*. Vol. 45, 1990, pp. 39–70.

[4]
Hamilton, J. D. *Time Series Analysis*. Princeton, NJ: Princeton University Press, 1994.