Solved – the best forecasting model for time series data

forecastingrtime series

I have a time series data (1 minute and sometimes 5 minute data) data I would like use forecasting package to forecast couple hours ahead.

Here is my data:

dput(head(p,20))
structure(list(time = structure(c(1373889420, 1373889480, 1373889540, 
1373889600, 1373889660, 1373889720, 1373889780, 1373889840, 1373889900, 
1373889960, 1373890020, 1373890080, 1373890140, 1373890200, 1373890260, 
1373890320, 1373890380, 1373890440, 1373890500, 1373890560), class = c("POSIXct", 
"POSIXt"), tzone = "America/New_York"), cpu = c(2.25892, 2.04144, 
5.04823333333333, 4.9947, 1.72982857142857, 4.82655, 3.6168625, 
4.7357, 2.42683333333333, 3.62635, 5.02315714285714, 2.57147142857143, 
7.16005, 2.34253333333333, 2.82315714285714, 5.17668, 2.2899375, 
6.92, 5.172375, 4.63735), name = c("servers", "servers", "servers", 
"servers", "servers", "servers", "servers", "servers", "servers", 
"servers", "servers", "servers", "servers", "servers", "servers", 
"servers", "servers", "servers", "servers", "servers")), .Names = c("time", 
"cpu", "name"), row.names = c(1116L, 1411L, 123L, 226L, 1014L, 
435L, 538L, 569L, 1081L, 342L, 74L, 865L, 178L, 890L, 281L, 166L, 
1035L, 143L, 112L, 91L), class = "data.frame")

x.xts <- xts(p$cpu, p$time)
x.ts <- as.ts(x.xts)
x.ets <- ets(x.ts)
x.fore <- forecast(x.ets, h=120)
f<-data.frame(x.fore$mean)
    DateTime<-tail(z,1)$time
f$DATE <- DateTime + 60 * (seq_len(nrow(f))-1)
    colnames(f)<-c("cpu", "time")
    f$name<-c("forecast")

I see that cpu is the same for all future data times:

 cpu                time     name
1 6.020207 2013-07-15 11:57:00 forecast
2 6.020207 2013-07-15 11:58:00 forecast
3 6.020207 2013-07-15 11:59:00 forecast
4 6.020207 2013-07-15 12:00:00 forecast
5 6.020207 2013-07-15 12:01:00 forecast
6 6.020207 2013-07-15 12:02:00 forecast

Is there a better forecasting model besides ets for time series data?

Best Answer

Yes, this looks good. There is no pattern within the data to be extracted. It is all "noise" so a flat forecast is fine.

Now, if you want to correct for the two outliers at period 13 and 18 then no it wouldn't be good. Are these outliers?? Also, do you have any causal variables that explain the Y?

Related Question