我是一个研究R的新手,根据沃尔特·西奇尼( Walter )的一份PDF的时间序列分析报告。我有一些来自传感器的数据,特别是我可以每分钟或每5秒获得数据。然后,我想使用ts()命令来生成这些值的时间序列。所以语法应该是data1mints <- ts(data1min ,freq = 525600),其中525600是常年的分钟。
在那之后,我尝试用这个命令plot(stl(log(data1min), s.window = "periodic"))来画图,但是R说
系列不是周期性的,也不少于两个周期。
更准确地说,我有3月20日至3月28日的数据,所以我没有完整的年度数据,但我认为这段时间足以分析每分钟发生的事情。
我错了什么?
发布于 2013-09-04 13:49:29
错误信息告诉你什么是错的-你有不到两个句号。
例如,
# 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")https://stackoverflow.com/questions/18615254
复制相似问题