[R] "ccf versus acf"

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Sep 15 10:54:08 CEST 2006


On Thu, 14 Sep 2006, Werner,Arelia [PYR] wrote:

> I am trying to run a cross-correlation using the "ccf()" function. When
> I select plot = TRUE in the ccf() I get a graph which has ACF on the
> y-axis, which would suggest that these y-values are the auto-correlation
> values.

But cross-correlations are part of the ACF for a bivariate time series, so 
why do you think that is a problem?

Your example is not reproducible.  However, there is a reproducible 
example on the help page that looks like cross-correlations (look at the 
value at lag 0). And

> ccf(mdeaths, fdeaths, ylab="ccf")

might be what you are looking for.


> How should I adjust the code to produce a plot that provides the
> cross-correlation values?
>
> Here is my code:
>
> w002dat <- read.csv("w054_1128958_08NM174.csv", header=TRUE)
> w002dat$date <- as.Date(w002dat$date,"%m/%d/%Y")
> attach(w002dat)
> w002ccfhdgw <- ccf((gwneg), (hydro), lag.max = 400, type =
> c("correlation"),
>         plot = TRUE, na.action = na.exclude)
>
> Thank you
>
> Arelia
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.

PLEASE do!

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list