Skip to content
Prev 167490 / 398502 Next

time series contains internal NAs error

On Mon, 19 Jan 2009, stephen sefick wrote:

            
True.

Although in this case it's relatively easy to guess what went wrong. 
The user probably has some irregular series, for example daily with 
missing days:
    x <- xts(rnorm(10), as.Date("2009-01-19") + c(0:4, 7:11))
acf() just works with regular time series of class "ts". Everything else 
is coerced via as.ts(). This is where the problem is created for your data 
as the error message conveyed:
as.ts(x) detects that there is an underlying regularity (1-day steps) if 
you include two internal NAs (the weekend).

na.omit(as.ts(x)) cannot omit internal NAs because the "ts" class cannot 
represent such an object. Even if it could, acf() couldn't compute the ACF 
with internal mising data.

Some people just ignore the weekend effect (i.e., assume that the Mon-Fri 
correlation is the same as Tue-Mon). If one wants to do this, it can be 
obtained via acf(coredata(x)).
I'm fairly certain it does.
Z