0

if i have 10 pairs of values but the range of the values is very narrow - values are 2 or 3. is it ok to calculate spearman correlation for this? for example:

2 3
2 2
3 3
2 3
2 2
3 3
3 3
3 2 
whuber
  • 322,774
  • 3
    You can calculate it. The issue concerns what you intend to do with it. – whuber Nov 24 '19 at 18:26
  • thank you. My hypothesis is that there is a significant positive correlation between variable A and variable B. and i wondered if the fact that the variables distribute very narrowly is a problem.. so you say that it's ok? – Sharon Shimshi Nov 24 '19 at 18:33
  • If you have only two values, perhaps it makes sense to count the values of each for each group, and then use a chi-square test of association? – Sal Mangiafico Nov 24 '19 at 19:17

1 Answers1

0

Because Spearman's correlation uses ranks, it tends to work best if there are few ties. (In the example you just posted, the number of ties seems excessive. It is not clear what you'd mean by 'correlation'.)

The numeric span from smallest to largest is not important. Multiplying both x and y by 100 would not change the Spearman correlation.

Consider my example for continuous data (no ties) and then for rounded data with a moderate number of ties.

set.seed(1124)
x = rnorm(20, 50, 2)
e = rnorm(20, 0, 2)
y = x + e
cor(x,y, meth="s")
[1] 0.7789474

X = round(x)
Y = round(y)
cor(X,Y, meth="s")
[1] 0.7097657     # smaller Spearman corr for rounded data


par(mfrow=c(1,2))
  plot(x,y, pch=20, main="Original")
  plot(X,Y, pch=20, main="Rounded")
par(mfrow=c(1,1))

enter image description here

Addendum for your data (if I copied them correctly):

cor(c(2,2,3,2,2,3,3,3), c(3,2,3,3,2,3,3,2), meth="s")
[1] 0.2581989
BruceET
  • 56,185