以R的预测值 [英] in R Forecasted values

查看:116
本文介绍了以R的预测值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于R中的预测时间序列模型,我几乎没有疑问.

I have few questions regarding the forecast time series model in R.

为此我得到的预测值为:

The forecast values which i got for this is::

要采用以下值:40,60,67,80,87作为百分比值.

Want to take these values: 40,60,67,80,87 as the percentage values.

所以,如何以perperatge方式考虑图的Y轴

So, How to consider Y-axis of the plot in percenatge

YrTimeSeries <- c(40,60,67,80,87);

tsValue<-ts(YrTimeSeries,frequency=1,start=2006)
library(forecast)
(forecast(tsValue,h=5))
    Point Forecast    Lo 80    Hi 80    Lo 95    Hi 95
2011        86.9993 72.19680 101.8018 64.36083 109.6378
2012        86.9993 66.06645 107.9321 54.98528 119.0133
2013        86.9993 61.36233 112.6363 47.79094 126.2077
2014        86.9993 57.39653 116.6021 41.72576 132.2728
2015        86.9993 53.90256 120.0960 36.38220 137.6164

  1. 每年的预测值(蓝线)的值相同.有人可以解释一下为什么吗?
  2. 95%的预测间隔为(36.38220,137.62).它推断出什么?
  1. The values for Forecasted value(blue line) for each year is same. Can someone please explain me why?
  2. The 95 % predictive interval is (36.38220,137.62). What does it infer?

推荐答案

由于您使用默认配置调用了forecast(),因此预测为一条直线.这将调用ets()(查看forecast(tsValue,h=5)$method以查看用于预测的方法),并将模型指定为"ZZZ". ets()然后尝试找到最佳模型并基于"ANN":附加误差,无趋势,无季节性(请参见?ets),因此模型中没有任何内容会导致预测偏离一条直线.添加更多数据并通过趋势调用ets()来查看趋势预测:

The forecast is a flat line since you invoked forecast() with its default configuration. This invokes ets() (look at forecast(tsValue,h=5)$method to see which method was used for forecasting), with a model specified as "ZZZ". ets() then tries to find the best model and settles on "ANN": additive error, no trend, no seasonality (see ?ets), so there is nothing in the model which should cause the forecast to deviate from a flat line. Add some more data and call ets() with a trend to see a trend forecast:

YrTimeSeries <- c(40,60,67,80,87,100,200,300,400)
tsValue<-ts(YrTimeSeries,frequency=1,start=2006)
forecast(tsValue,h=5,model="AAN")

95%的预测间隔为您提供了一个间隔,其中95%的未来观察结果位于该范围内,假设您的模型已正确指定.

The 95% predictive interval gives you an interval in which 95% of future observations will lie, assuming that your model is correctly specified.

Vids评论说,他希望预测值在0到100之间(以百分比为单位).在这种情况下,我首先将输入数据转换为logits(http://en.wikipedia.org/wiki/Logit),然后在其中添加一些数据,以便获得自动趋势:

Vids comments that he would like the forecast to be between 0 and 100 as a percentage. In this case, I would first transform the input data to logits (http://en.wikipedia.org/wiki/Logit), where I added some data so we get an automatic trend:

YrTimeSeries <- c(10,20,30,40,60,67,80,87)
YrTimeSeries.logit <- log((YrTimeSeries/100)/(1-YrTimeSeries/100))
tsValue<-ts(YrTimeSeries.logit,frequency=1,start=2006)

预测后,我们对平均预测和预测间隔限制进行了反变换:

After forecasting, we backtransform the mean forecast and prediction interval limits:

100*(1/(1+exp(-(forecast(tsValue,h=5)$mean))))
100*(1/(1+exp(-(forecast(tsValue,h=5)$upper))))
100*(1/(1+exp(-(forecast(tsValue,h=5)$lower))))

这篇关于以R的预测值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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