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