I am researching how to calculate Somers' D in python for a discrete dependent variable and continuous independent variable, I found this answer on stack overflow:
In short, the question poses the following Somers' D formula:
X = The independent variable (In my case, continuous)
Y = The dependent variable (In my case, discrete [1, 2, 3, 4, 5])
N_tot = len(X)*(len(X)-1) / 2
Somers D = (N_C - N_D) / (N_tot - N_Tie_y)
And I am wondering why the Somers' D calculation removes the Number of times Y ties? Why is the formula not
N_tot = len(X)*(len(X)-1) / 2
Somers D = (N_C - N_D) / (N_tot)
I further have found the reference to this Wikipedia article (as mentioned in the stack overflow question) and see that this implementation of removing the number of Binary Y ties is proposed.
https://en.wikipedia.org/wiki/Somers%27_D
However, I am still wondering whether this is suitable for a problem with a discrete Y dependent variable with buckets from 1 to 5 [1, 2, 3, 4, 5]
Option 1:
N_tot = len(X)*(len(X)-1) / 2
Somers D = (N_C - N_D) / (N_tot - N_Tie_y)
Option 2:
N_tot = len(X)*(len(X)-1) / 2
Somers D = (N_C - N_D) / (N_tot)
Option 3:
Somers D = Kendall's Tau(X, Y) / Kendall's Tau(X, X)