Using auto.arima in xts objects

I try to run auto.arima for some xts data, but I get the following error:

 library(quantmod) library(forecast) getSymbols('^GSPC',from='2000-01-01') auto.arima(GSPC$GSPC.Close) Error in dimnames(cd) <- list(as.character(index(x)), colnames(x)) : 'dimnames' applied to non-array 

I found that if I

 close <- as.ts(GSPC$GSPC.Close) 

then auto.arima does not return an error. But then I lost the date information associated with the xts object. Is there a way to save data as xts and still run the function?

I noticed that, for example, acf(GSPC$GPSC.Close) and pacf() give no errors.

+4
source share
1 answer

I suggest you convert GSPC$GSPC.Close to ts , vector or matrix into an argument list auto.arima :

 auto.arima(as.ts(Cl(GSPC))) auto.arima(coredata(Cl(GSPC))) # Dirk suggestion 
+1
source

All Articles