[R] NaN with ccf() for vector with all same element

2006-11-27 Thread colliera
hello, i have been using ccf() to look at the correlation between lightning and electrogamnetic data. for the most part it has worked exactly as expected. however, i have come across something that puzzles me a bit: x - c(1, 0, 1, 0, 1, 0) y - c(0, 0, 0, 0, 0, 0) ccf(x, x, plot = FALSE)

Re: [R] NaN with ccf() for vector with all same element

2006-11-27 Thread Gabor Grothendieck
The denominator holds the variance and since the variance is zero you get that. Calculate the covariance instead of the correlation: ccf(x, y, plot = FALSE, type = cov) On 11/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: hello, i have been using ccf() to look at the correlation

Re: [R] NaN with ccf() for vector with all same element

2006-11-27 Thread Prof Brian Ripley
On Mon, 27 Nov 2006, [EMAIL PROTECTED] wrote: hello, i have been using ccf() to look at the correlation between lightning and electrogamnetic data. for the most part it has worked exactly as expected. however, i have come across something that puzzles me a bit: x - c(1, 0, 1, 0, 1, 0) y