Computes, for each time *t*, the conditional probabilities for MSAR models *P(Y_t|y_{1:(t-1)})* where *Y* is the observed process and *y* the observed time series.

1 | ```
forecast.prob.MSAR(data, theta, yrange = NULL, covar.emis = NULL, covar.trans = NULL)
``` |

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

`theta` |
object of class MSAR including the model's parameter and description. See init.theta.MSAR for more details. |

`yrange` |
values at which to compute the forecast probabilities |

`covar.emis` |
emission covariate if any. |

`covar.trans` |
array of univariate or multivariate series of covariate to take into account in the transition probabilities. The link function is defined in the initialisation step (running init.theta.MSAR.R). |

A list containing

`..$yrange ` |
abscissa for the forecast probabilities |

`..$prob ` |
forecast probabilities |

`Yhat` |
forecasted value |

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

prediction.MSAR

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ```
## 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)
#FP = forecast.prob.MSAR(data,res.hh.2$theta)
#plot(data[,1,],typ="l")
#lines(FP$Yhat[,1],col="red")
#alpha = .1
#IC.emp = matrix(0,2,T)
#for (k in 1:length(data[,1,])) {
# tmp = cumsum(FP$prob[,k,1])/sum(FP$prob[,k,1])
# IC.emp[1,k] = FP$yrange[max(which(tmp<alpha/2))]
# IC.emp[2,k] = FP$yrange[max(which(tmp<(1-alpha/2)))]
#}
#lines(IC.emp[1,],lty=2,col="red")
#lines(IC.emp[2,],lty=2,col="red")
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.