Skip to content

Commit 92dbf66

Browse files
Spearman's Rank Correlation
1 parent f6162ec commit 92dbf66

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from scipy.stats import spearmanr
2+
3+
data1 = [0.873, 2.817, 0.121, -0.945, -0.055, -1.436, 0.360, -1.478, -1.637, -1.869]
4+
data2 = [0.353, 3.517, 0.125, -7.545, -0.555, -1.536, 3.350, -1.578, -3.537, -1.579]
5+
6+
stat,p = spearmanr(data1,data2)
7+
8+
print('stat = %.3f p =%.3f' % (stat,p))
9+
10+
if p>0.05:
11+
print("Probably independent")
12+
else:
13+
print("Probably dependent")

0 commit comments

Comments
 (0)