I would like to compute a correlation between observed values of X and Y, but the data is such that the values of X are discrete (and few), and with an equal number of data points for each value of X, as illustrated below.
This seems to me violate the (I believe, default) assumption for a function to only have one value of Y at every value of X. I know this applies to continuous functions and not to discrete observations, but even so the nature of this data (multiple y values for a given x) seems to not lend itself well to a simple correlation such as Pearson's R.
The problem seems to be mitigated by simply reversing the positions of X and Y on the axes, but the data makes more sense with X on the abscissa.
What would be an appropriate measure of the correlation between X and Y?