How to specify minimum or maximum possible values in a forecast?

↘锁芯ラ 提交于 2019-12-31 03:35:11

问题


Is there a way to specify minimum or maximum possible values in a forecast done with ETS/ARIMA models?

Such as when forecasting a trend in % that can only go between 0% and 100%.

I am using R package forecast (and function forecast).


回答1:


If your time series y has a natural bound [a, b], you should take a "logit-alike" transform first:

f <- function (x, a, b) log((x - a) / (b - x))
yy <- f(y, a, b)

Then the resulting yy is unbounded on (-Inf, Inf), suitable for Gaussian error assumption. Use yy for time series modelling, and take back-transform later on the prediction / forecast:

finv <- function (x, a, b) (b * exp(x) + a) / (exp(x) + 1)
y <- finv(yy, a, b)

Note, the above transform f (hence finv) is monotone, so if the 95%-confidence interval for yy is [l, u], the corresponding confidence interval for y is [finv(l), finv(u)].


If your y is only bounded on one side, consider "log-alike" transform.

  • bounded on [a, Inf), consider yy <- log(y - a);
  • bounded on (-Inf, a], consider yy <- log(a - y).

Wow, I didn't know Rob Hyndman has a blog. Thanks to @ulfelder for providing it. I added it here to make my answer more solid: Forecasting within limits.

This one is more specific, which I have not covered. What to do when data need a log transform but it can take 0 somewhere. I would just add a small tolerance, say yy <- log(y + 1e-7) to proceed.



来源:https://stackoverflow.com/questions/40302029/how-to-specify-minimum-or-maximum-possible-values-in-a-forecast

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!