0

The company I work for is testing the forecasting ability of new software. One package takes the orders for a single product from multiple locations, sums them at each period, then develops a model, which it then uses on each location. For example, if in a 6 month period location A orders the product as follows (1,0,2,3,0,3), and B orders the same product as (2,3,4,2,5,1), then the software will develop a model based on the data A+B=(3,3,6,5,5,4) and apply that model to the data in A and B separately to determine the value at month 7.

I want to try and validate (or invalidate) their approach, by using R. I've created a series of Single Exponential Smoothing models (called ssforecasts) and want to use the models on new location data as follows:

ss<-c(29,36,36,48,93,28,35,28,37,50,37,3,25,28,40,45,38,43,34,44,43,25,33,34)
ss2<-t(ss)
for (i in 1:12){
  sseries<-ts(ss2[c(i:(11+i))],frequency=12)
  ssforecasts <- HoltWinters(sseries, beta=FALSE, gamma=FALSE)
  newss <- ts(c(3,3,1,4,1,3,8,0,4,3,3,0),frequency=12)
  predict(ssforecasts,t(newss))
}

where newss is the location data that I want the model (ssforecasts) to act on. The problem is I get the following error, which I can't interpret.

Error in rep(as.vector(object$coefficients[1L]), n.ahead) : invalid 'times' argument

Angus
  • 355
  • 2
  • 12
  • This may give you some inspiration - https://stackoverflow.com/questions/35478548/error-in-rep-invalide-times-argument . – Hatt Sep 06 '18 at 13:52
  • I'm actually wondering if maybe I've got the whole concept wrong. Can I actually use a model to forecast on new data? – Angus Sep 06 '18 at 14:28
  • 1
    From the help on `predict.HoltWinters` it only appears one can forecast into the future and not with new data. – Dave2e Sep 06 '18 at 18:37
  • That's what I thought. I assume the company then determines the best "Type" of model and not the best model. Confusing literature, but I should have known better. – Angus Sep 06 '18 at 20:54

0 Answers0