Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For my case, I have 2 arrays or sets of data, 100 elements, and the values are only 0 and 1. What test or procedure would measure the correlation or independence of the 2 sets?

To give an example of the data, suppose one counted if it rained or not in 2 different cities over a period of 100 days. The data would be recorded as 0 for no rain that day, or 1 for any rain that day. After 100 days, CityA would have data of {0,1,0,0,1 ...} with 100 data points, and CityB would have data of {0,1,1,0,0, ...} also with 100 data points. The question is whether the rain in the 2 cities is correlated positively or negatively, or independent.

If it's important, these data sets are time-series, or just that the order is fixed, and the event is mostly randomly distributed over the 100 days.

One measure I found was the Phi Coefficient. But the example in my text book says it's for 2 dichotomous values a subject may have, eg smoking and cancer, male/female and pets, married and employed, etc. I was not sure if this applied to my case where it's 2 time series.

thanks in advance, and I hope I've phrased my question clearly, if not feel free to ask for more details if needed, thanks

share|cite|improve this question
If by correlation, you mean the Pearson correlation (…), then the correlation of two random variables is merely the covariance divided by the product of the standard deviations. – user5137 Oct 27 '11 at 0:37
Thanks for the response -- Would that apply since the data are only 0 and 1? – d l Oct 27 '11 at 0:51
Why wouldn't it? – user5137 Oct 27 '11 at 1:04
Thanks for your feedback -- Because all the data points on the scatter plot would only be (0,0), (0,1), (1,0), (1,1), instead of the scatter plots usually used in descriptions where there are several data points that line up or look like a cloud. Would a 0-1 histogram have a meaningful standard deviation? Even if Pearson's correlation would apply, surely there is something better for this type of case? – d l Oct 27 '11 at 17:14
Actually, I think I will use Chi-Square, then shift the arrays by one several times in case there are lag effects (eg, if it rains in CityA, then the next day it always rains in CityB -- perfect match, but takes one day for rain clouds to reach CityB). Thanks for your help on this, I appreciate the exchange of ideas. – d l Oct 27 '11 at 17:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.