使用"rollmedian"用作"arima"输入的功能.功能 [英] Using "rollmedian" function as a input for "arima" function

查看:93
本文介绍了使用"rollmedian"用作"arima"输入的功能.功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的时间序列数据包括以下日期-时间和温度列:

My time-series data includes date-time and temperature columns as follows:

rn25_29_o:

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

我正在使用中值平滑功能来增强由于测量不精确而引起的细微波动.

I am using median smoothing function to enhance small fluctuations that are caused because of imprecise measurements.

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

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

subsequently, the output of the median smoothing is used for building temporal model and achieving predictions by using the following code:

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)

最后,我遇到以下错误:

Finally, I encounter with the following error:

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

Error in seq.default(head(tt, 1), tail(tt, 1), deltat) : 'by' argument is much too small

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

FYI: The modeling and prediction function works properly by using original time-series data.

请指导我解决此错误.

推荐答案

由于Zoo软件包的属性而发生了问题.

The problem occurred because of the properties of the zoo package.

因此,可以将代码修改为:

Thus, the code can be amended to :

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)

这篇关于使用"rollmedian"用作"arima"输入的功能.功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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