# One step ahead predict for (non) homogeneous MSAR models

### Description

computes one step ahead predict for (non) homogeneous MSAR models. A time series is given as input and a prediction is return for each time. These function is mainly usefull for cross-validation.

### Usage

1 | ```
prediction.MSAR(data, theta, covar.emis = NULL, covar.trans = NULL, ex = 1)
``` |

### Arguments

`data` |
observed time series, array of dimension T*N.samples*d |

`theta` |
object of class MSAR including the model's parameter |

`covar.emis` |
covariate for emissions (if needed) |

`covar.trans` |
covariate for transitions (if needed) |

`ex` |
numbers of samples for which prediction has to be computed |

### Value

Returns a list with the following elements:

`y.p` |
the one step ahead prediction for each time of data time series |

`pr` |
the prediction probabilities for each regime |

### Author(s)

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

### See Also

Cond.prob.MSAR

### Examples

1 2 3 4 5 6 7 8 9 10 11 | ```
## Not run
#data(meteo.data)
#data = array(meteo.data$temperature,c(31,41,1))
#T = dim(data)[1]
#N.samples = dim(data)[2]
#d = dim(data)[3]
#M = 2
#theta.init = init.theta.MSAR(data,M=M,order=2,label="HH")
#res.hh.2 = fit.MSAR(data,theta.init,verbose=TRUE,MaxIter=200)
#y.p.2 = prediction.MSAR(data,res.hh.2$theta,ex=1:N.samples)
#RMSE.2 = mean((data-y.p.2)^2)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.