Description Usage Arguments Details Value Author(s) References See Also Examples

`msmFit`

is an implementation for modeling Markov Switching Models using the EM algorithm

1 |

`object` |
an object of class "lm" or "glm", or "formula" with a symbolic description of the model to be fitted. |

`k` |
numeric, the estimated number of regimes that the model has. |

`sw` |
a logical vector indicatig which coefficients have switching. |

`p` |
integer, the number of AR coefficients that the MS model has to have. The default value is zero. If |

`data` |
an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the environment from which "glm" is called. |

`family` |
a character value indicating what family belongs to the model. It is only required when the object is a "General linear formula". |

`control` |
a list of control parameters. See "Details". |

The `control`

argument is a list that can supply any of the following components:

-`trace`

: A logical value. If it is TRUE, tracing information on the progress of the optimization is produced.

-`maxiter`

: The maximum number of iterations in the EM method. Default is 100.

-`tol`

: Tolerance. The algorithm stops if it is unable to reduce the value by a factor of `tol`

at a step. Default is 1e-8.

-`maxiterOuter`

: The number of short runs of the EM method to stablish the initial values. Default is 5

-`maxiterInner`

: The number of iterations in the EM method in each short run to stablish the initial values. Default is 10

-`parallelization`

: A logical value. Whether the process is done by using parallelization or not. Default is TRUE.

`msm.fit`

returns an object of class `MSM.lm`

or `MSM.glm`

, depending on the input model.

Jose A. Sanchez-Espigares, Alberto Lopez-Moreno

Hamilton J.D. (1989). A New Approach to the Economic Analysis of Nonstionary Time Series and the Business Cycle. Econometrica 57: 357-384

Hamilton, J.D. (1994). Time Series Analysis. Princeton University Press.

Goldfeld, S., Quantd, R. (2005). 'A Markov model for switching Regression',Journal of Econometrics 135, 349-376.

Perlin, M. (2007). 'Estimation, Simulation and Forecasting of a Markov Switching Regression', (General case in Matlab).

Overview: `MSwM-package`

Classes : `MSM.lm`

, `MSM.glm`

, `MSM.fitted`

Methods : `msmFit`

,`summary`

,`AIC`

,`intervals`

,`msmResid`

Plot : `plot`

,`plotProb`

,`plotReg`

,`plotDiag`

1 2 3 4 5 6 | ```
## Not run
## data(energy)
## model=lm(Price~Oil+Gas+Coal+EurDol+Ibex35+Demand,energy)
## mod=msmFit(model,k=2,sw=rep(TRUE,8))
## summary(mod)
## End(Not run)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.