I make a simple cointegration function using add.test from tseries packages
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) )
}
Apparently, adf.test has a lower bound of printed p-value at 0.01. Any value smaller p-value will create a warning message:
Warning message:
In adf.test(vals[, 2] - beta * vals[, 1], alternative = "stationary", :
p-value smaller than printed p-value
Is it possible to have adf.test print out more precise p-value instead?
I know the alternative way is to suppress the warning message:
res <- suppressWarnings(adf.test(vals[,2] - beta*vals[,1],
alternative = "stationary", k = 0))
But printing more precise p-value would be nice.
Thanks