# Phi and Pearson's correlation, signs reversed

I have two binary variables, naturally dichotomous, yes no They present information on whether a college has multi-stream recycling or single-stream recycling. I did Pearson's product-moment correlation as I read in a research paper that naturally dichotomous variables can be used in Pearson's correlation. I also did Phi coefficient correlation to see the comparison. I found that the value of association is the same, but the signs have reversed from negative in Pearson's to positive in phi. I am not able to understand why the signs changed.

Also, additional information, the variables are not exclusive; there are some colleges that have both types of recycling streams. Will that cause a problem in the analysis? Should I re-code these variables?

I think this has to do with how the phi ($$\phi$$) is calculated and reported by the software you use. Let's use an example and assume that we have a small data set with two dichotomous variables (0=no, 1=yes):

ss <- c(0,0,1,0,0,1,1,0,1,0)
ms <- c(1,1,0,1,0,1,0,1,0,1)


And we want to calculate the Pearson's correlation ($$r$$) using this formula:

$$r = \frac{\sum(x_i - \bar x)(y_i - \bar y)}{\sqrt{\sum(x_i-\bar x)^2 \sum(y_i-\bar y)^2}}$$

You can plug the numbers into the formula or simply run the function cor in R:

cor(ss, ms)
-0.5833333


As in your case, we have a negative $$r$$. Now, we can calculate $$\phi$$ for $$2 \times 2$$ contingency table using our two variables:

|     | ms |     |
|-----|----|-----|
| ss  | no | yes |
| no  | 1  | 5   |
| yes | 3  | 1   |


We can use the formula on this wikipedia page for $$\phi$$ coefficient. Let's assign letters to make it simple, and then plug the numbers:

|     | ms |     |
|-----|----|-----|
| ss  | no | yes |
| no  | A  | B   |
| yes | C  | D   |


$$\phi = \frac{AD-BC}{\sqrt{(A+B)(C+D)(A+C)(B+D)}} = \frac{1-15}{\sqrt{6 \times 4 \times 4 \times 6}} = -0.5833333$$

Exactly the same result. So, why do you have a positive value then? If you google around, you can see a different formula for $$\phi$$:

$$\phi = \sqrt{\frac{\chi^2}{N}}$$

In fact, this is the formula of Cramér's V (sometimes called Cramér's phi, $$\phi_c$$) simplified for $$2 \times 2$$ contingency tables. These two measures are related: "In the case of a $$2 \times 2$$ contingency table Cramér's V is equal to the absolute value of Phi coefficient." We can check this using our small data, where $$\chi^2 \approx 3.403$$

$$\phi_c = \sqrt{\frac{3.403}{10}} \approx 0.583$$

This could explain why you observe a reversal of sign.