lforecast: Compute long term forecasts.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/preprocess.R

Description

Performs multi-step forecasts by iteratively using 1-ahead predictions as inputs

Usage

1
lforecast(M, data, start, horizon)

Arguments

M

fitted model, the object returned by fit.

data

training data, typically built using CasesSeries.

start

starting period (when out-of-samples start).

horizon

number of multi-step predictions.

Details

Check the reference for details.

Value

Returns a numeric vector with the multi-step predictions.

Author(s)

Paulo Cortez http://www3.dsi.uminho.pt/pcortez

References

See Also

fit, CasesSeries, predict.fit, mgraph.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ts=c(1,4,7,2,5,8,3,6,9,4,7,10,5,8,11,6,9)
d=CasesSeries(ts,c(1,2,3))
M=fit(y~.,d[1:7,],model="mlpe",search=2)
P1=predict(M,d[8:14,]) # single-step predictions
P2=lforecast(M,d,8,7) # multi-step predictions, horizon=7
print(mmetric(d$y[8:14],P1,"MAE"))
print(mmetric(d$y[8:14],P2,"MAE"))
L=vector("list",2); pred=vector("list",1);test=vector("list",1)
pred[[1]]=P1; test[[1]]=d$y[8:14]; L[[1]]=list(pred=pred,test=test,runs=1)
pred[[1]]=P2; test[[1]]=d$y[8:14]; L[[2]]=list(pred=pred,test=test,runs=1)
mgraph(L,graph="REG",Grid=10,leg=c("y","P1","P2"),col=c("black","cyan","blue"))
mgraph(L,graph="RSC",Grid=10,leg=c("P1","P2"),col=c("cyan","blue"))

rminer documentation built on Dec. 16, 2019, 5:41 p.m.