Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Automated shifting correlation test

  1. Jun 16, 2012 #1
    Hello everyone I'm new here:

    So I was about to write some SAS or R to do the following, but now I'm getting old enough to realize most things I think of were thought of before (usually by people way smarter than me). I've done some googling, but I haven't found the golden answer yet.

    I'd like to test correlation between two data sets but I want to test a ton of "shifts" between the two sets. I want to automatically play with the lead and lag of the two sets and look at some sort of clever graphical representation of the relationships.

    If anyone out there can point me to some R/SAS functions that is great, but even better would be the 10,000 foot guide of the basics for this type of question. The high level type guidance is usually what I have trouble googling up, instead I usually get too specialized information.

  2. jcsd
  3. Jun 16, 2012 #2
    Hi Austin,

    Yeah, you're right, I think most of us have been in the situation "Oh! My God! I just invented the wheel!!" :smile:

    What you describe is called cross correlations in time series and the function for this in R is named ccf

    About the guide, just search for 'cross correlation time series' and you will find tons.

    PS: Just guessing, but If you intend you get rich with this in the stock market just save your money and thank me later :tongue:
  4. Jun 16, 2012 #3
    That was what I needed, thanks. I had some fun playing with sin & cos cross correlation in R to get my feet wet. Ha, this idea did come to me while in a conversation about the stock market, but I think I have a problem at work I can use this for as well. Thanks again.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook