# Correlating volume timeseries

Consider the following graph:

The red line (left axis) describes the trading volume of a certain stock. The blue line (right axis) describes the twitter message volume for that stock. For instance, on May 9 (05-09) about 1.100 million trades and 4.000 tweets were made.

I would like to calculate whether there is a correlation between the timeseries, either on the same day or with a lag - for instance: tweet volume correlates with trading volume one day later. I'm reading many articles who have made such analysis, for instance Correlating Financial Time Series with Micro-Blogging Activity, but they do not describe how such an analysis is made in practical terms. The following is stated in the article:

However, I have very little experience with statistical analysis and don't know how to execute this on the series that I have. I use SPSS (also known as PASW) and my question is: what are the steps to take to make such an analysis from the point where I have a datafile underlying the above image? Is such a test a default feature (and what is it called) and/or how could I else execute it?

Any help would be greatly appreciated :-)

• You can calculate them... you just can't compare them to critical values unless the two series are bi-variate normal Commented Apr 29, 2012 at 21:57
• I've pasted raw data here: pastebin.com/tZajRae9 Is there a way to tell whether the series are bi-variate normal? I would really appreciate your comment. Commented Apr 29, 2012 at 22:34
• After detecting the Outliers/Level shifts in each of the series the resultant adjusted series exhibited an AR(1) model. After incorporating not only the Outlier / level Shift adjustment AND the empirically identified AR (1) both noise series were free of auto-correlation (within structure). A cross-correlation of this two surrogate series indicated no substantive cross-correlation (among structure ) thus the number of tweets doesn't appear to help the prediction of volume. Commented Apr 30, 2012 at 14:54

Two check for bivariate normality check three things:

1. check if first series of observations is marginally normal,
2. check if second series of observations is marginally normal,
3. regress on one the other and check if residuals are normal.

To check normality at each of these steps, use normal q-q plots or you can use any normality hypothesis test.

Or alternatively you could check if every possible linear combination (real coefficients) of the two series is marginally normal. That would probably be difficult, though.

Edit: (6 years later) I'll keep the above for posterity, but note I have a more recent answer to a similar question here.

• I have taken steps 1 and 2 and came up with the following boxplots: i.imgur.com/SDOTE.png Except for the 3 to 5 outlier observations, they look marginally normal. However, the Sig. value for the Shapiro-Wilk Test is 0.000, which would indicate a significant deviation from normality. With outliers removed, Shapiro Wilk Sig. is 0.201 for tweets and 0.004 for trades. Does this indicate no correlating is possible? Also, this is a timeseries - deleting outliers means deleting days within the researched timeframe. Is this an accepted practice? Commented Apr 30, 2012 at 8:37
• I also made a p-p plot for step 3. Or at least, in my interpretation this is what I need (a linear regression with normal probability plot): i.imgur.com/EZ3Ic.png Any comments? Commented Apr 30, 2012 at 8:45
• The marginal distributions don't look normal. There is a small section on inference on the wikipedia page link. Removing outliers is generally not a good idea. Maybe bootstrap a confidence interval. Commented May 2, 2012 at 21:09
• The question is about correlation -- but the answer is about normality. The answer is upvoted multiple times and accepted. What am I missing here?.. Commented May 19, 2015 at 12:59
• A bivariate normal distribution is the simplest model that motivates/justifies using Pearson correlation. Commented May 20, 2015 at 14:02

The correlation coefficient between time series is useless. See CORRELATION COEFFICIENT - Critical values for Testing Significance. This was first pointed out by U. Yule in 1926 Yule, G.U, 1926, "Why do we sometimes get nonsense correlations between time series? A study in sampling and the nature of time series", Journal of the Royal Statistical Society 89, 1–64. You might want to google "why do we get nonsense correlation" for more.

The reason for this is tests for correlation requite joint normality. Joint normality requires each series to be normal. Normality requires independence. To examine the relationship between time series please review Transfer Function Identification in any good time series book like Time Series Analysis: Univariate and Multivariate Methods, by William W.S. Wei, David P. Reilly.