下面是输出:
library(tseries) # for adf.test function
adf.test(data)
Augmented Dickey-Fuller Test
data: data
Dickey-Fuller = 11.1451, Lag order = 16, p-value = 0.99
alternative hypothesis: stationary
Warning message:
In adf.test(spread.princomp) : p-value greater than printed p-value
adf.test(coredata(data))
Augmented Dickey-Fuller Test
data: coredata(data)
Dickey-Fuller = -4.031, Lag order = 16, p-value = 0.01
alternative hypothesis: stationary
Warning message:
In adf.test(coredata(spread.princomp)) :
p-value smaller than printed p-value底层数据是一个数值向量。人们似乎成功地将adf.test应用于xts,所以我不确定我做错了什么。请告诉我我还能提供什么信息。
发布于 2013-05-09 02:35:57
?adf.test说x (第一个参数)应该是一个数值向量或时间序列。所谓“时间序列”,指的是一个ts类对象,而不是任何时间序列类对象。在调用adf.test之前,应将xts对象转换为ts对象。
例如:
library(tseries)
library(xts)
data(sample_matrix)
x <- as.xts(sample_matrix[,1])
adf.test(as.ts(x))https://stackoverflow.com/questions/16447461
复制相似问题