# Is it meaningful to calculate Pearson or Spearman correlation between two Boolean vectors?

There are two Boolean vectors, which contain 0 and 1 only. If I calculate the Pearson or Spearman correlation, are they meaningful or reasonable?

• If both variables are dichotomous, Pearson = Spearman = Kendall's tau. Yes it may have sence. With truly binary (boolean) data it also make sence to compute "Pearson" on data without centering, that would be cosine. – ttnphns Jun 18 '14 at 8:14
• ... and = Phi (standardized Chi-square) which brings us from scale to contingency table. – ttnphns Jun 18 '14 at 8:20

The Pearson and Spearman correlation are defined as long as you have some $0$s and some $1$s for both of two binary variables, say $y$ and $x$. It is easy to get a good qualitative idea of what they mean by thinking of a scatter plot of the two variables. Clearly, there are only four possibilities $(0,0), (0,1), (1, 0), (1,1)$ (so that jittering to shake identical points apart for visualization is a good idea). For example, in any situation where the two vectors are identical, then by definition $y = x$ and the correlation is necessarily $1$. Similarly, it is possible that $y = 1 -x$ and then the correlation is $-1$.

For this set-up, there is no scope for monotonic relations that are not linear. When taking ranks of $0$s and $1$s under the usual midrank convention the ranks are just a linear transformation of the original $0$s and $1$s and the Spearman correlation is necessarily identical to the Pearson correlation. Hence there is no reason to consider Spearman correlation separately here, or indeed at all.

Correlations arise naturally for some problems involving $0$s and $1$s, e.g. in the study of binary processes in time or space. On the whole, however, there will be better ways of thinking about such data, depending largely on the main motive for such a study. For example, the fact that correlations make much sense does not mean that linear regression is a good way to model a binary response. If one of the binary variables is a response, then most statistical people would start by considering a logit model.

• Does that mean in this situation, Pearson or Spearman correlation coefficient is not a good similarity metric for this two binary vectors? – Zhilong Jia Jun 23 '14 at 11:33
• Yes in the sense that it doesn't measure similarity and is undefined for all 0s or all 1s for either vector. – Nick Cox Jun 23 '14 at 12:26

There are specialised similarity metrics for binary vectors, such as:

• Jaccard-Needham
• Dice
• Yule
• Russell-Rao
• Sokal-Michener
• Rogers-Tanimoto
• Kulzinsky

etc.

For details, see here.

• Surely there are many more reliable and comprehensive references. Even on the level of getting authors' names right, note Kulczyński and Tanimoto. See e.g. Hubálek, Z. 1982. Coefficients of association and similarity, based on binary (presence-absence) data: An evaluation. Biological Reviews 57: 669–689. – Nick Cox Jul 27 '15 at 15:43
• They have obviously misspelled 'Tanimoto' but 'Kulzinsky' has been purposely simplified. Your reference is more credible without a doubt but it's not accessible to everybody. – Digio Jul 28 '15 at 8:38