[R] ccf function

vikrant vikrant.shimpi at tcs.com
Wed Jul 14 08:10:33 CEST 2010


Hi Megan,

Answer for you third question. This function will return the maximum CCF
value along with corresponding lag value. Input to this function are a and b
which are nothing but two time series.



Find_Max_CCF<- function(a,b)
{
 d <- ccf(a, b, plot = FALSE) 
 cor = d$acf[,,1]
 lag = d$lag[,,1]
 res = data.frame(cor,lag) 
 res_max = res[which.max(res$cor),]
 return(res_max)
}
-- 
View this message in context: http://r.789695.n4.nabble.com/ccf-function-tp2288257p2288336.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list