R/forecastfplsr.R

Defines functions forecastfplsr

Documented in forecastfplsr

forecastfplsr <- function(object, components, h)
{
	xname = object$xname
	yname = object$yname
	foreca = matrix(, length(object$x), h)
	data = object
	for(i in 1:h)
	{
		fore = fplsr(data, order = components)$Ypred
		foreca[,i] = fore$y
		newdata = cbind(data$y, fore$y)
		colnames(newdata) = as.numeric(colnames(data$y))[1]:(max(as.numeric(colnames(data$y))) + 1)
		data = fts(data$x, newdata)
	}
	colnames(foreca) = (max(as.numeric(colnames(object$y)))+1):(max(as.numeric(colnames(object$y)))+h)
	forecafts = fts(object$x, foreca, xname = xname, yname = yname)
	return(forecafts)
}

Try the ftsa package in your browser

Any scripts or data that you put into this service are public.

ftsa documentation built on Jan. 13, 2021, 6:21 p.m.