-
Notifications
You must be signed in to change notification settings - Fork 9
Somer's D
Maurice HT Ling edited this page Aug 13, 2021
·
4 revisions
Purpose: To measure the strength of the correspondence between two rankings.
Null hypothesis: Correlation coefficient = 0
Alternate hypothesis: Correlation coefficient ≠ 0.
Code 1 (correlation between 2 sets of data):
>>> from scipy import stats
>>> X = [1, 2, 3, 4, 5]
>>> Y = [5, 6, 7, 8, 7]
>>> result = stats.somersd(X, Y)
>>> print("D = %.3f" % result.statistic)
D = 0.700
>>> print("p-value = %.3f" % result.pvalue)
p-value = 0.007
Code 2 (correlation between the rows and columns of a table):
>>> from scipy import stats
>>> table = [[3, 6, 10],
[4, 10, 8],
[7, 4, 3]]
>>> result = stats.somersd(table)
>>> print("D = %.3f" % result.statistic)
D = -0.277
>>> print("p-value = %.3f" % result.pvalue)
p-value = 0.022
Reference:
- Somers RH. 1962. A New Asymmetric Measure of Association for Ordinal Variables. American Sociological Review 27(6), 799–811.
Copyright (c) 2008-2024, Maurice HT Ling
Refereed Publications and Technical Reports
Abstracts and Other Un-Refereed Works
Autobiographic Verses (Poems that I wrote) and My Sayings