On 2011-01-19 08:48, Paul Ossenbruggen wrote:
Hi,

        I have missing values in my time series. "na.action = na.pass" works 
for acf and pacf. Why do I get the following error for the ccf?


ts(matrix(c(dev$u[1:10],dev$q[1:10]),ncol=2),start=1,freq=1)
Time Series:
Start = 1
End = 10
Frequency = 1
    Series 1 Series 2
  1 68.00000 138.4615
  2 70.00000 355.5556
  3 68.76000 304.3200
  4 68.00000 231.4286
  5 69.74194 357.4963
  6       NA       NA
  7 67.45455 174.8697
  8 66.00000 144.0000
  9 73.50000 287.6471
10 70.00000 172.6027


ccf(x = ts.data[,1], y = ts.data[,2], na.action = na.pass, ylab = "CCF")
Error in na.fail.default(as.ts(x)) : missing values in object


I can see two possible solutions:
1. Use na.action = na.contiguous (see ?na.contiguous)
2. Modify ccf(). Make a copy and replace the line

  acf.out <- acf(X, lag.max = lag.max, plot = FALSE, type = type)

with

  acf.out <- acf(X, lag.max = lag.max, plot = FALSE, type = type,
                 na.action = na.action)

I think this may be a bug in ccf().

Peter Ehlers

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to