Re: [R] Cross-correlation function

From: Andreas Hary <u08adh_at_hotmail.com>
Date: Fri 21 Oct 2005 - 06:44:39 EST

I have reproduced your error using the following

goo1 <- rnorm(100,0,1)
goo2 <- rnorm(100,0,1)
goo <- cbind(goo1,goo2)

goo[2,1] <- NA

ccf(ts(goo[,1]),ts(goo[,2]),na.action='na.exclude',type='cor') Error in "colnames<-"(`*tmp*`, value = c("ts(goo[, 1])", "ts(goo[, 2])" :

        attempt to set colnames on object with less than two dimensions

ccf(ts(goo[,1]),ts(goo[,2]),type='cor')
Error in na.fail.default(ts.union(as.ts(x), as.ts(y))) :

        missing values in object

as desired, but

ccf(ts(goo[,1]),ts(goo[,2]),na.action=na.exclude,type='cor')

works fine for me, so removing the quotation marks around the na.exclude should do the trick.
Cheers,

Andreas

> Hello All,
>
> I'm having trouble with the ccf() function. I am trying to do
> cross-correlation between two time-series, but I keep getting an error
> message I don't know what to do with. This what I type and the error
> message I get:
>
>> ccf(ts(mod[,1]),ts(mod[,2]),na.action='na.exclude',type='cor')
> Error in "colnames<-"(`*tmp*`, value = c("ts(mod[, 1])", "ts(mod[, 2])" :
> attempt to set colnames on object with less than two dimensions
>
> Can anybody see what is wrong and what I need to do different?
>
> Thanks,
> Anne Hertel
>
>
> ------------------------------------------------------------
> Anne M. K. Hertel
> Grad. Student & Research Assistant
> Department of Atmospheric Sciences
> University of Illinois at Urbana-Champaign
> Annex II, room 204
> Phone: (217) 333 6296
>
> ______________________________________________
> R-help@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
>



R-help@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 Received on Fri Oct 21 07:30:13 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 19:14:32 EST