Avoid negative results in Holt Winters forecasting

I understood that Holt Winters forecasting may results in negative values due to trending. I did reduce trending component value, but still forecast values are negative territory. Our data set will never be in negative values (like electricity data set, which never falls below ZERO).

What sort of post algorithm techniques we can apply to make this value as non-negative value? Any help would be appreciated.

This implementation is in Java, so I can't use ets() package at this point of time (and I am assuming ets() also can't avoid negative values). When your data must be positive, you shouldn't fit a model that can go negative, and if you do, you shouldn't be surprised that it may forecast there.

If your values are all strictly $> 0$, one common approach is to take logarithms and fit (and forecast) a model on that scale.

There are other ways to approach this sort of problem, but that's probably the simplest place to start.

You do need to take care when transforming forecasts though - a mean forecast on the log scale, if you simply exponentiate it, won't be a mean after you transform it back (it may be a good estimate of the median, however, and if you must have a mean there's an adjustment that can be made).

• Thanks for your time. Can you suggest some implementations for "logarithms and fit model"? – kosa Jul 14 '14 at 2:40
• Implementation involves (i) computing logs and (ii) fitting the model to that transformed data. I don't know exactly what you have available to you in Java. – Glen_b Jul 14 '14 at 2:49
• If there is something available in R? I can reverse engineer and implement Java. That helps me in validating Java output with R output to make sure code I have is valid. – kosa Jul 14 '14 at 4:35
• Incidentally Box-Cox with lambda=0 is (up to linear scaling) the same as taking logs. – Glen_b Jul 14 '14 at 5:44

To address the part of your question related to R, the ets function from the forecast package includes a lambda argument -- when true, a Box-Cox transformation is used that will keep the forecasts strictly positive. You may be able to use the same general approach in Java.

• I think that is what I may end up doing, need to look at R implementation and reverse engineer. Thanks! – kosa Jul 14 '14 at 2:41