[R] na.pass option in ccf function

Dario Mavec dario.mavec at anu.edu.au
Thu Jun 7 02:38:51 CEST 2012


Hi everyone,

I have been working with the ccf function recently, and in particular to 
do my calculations I have been using "na.action = na.pass".  I noticed 
that the help documentation mentions that with this option the computed 
estimate may not be a valid autocorrelation sequence and was wondering 
if anyone could clarify what this means.

In particular, the example below gives correlation values > 1 which 
seems nonsensical.  When is it valid to use the "na.pass" option?

 > x <- c(1,2,3,4)
 > y <- c(1,2,NA,4)
 > ccf(x, y, na.action = na.pass, plot = F)

Autocorrelations of series ‘X’, by lag

     -3     -2     -1      0      1      2      3
-0.448 -0.199  0.319  1.116  0.120 -0.209 -0.359

Thanks!

-- 

Dario Mavec (dario.mavec at anu.edu.au)
Fenner School of Environment & Society
College of Medicine, Biology & Environment
Australian National University
Canberra ACT 0200 AUSTRALIA



More information about the R-help mailing list