r - adf.test returning p > 0.99 with xts, but returning p < 0.01 with coredata(xts) -


here output:

library(tseries) # 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 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 printed p-value 

the underlying data numeric vector. people seem successful @ applying adf.test xts, i'm not sure i'm doing wrong. please let me know other information can provide.

?adf.test says x (the first argument) should numeric vector or time series. "time series", means ts classed object, not any time-series class object. should convert xts object ts object before calling adf.test.

for example:

library(tseries) library(xts) data(sample_matrix) x <- as.xts(sample_matrix[,1]) adf.test(as.ts(x)) 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -