0
我使用add.test从TSERIES包如何使作为R adf.test打印更精确p值
cointegration <- function(vals)
{
library(tseries)
beta <- coef(lm(vals[,2] ~ vals[,1] + 0, data = vals))[1]
names(beta) <- NULL
res <- adf.test(vals[,2] - beta*vals[,1], alternative = "stationary", k = 0)
return(list(beta = beta, p.value = res$p.value))
}
显然做一个简单的协整函数,adf.test具有下界印刷对 - 值为0.01。任何值较小的p值都会产生警告信息:
Warning message:
In adf.test(vals[, 2] - beta * vals[, 1], alternative = "stationary", :
p-value smaller than printed p-value
是否有可能让adf.test打印出更精确的p值?
我知道的另一种方式是抑制警告消息:
res <- suppressWarnings(adf.test(vals[,2] - beta*vals[,1],
alternative = "stationary", k = 0))
但打印更精确的p值将是很好。
感谢
请inculde您的数据示例,使您的问题[reproducible](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)。 – tonytonov