Phi Coefficient Calculator
Measure association in 2×2 tables.
2×2 Contingency Table
Enter cell values to calculate phi coefficient
Use the phi coefficient when you have a 2×2 contingency table and want to measure the strength of association between two binary variables. It's equivalent to Pearson's correlation coefficient calculated on two dichotomous variables.
What Is the Phi Coefficient?
The phi coefficient (φ) measures association between two binary variables. It ranges from -1 to +1:
- φ = 1: Perfect positive association
- φ = 0: No association
- φ = -1: Perfect negative association
For a 2×2 table:
| B = 1 | B = 0 | |
|---|---|---|
| A = 1 | a | b |
| A = 0 | c | d |
Relationship to Chi-Square
Phi is directly related to the chi-square statistic:
Or equivalently:
This means you can convert between phi and chi-square easily.
Example Calculation
Data: Treatment vs. Recovery
| Recovered | Not Recovered | |
|---|---|---|
| Treatment | 45 | 15 |
| Control | 25 | 35 |
- a = 45, b = 15, c = 25, d = 35
- n = 120
Interpretation: Moderate positive association between treatment and recovery.
Interpreting Phi Values
| |φ| | Interpretation | |-----|----------------| | 0.00 - 0.10 | Negligible | | 0.10 - 0.20 | Weak | | 0.20 - 0.40 | Moderate | | 0.40 - 0.60 | Relatively strong | | 0.60 - 0.80 | Strong | | 0.80 - 1.00 | Very strong |
These guidelines are approximate; context matters.
Phi vs. Other Measures
| Measure | Tables | Range | Notes |
|---|---|---|---|
| Phi (φ) | 2×2 only | -1 to +1 | Directional, like correlation |
| Cramér's V | Any size | 0 to 1 | Non-directional, generalizes phi |
| Contingency C | Any size | 0 to <1 | Upper bound varies with table size |
| Odds Ratio | 2×2 | 0 to ∞ | Magnitude of association |
For 2×2 tables, φ = V (Cramér's V equals phi).
Sign of Phi
Unlike Cramér's V, phi can be negative:
- Positive φ: Variables tend to have the same category (both 1 or both 0)
- Negative φ: Variables tend to have opposite categories (one 1, one 0)
The sign depends on how you code the variables.
Confidence Interval for Phi
For large samples, the standard error of phi is approximately:
95% confidence interval:
For the example above:
Testing Significance
To test if φ ≠ 0:
- Calculate chi-square:
- Compare to chi-square distribution with df = 1
- Or use the p-value from a chi-square test
For the example:
With df = 1, p < 0.001, so the association is statistically significant.
Applications
Medical Research
Association between:
- Treatment and outcome
- Risk factor and disease
- Two diagnostic tests
Psychology
Association between:
- Gender and response
- Condition and behavior
- Two binary survey items
Education
Association between:
- Teaching method and pass/fail
- Intervention and graduation
Marketing
Association between:
- Ad exposure and purchase
- Segment and conversion
Phi as Pearson Correlation
When both variables are coded 0/1, phi equals the Pearson correlation:
This is because:
- Pearson correlation works on any numeric data
- Binary 0/1 variables are numeric
- The phi formula is algebraically equivalent to Pearson's r for this case
Maximum Possible Phi
Phi can only reach ±1 if the marginal distributions are identical. If marginals differ, the maximum |φ| is less than 1.
Maximum phi given marginals:
Where and are the proportions in each row/column.
Phi vs. Tetrachoric Correlation
If the binary variables are dichotomized continuous variables that are actually normally distributed, the tetrachoric correlation estimates what the Pearson correlation would have been. Phi underestimates this underlying correlation.
Use tetrachoric when:
- Variables are truly continuous but measured as binary
- You want to estimate the latent correlation
Use phi when:
- Variables are genuinely dichotomous
- You want the observed association
Assumptions
- Two binary variables: Each variable has exactly two categories
- Independent observations: Each observation is independent
- Random sampling: Data comes from random sampling
No distributional assumptions are required.
Historical Context
The phi coefficient was developed by Karl Pearson in the early 1900s as part of his work on correlation. It extended the product-moment correlation to binary data.
The relationship to chi-square was recognized early, making phi a natural effect size measure for 2×2 tables.
Related Calculations
- Cramér's V Calculator — For larger tables
- Chi-Square Test — Significance testing
- Odds Ratio Calculator — Alternative effect measure
- Pearson Correlation — For continuous variables
- Point-Biserial Correlation — Binary vs. continuous
Summary
The phi coefficient measures association between two binary variables in a 2×2 table. It ranges from -1 to +1, with the sign indicating direction. Phi equals the Pearson correlation for 0/1 coded variables and is related to chi-square by φ = √(χ²/n). Use phi for simple, interpretable effect sizes in 2×2 tables; use Cramér's V for larger tables or when you need a non-directional measure.