Can I use Pearson correlation for discrete variables? Can I use Pearson correlation for discrete variables, if the level of measurement fits (either ratio or interval).
Thanks!
 A: Sure!
set.seed(2022)
N <- 100
x1 <- rpois(N, 5) # Poisson(5)
x2 <- rpois(N, 7) # Poisson(7)
cor(x1, x2)

At no point does the Pearson correlation make distribution assumptions beyond the covariance and variances existing.
A: The correlation coefficient, sure, if you're interested in measuring linear correlation.
If you want to test it, maybe -- you might sometimes need to consider using something else in place of the usual test, though.
The usual test is typically pretty level-robust but for example with count data (and often with other forms of discrete data) you tend to have (a) heteroskedasticity, related to the level of the mean; (b) nonlinear relationships; and (c) changing distribution shape as the mean changes. In particular (a) and (b) might lead to you consider other tests (whether using the same test statistic and a different approach to calculating p-values, or a slightly modified statistic, or even asking somewhat different questions of the data).
A: Yes, of course. Discrete variables belong to numerical data with ratio scale, and not categorical data. So you can use Pearson correlation coefficient to measure the relationship between those two variables.
A: In the case of binary variables, this is even given a special name, either Matthew's Correlation Coefficient (MCC) or the "Phi coefficient". MCC is simply the Pearson correlation of two binary variables.
A: It depends on what you mean in "discrete". You can use Pearson's R for discrete numeric variable. If the data are in ordinal scale, you should use Spearman's correlation. If the data are in nominal scale, then Pearson's and Spearman's coefficients are not valid, even if you code the categories by numbers.
