# Cond.prob.MSAR: Conditional probabilities for (non) homogeneous MSAR models In NHMSAR: Non-Homogeneous Markov Switching Autoregressive Models

## Description

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

## Usage

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

## Arguments

 `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 conditional probabilities `covar.emis` emission covariate if any. `covar.trans` transition covariate if any.

## Value

a list including

 `..\$yrange` values at which the conditional probabilities are computed `..\$prob` conditional probabilities for each time t and each values of yrange `..\$Yhat` mode of the conditinal distribution for each time t

## Author(s)

Valerie Monbet, [email protected]

predict.MSAR

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47``` ```data(lynx) data = array(log10(lynx),c(length(lynx),1,1)) T = length(data) theta.init = init.theta.MSAR(data,M=2,order=2,label="HH") mod.lynx.hh = fit.MSAR(data,theta.init,verbose=TRUE,MaxIter=200) ex = 100:114 lex = length(ex) tps = (1821:1934)[ex] CP = Cond.prob.MSAR(array(data[ex,,],c(lex,1,1)), mod.lynx.hh\$theta) par(mfrow=c(2,1)) plot(tps,data[ex],typ="l",main="Homogeneous MSAR model",xlab="Time",ylab="Captured") lines(tps,CP\$Yhat,col="red") alpha = .05 IC.emp = matrix(0,2,lex) for (k in 1:lex) { tmp = cumsum(CP\$prob[,k,])/sum(CP\$prob[,k,]) IC.emp[1,k] = CP\$yrange[max(c(which(tmp

NHMSAR documentation built on Dec. 5, 2017, 9:03 a.m.