根据Walter Zucchini对R的时间序列分析PDF,我是R的新手.我有一些来自传感器的数据,特别是我可以每分钟或每5秒获得一次数据.然后我想使用ts()命令来制作这些值的时间序列.所以语法应该是data1mints <- ts(data1min ,freq = 525600)525600是普通年份的分钟数.
在那之后我尝试用这个命令绘图,plot(stl(log(data1min), s.window = "periodic"))但R说我
系列不是周期性的或少于两个周期
更确切地说,我有3月20日至3月28日的数据,所以我没有完整的年份数据,但我认为这是分析每分钟发生的事情的足够时期.
我错了什么?
错误消息告诉您错误 - 您有少于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")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3513 次 |
| 最近记录: |