时间序列高于原始数据

时间:2016-03-17 16:28:25

标签: r time-series forecasting

我有以下示例数据形式的数据,我试图将其转换为时间序列。我有一个示例代码,用于将其转换为下面的时间序列。数据是每小时一次。 DateTime字段的格式为datetime。

当我绘制时间序列时,我得到的值远远高于原始数据ds $ TiTo。我想知道自己做错了什么。任何提示都非常感谢。

代码:

tsTiTo <- ts(na.approx(ds$TiTo), frequency = 24)
plot(tsTiTo,type="l")

数据:

dput(droplevels(ds[1:100,c("DateTime","TiTo")]))

structure(list(DateTime = structure(1:100, .Label = c("2013-01-01 00:00:00", 
"2013-01-01 01:00:00", "2013-01-01 02:00:00", "2013-01-01 03:00:00", 
"2013-01-01 04:00:00", "2013-01-01 05:00:00", "2013-01-01 06:00:00", 
"2013-01-01 07:00:00", "2013-01-01 08:00:00", "2013-01-01 09:00:00", 
"2013-01-01 10:00:00", "2013-01-01 11:00:00", "2013-01-01 12:00:00", 
"2013-01-01 13:00:00", "2013-01-01 14:00:00", "2013-01-01 15:00:00", 
"2013-01-01 16:00:00", "2013-01-01 17:00:00", "2013-01-01 18:00:00", 
"2013-01-01 19:00:00", "2013-01-01 20:00:00", "2013-01-01 21:00:00", 
"2013-01-01 22:00:00", "2013-01-01 23:00:00", "2013-01-02 00:00:00", 
"2013-01-02 01:00:00", "2013-01-02 02:00:00", "2013-01-02 03:00:00", 
"2013-01-02 04:00:00", "2013-01-02 05:00:00", "2013-01-02 06:00:00", 
"2013-01-02 07:00:00", "2013-01-02 08:00:00", "2013-01-02 09:00:00", 
"2013-01-02 10:00:00", "2013-01-02 11:00:00", "2013-01-02 12:00:00", 
"2013-01-02 13:00:00", "2013-01-02 14:00:00", "2013-01-02 15:00:00", 
"2013-01-02 16:00:00", "2013-01-02 17:00:00", "2013-01-02 18:00:00", 
"2013-01-02 19:00:00", "2013-01-02 20:00:00", "2013-01-02 21:00:00", 
"2013-01-02 22:00:00", "2013-01-02 23:00:00", "2013-01-03 00:00:00", 
"2013-01-03 01:00:00", "2013-01-03 02:00:00", "2013-01-03 03:00:00", 
"2013-01-03 04:00:00", "2013-01-03 05:00:00", "2013-01-03 06:00:00", 
"2013-01-03 07:00:00", "2013-01-03 08:00:00", "2013-01-03 09:00:00", 
"2013-01-03 10:00:00", "2013-01-03 11:00:00", "2013-01-03 12:00:00", 
"2013-01-03 13:00:00", "2013-01-03 14:00:00", "2013-01-03 15:00:00", 
"2013-01-03 16:00:00", "2013-01-03 17:00:00", "2013-01-03 18:00:00", 
"2013-01-03 19:00:00", "2013-01-03 20:00:00", "2013-01-03 21:00:00", 
"2013-01-03 22:00:00", "2013-01-03 23:00:00", "2013-01-04 00:00:00", 
"2013-01-04 01:00:00", "2013-01-04 02:00:00", "2013-01-04 03:00:00", 
"2013-01-04 04:00:00", "2013-01-04 05:00:00", "2013-01-04 06:00:00", 
"2013-01-04 07:00:00", "2013-01-04 08:00:00", "2013-01-04 09:00:00", 
"2013-01-04 10:00:00", "2013-01-04 11:00:00", "2013-01-04 12:00:00", 
"2013-01-04 13:00:00", "2013-01-04 14:00:00", "2013-01-04 15:00:00", 
"2013-01-04 16:00:00", "2013-01-04 17:00:00", "2013-01-04 18:00:00", 
"2013-01-04 19:00:00", "2013-01-04 20:00:00", "2013-01-04 21:00:00", 
"2013-01-04 22:00:00", "2013-01-04 23:00:00", "2013-01-05 00:00:00", 
"2013-01-05 01:00:00", "2013-01-05 02:00:00", "2013-01-05 03:00:00"
), class = "factor"), TiTo = structure(c(19L, 15L, 
7L, 22L, 24L, 19L, 10L, 19L, 25L, 9L, 2L, 33L, 19L, 2L, 3L, 27L, 
6L, 2L, 29L, 7L, 33L, 22L, 19L, 27L, 31L, 29L, 26L, 4L, 29L, 
30L, 29L, 26L, 22L, 28L, 4L, 25L, 31L, 27L, 31L, 25L, 12L, 29L, 
21L, 19L, 7L, 13L, 11L, 23L, 5L, 22L, 32L, 25L, 1L, 1L, 20L, 
26L, 19L, 28L, 27L, 5L, 30L, 10L, 32L, 19L, 22L, 29L, 19L, 27L, 
19L, 29L, 2L, 1L, 2L, 1L, 1L, 6L, 1L, 1L, 22L, 19L, 22L, 29L, 
19L, 2L, 29L, 26L, 25L, 8L, 4L, 15L, 2L, 31L, 18L, 17L, 14L, 
16L, 7L, 22L, 4L, 22L), .Label = c("", "0", "0.5", "1", "10", 
"10.5", "11", "13", "13.5", "14", "14.5", "15", "15.5", "16.5", 
"17", "18.5", "19", "19.5", "2", "2.5", "21", "3", "30", "39", 
"4", "5", "6", "6.5", "7", "7.5", "8", "8.5", "9"), class = "factor")), .Names = c("DateTime", 
"TiTo"), row.names = c(NA, 100L), class = "data.frame")

0 个答案:

没有答案