# Find correlation between two time series. Theory and practice (R)

I'm new to R, statistics and time series, so I would really appreciate any help, explanations or suggestion on good readings on the topic.

I have two time series representing the number of times a word, say "election", was used on Twitter and the number of times it was used on television, in a day for a month.

I want to find the correlation between the two, but honestly I really don't know what to do. I was going to directly use ccf() in R, but reading some other question here, I don't think this would be correct.

Are there any requirements or necessary conditions on the series to find the correlation with ccf()? Is it the right type of correlation coefficient? Which are the step I need to perform to make it work?

• Finding the correlation is a technique--but it doesn't tell us much about why you want to apply the technique or how you are hoping to interpret the results. Could you tell us something about this context? Otherwise how are we supposed to determine what the "right type" of technique should be or what it might mean to make it "work"? – whuber Jan 16 '17 at 21:20
• @whuber , I want to know how Twitter and television may influence each other on certain topics (represented by a word), that are not "breaking news". For example, how people twitting about antibiotics resistance influences tv on the same topic (or vice versa), in a given time window. – fed Jan 17 '17 at 11:30

Your very straightforward simple question has unfortunately both a simple and a complex answer. I will avoid the simple . In summary the whole idea is that one needs to account for / condition for intra-correlation while identifying the inter-correlation . Following are some references that you might consider before attempting to proceed . The first is an easy iverview

ARIMAX model's exogenous components?

this reference provides info as to why you should be aware of simple soulutions that may be routinely available

http://empslocal.ex.ac.uk/people/staff/dbs202/cat/stats/corr.html

This outlines a general procedure which is far from general as it doesn't deal with Gaussian Violations.

https://onlinecourses.science.psu.edu/stat510/node/75

This provides a gentle overview of regression vs simple ARIMA time series methods.

http://www.autobox.com/cms/index.php/afs-university/intro-to-forecasting?start=5

Lastly, arm yourself with data and try different approaches .

Hope this helps ..