3

So I'm trying to apply an exponential smoothing model to each column in a data frame called 'cities'. I have used apply to identify the data frame, go by columns, and I thought to run the model. However, when I try to do so, it tells me that I need to specify data for the exponential smoothing model...I thought I already had by putting it in the apply loop.

apply(x=cities,2,FUN=HoltWinters(x=x,gamma=FALSE))

Also, eventually I'd like to predict the next 4 periods using the HW model developed using forecast.predict. Do I need to use a different loop or can I combine it all in this one?

4

1 に答える 1

4

FUNを取りfunctionますが、関数の出力を与えようとしています。これを試して:

apply(cities, 2, FUN=function(x) HoltWinters(x=x,gamma=FALSE))
于 2012-08-01T20:44:01.467 に答える