"forecast" <- function(m1,rt,orig,h,xre=NULL){ # m1: is a model object # orig: is the forecast origin # rt: the time series # xre: the independent variables # h: forecast horizon # # If requires the library fSeries or FinTS regor=c(m1$arma[1],m1$arma[6],m1$arma[2]) seaor=list(order=c(m1$arma[3],m1$arma[7],m1$arma[4]),perioa=m1$arma[5]) T=length(rt) if(orig > T)orig=T x=rt[1:orig] mm=arima(x,order=regor,seasonal=seaor,xreg=xre) fore=predict(mm,h) pred=fore$pred se=fore$se print(pred) print(se) forecast<-list(origin=orig,pred=pred,se=se) }