# M step of the EM algorithm.

### Description

M step of the EM algorithm for fitting Markov switching auto-regressive models with non homogeneous transitions.

### Usage

1 2 3 |

### Arguments

`data` |
array of univariate or multivariate series with dimension T*N.samples*d. T: number of time steps of each sample, N.samples: number of realisations of the same stationary process, d: dimension. |

`theta` |
model's parameter; object of class MSAR. See also init.theta.MSAR. |

`FB` |
Forward-Backward results, obtained by calling Estep.MSAR function |

`covar` |
transitions covariates |

`method` |
permits to choice the optimization algorithm. default is "ucminf", other possible choices are "BFGS" or "L-BFGS-B" |

`sigma.diag` |
if TRUE the innovation covariance matrices are diagonal. |

`reduct` |
if TRUE, autoregressive matrices and innovation covariance matrices are constrained to have the same pattern (zero and non zero coefficients) as the one of initial matrices. |

`ARfix` |
if TRUE the AR parameters are not estimated, they stay fixed at their initial value. |

`lambda1` |
penalization constant for the precision matrices. It may be a scalar or a vector of length M (with M the number of regimes). If it is equal to0 no penalization is introduced for the precision matrices. |

`lambda2` |
penalization constant for the autoregressive matrices. It may be a scalar or a vector of length M (with M the number of regimes). If it is equal to0 no penalization is introduced for the atoregression matrices. |

`penalty` |
choice of the penalty for the autoregressive matrices. Possible values are ridge, lasso or SCAD (default). |

`par` |
allows to give an initial value to the precision matrices. |

### Value

List containing

`..$A0` |
intercepts |

`..$A` |
AR coefficients |

`..$sigma` |
variance of innovation |

`..$prior` |
prior probabilities |

`..$transmat` |
transition matrix |

`..$par.trans` |
transitions parameters |

### Author(s)

Valerie Monbet, valerie.monbet@univ-rennes1.fr

### References

Ailliot P., Monbet V., (2012), Markov switching autoregressive models for wind time series. Environmental Modelling & Software, 30, pp 92-101.

### See Also

fit.MSAR, init.theta.MSAR, Mstep.hh.MSAR