8
$\begingroup$

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).

enter image description here

$\endgroup$

2 Answers 2

8
$\begingroup$

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).

$\endgroup$
4
  • $\begingroup$ Thanks for your time. Can you suggest some implementations for "logarithms and fit model"? $\endgroup$
    – kosa
    Commented Jul 14, 2014 at 2:40
  • $\begingroup$ 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. $\endgroup$
    – Glen_b
    Commented Jul 14, 2014 at 2:49
  • $\begingroup$ 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. $\endgroup$
    – kosa
    Commented Jul 14, 2014 at 4:35
  • 1
    $\begingroup$ Incidentally Box-Cox with lambda=0 is (up to linear scaling) the same as taking logs. $\endgroup$
    – Glen_b
    Commented Jul 14, 2014 at 5:44
10
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ I think that is what I may end up doing, need to look at R implementation and reverse engineer. Thanks! $\endgroup$
    – kosa
    Commented Jul 14, 2014 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.