如何在预测中指定最小或最大可能值? [英] How to specify minimum or maximum possible values in a forecast?

查看:133
本文介绍了如何在预测中指定最小或最大可能值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用ETS/ARIMA模型进行的预测中,是否可以指定最小或最大可能值?

例如,以%预测趋势只能在0%到100%之间.

我正在使用R包forecast(和功能forecast).

解决方案

如果时间序列y具有自然界线[a, b],则应首先进行类似logit"转换:

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

然后,所得的yy(-Inf, Inf)上不受限制,适用于高斯误差假设.使用yy进行时间序列建模,然后在预测/预测上进行反变换:

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

请注意,上述变换f(因此为finv)是单调的,因此,如果yy的95%置信区间为[l, u],则y的对应置信区间为[finv(l), finv(u)].


如果您的y仅限于一侧,请考虑类似日志"的转换.

  • [a, Inf)上绑定,请考虑yy <- log(y - a);
  • (-Inf, a]上绑定,请考虑yy <- log(a - y).

哇,我不知道Rob Hyndman拥有博客.感谢 @ulfelder 提供它.我在此处添加了它,以使答案更加扎实:在限制范围内进行预测.

这个更具体,我没有讨论. 数据需要对数转换但在某处可能需要0时该怎么办.我只是添加一个小的容限,例如说yy <- log(y + 1e-7)继续.

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

解决方案

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.

这篇关于如何在预测中指定最小或最大可能值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆