4

我是 R 的新手,遵循 Walter Zucchini 的 R 时间序列分析 PDF。我有一些来自传感器的数据,特别是我可以每分钟或每 5 秒获得一次数据。然后我想使用ts()命令来制作这些值的时间序列。所以语法应该是data1mints <- ts(data1min ,freq = 525600)525600 是常规年份的分钟。
之后,我尝试使用此命令进行绘图,plot(stl(log(data1min), s.window = "periodic"))但 R 告诉我

系列不是周期性的或少于两个周期

更准确地说,我有 3 月 20 日到 3 月 28 日的数据,所以我没有完整的年份数据,但我认为这段时间足以分析每分钟发生的事情。

我错了什么?

4

1 回答 1

5

错误消息告诉您出了什么问题 - 您的句点少于 2 个。

例如,

# this works since there are 3 periods
freq <- 100
ny <- 3 # no of years, i.e. periods
n <- ny * freq
set.seed(13)
tt <- ts(rnorm(n), freq = freq)
s <- stl(tt, "periodic")

# this issues error since there are less than 2 periods. (We have changed ny to 1.)
freq <- 100
ny <- 1 ##
n <- ny * freq
set.seed(13)
tt <- ts(rnorm(n), freq = freq)
s <- stl(tt, "periodic")
于 2013-09-04T13:49:29.153 回答