[R] ccf function
    Megan Moreau 
    m_j_moreau at yahoo.com
       
    Wed Jul 14 04:48:38 CEST 2010
    
    
  
Hello,
I am a very new R user and not a statistician so please excuse any over 
explanation, I'm just trying to be as clear as possible.
I have performed a cross correlation of two time series (my columns) in a single 
data setusing:
ccf(ts(A[rows,columnX]),(A[rows,columnY]), lag=NULL, type="correlation",plot=F)
I am able to get the results (for example):
Autocorrelations of series ‘X’, by lag
   -14    -13    -12    -11    -10     -9     -8     -7     -6     -5     -4 
-0.128 -0.126 -0.109 -0.087 -0.060 -0.035 -0.002  0.027  0.064  0.106  0.157 
    -3     -2     -1      0      1      2      3      4      5      6      7 
 0.201  0.255  0.293  0.314  0.261  0.196  0.117  0.029 -0.059 -0.131 -0.169 
     8      9     10     11     12     13     14 
-0.184 -0.277 -0.343 -0.368 -0.373 -0.358 -0.335    
My questions are these:
1) When I set a NULL value to the lag.max, does that assume k-1 of time?  or if 
I have, for example, 50 time frames do I have assert lag.max=49 (as k-1)?
2) How do I read the results?  when I plot the above the first value that shows 
significance is 0.293 at -1.   Does that mean at that lag X leads Y? I am 
specifically trying to resolve if X leads Y or not.
3) Lastly, is there a function that will pull out the first maximum/significant 
value?  I tried which.max(x), max(x) and nothing seems to be working.
All ideas are appreciated.  I apologize for the simple questions.... but you 
have to start somewhere!
Megan
    
    
More information about the R-help
mailing list