Learn R Programming

NHMSAR (version 1.19)

prediction.MSAR: 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

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

var.p

the associated variance

pr

the prediction probabilities for each regime

See Also

Cond.prob.MSAR

Examples

Run this code
# NOT RUN {
## 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$y.p)^2)
# }

Run the code above in your browser using DataLab