2
$\begingroup$

Is it correct to measure the correlation coefficient between a continuous variable and a discrete variable? I visualized it and there is definitely no linear relationship the way I see it that is why I decided that it was not possible to calculate the correlation coefficient for it. These are the two variables I am working with show on a marginal graph. enter image description here

$\endgroup$
5
  • $\begingroup$ What is x in your case ? $\endgroup$
    – CaroZ
    Dec 5, 2023 at 14:59
  • $\begingroup$ Y-area of apartment x-Number of bedrooms-discrete (1,2,3,4,5) $\endgroup$ Dec 5, 2023 at 15:12
  • 2
    $\begingroup$ By applying the formula you can demonstrate it is possible to compute a correlation coefficient: all you need are pairs of numbers. What it means depends on what the values of $x$ and $y$ represent. And whether it's appropriate to do the calculation at all depends on your analytical objectives. Consider, then, editing your question to include such information. $\endgroup$
    – whuber
    Dec 5, 2023 at 15:18
  • 1
    $\begingroup$ Such a correlation would indicate something about stochastic ordering over the pairs, but further consideration is needed. $\endgroup$
    – Galen
    Dec 5, 2023 at 15:31
  • 1
    $\begingroup$ This might be a stupid question, but why wouldn't you consider the number of bedrooms as continuous ? $\endgroup$
    – CaroZ
    Dec 5, 2023 at 16:05

1 Answer 1

0
$\begingroup$

Following on from whuber's answer, perhaps your question should be - can I make reliable inference about the correlation coefficient (for example a p-value associated with a test for r = 0)? I guess that you are worried that the data will not be bivariate-Normal because "bedrooms" is discrete, but in practice most variables used in correlation analysis will be ordered discrete (even your "area of apartment" is likely recorded to the nearest m^2) the issue is the number of levels. 5 levels, with most of the data concentrated in one of them, could be rather 'chunky'. If you are worried about this then you could use a non-parametric correlation coefficient or use a permutation test for r = 0. However, given that a bedroom will have non-zero floor area, there is no question that there will be a significant correlation - as long as the sample size is big enough. What would be more interesting is whether your correlation is different from, e.g. those in another city/country (could use bootstrapping to estimate a confidence interval for r) or whether the relationship is non-linear. Perhaps you should embrace the discrete nature of bedrooms and analyze this as an ANOVA with ordered factor. With that you can test for linear or polynomial effects.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.