Parameterization hourly data in cycle for in forecasting problem

I try to explain my programming problem.

Dataset : 26 variables, 1176 hourly values

Goal : Find optimal method to forecast next 24 values .

I separated my historical data in training and test dataset in this way

trdata<-Database[c(1:744),] # Training data

testdata<-Database[c(745:1176),] # Test data

I want use a "for"cycle trying to find the optimal model based on AICc values, following this link . Or MSE values. But I am opened to other solutions

The models that I want to compare are tbats, arima and ets. Maybe later I'll try to use also neural network or svm, but for the moment I want to solve this programming pb. Starting from the work here, I write my comments in bold in arima case

h <- 24

train <- window(Database,end=1989.99)

test <- window(Database,start=1990)

maybe it's easy question but here I'm not able to separate hourly data in this way, with start/end command. ADVISES?

n <- length(test) - h + 1

fit <- auto.arima(train)

order <- arimaorder(fit)

fcmat <- matrix(0, nrow=n, ncol=h)

for(i in 1:n)

  x <- window(Database$Var1, end=1989.99 + (i-1)/12)

  xregt<-window(cbind(Database$Var1,Database$Var2,Database$Var3), end=??)

The previous comment is clear here, where i need to parameterize respect i both x and xreg

  refit <- Arima(x,, xreg=xregt, order=order[1:3], seasonal=24)

  fcmat[i,] <- forecast(refit, h=h)$mean


I think that when this parametrization pb in for cycle has been solved, I'll write a quite similar code for tbats (no regressor) and ets

Thank you very much in advance for your time, I hope I have made it clear.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.