The fUnitRoots package considers lag=2
as the default value in the urzaTest()
function (Zivot & Andrews unit root test), while for the ur.za()
function in the urca package the default is lag=NULL
.
What is the "criteria" to choose a good number of lags?
Contents
hide
Best Answer
(instead of a comment) I would go for the minimization of information criteria either AIC or BIC, or any other just choose the parameter k
other than 2
in AIC()
function:
require(urca) ## An example from example(ur.za) data(nporg) gnp <- na.omit(nporg[, "gnp.r"]) za.gnp <- ur.za(gnp, model="both", lag=2) AIC(eval(attributes(za.gnp)$testreg)) [1] 485.0148 BIC(eval(attributes(za.gnp)$testreg)) [1] 501.6351
For the efficient implementation you may consult on the stack-overflow, I think. A rough way to go is to run the for
cycle, but it may be too slow.