使用“rollmedian”功能作为“arima”功能的输入

问题描述 投票:1回答:1

我的时间序列数据包括日期时间和温度列,如下所示:

rn25_29_o:

  ambtemp                  dt
1   -1.96 2007-09-28 23:55:00
2   -2.02 2007-09-28 23:57:00
3   -1.92 2007-09-28 23:59:00
4   -1.64 2007-09-29 00:01:00
5   -1.76 2007-09-29 00:03:00
6   -1.83 2007-09-29 00:05:00

我正在使用中值平滑函数来增强由于测量不精确而引起的小波动。

unique_timeStamp <- make.time.unique(rn25_29_o$dt) 
temp.zoo<-zoo(rn25_29_o$ambtemp,unique_timeStamp)
m.av<-rollmedian(temp.zoo, n,fill = list(NA, NULL, NA))

随后,中值平滑的输出用于建立时间模型并通过使用以下代码实现预测:

te = (x.fit = arima(m.av, order = c(1, 0, 0)))
# fit the model and print the results
x.fore = predict(te, n.ahead=50)

最后,我遇到以下错误:

seq.default中的错误(head(tt,1),tail(tt,1),deltat):'by'参数太小了

仅供参考:建模和预测功能通过使用原始时间序列数据正常工作。

请指导我完成此错误。

zoo median smoothing temporal
1个回答
1
投票

出现问题的原因是动物园包的属性。

因此,代码可以修改为:

Median_ambtemp <- rollmedian(ambtemp,n,fill = list(NA, NULL, NA))                                      te = (x.fit = arima(Median_ambtemp, order = c(1, 0, 0)))   
# fit the model and print the results
x.fore = predict(te, n.ahead=5)
© www.soinside.com 2019 - 2024. All rights reserved.