I am trying to check for auto-correlation in a zoo object (monthly data with several columns) using:
acf(jan, plot=F)$acf[2]
but I get the following error:
Error in na.fail.default(as.ts(x)) : missing values in object
To simplify, I extracted just one of the columns which I called “a” (so now I have a simple zoo object with index and data), and used:
acf(a)
but still get the same error. Can’t acf be used in zoo objects?
Just use
That should work fine. Keep in mind that you have to provide a regularly spaced time series for that to give you a meaningful answer.