**Somers’ D**, short for Somers’ Delta, is a measure of the strength and direction of the association between an ordinal dependent variable and an ordinal independent variable.

An *ordinal *variable is one in which the values have a natural order (e.g. “bad”, “neutral”, “good”).

The value for Somers’ D ranges between -1 and 1 where:

**-1:**Indicates that all pairs of the variables disagree**1:**Indicates that all pairs of the variables agree

Somers’ D is used in practice for many nonparametric statistical methods.

**Somers’ D: Definition**

Given two variables, X and Y, we can say :

- Two pairs (x
_{i}, y_{i}) and (x_{j}, y_{j}) are**concordant**if the ranks of both elements agree. - Two pairs (x
_{i}, y_{i}) and (x_{j}, y_{j}) are**discordant**

We can then calculate Somers’ D using the following formula:

**Somers’ D = (N _{C} – N_{D}) / (N_{C} + N_{D} + N_{T})**

where:

**N**The number of concordant pairs_{C}:**N**The number of discordant pairs_{D}:**N**The number of tied pairs_{T}:

The resulting value will always be between -1 and 1.

**Somers’ D: Example in R**

Suppose a grocery store would like to assess the relationship between the following two ordinal variables:

- The overall niceness of the cashier (ranked from 1 to 3)
- The overall satisfaction of the customer’s experience (also ranked from 1 to 3)

They collect the following ratings from a sample of 10 customers:

To quantify the relationship between the two variables, we can calculate Somers’ D using the following code in R:

#enter data nice <- c(1, 1, 1, 2, 2, 2, 3, 3, 3, 3) satisfaction <- c(2, 2, 1, 2, 3, 2, 2, 3, 3, 3) #loadDescToolspackage library(DescTools) #calculate Somers' D SomersDelta(nice, satisfaction) [1] 0.6896552

Somers’ D turns out to be **0.6896552**.

Since this value is fairly close to 1, this indicates that there is a fairly strong positive relationship between the two variables.

This makes sense intuitively: Customers who rate the cashiers as nicer also tend to rate their overall satisfaction higher.

**Additional Resources**

An Introduction to the Pearson Correlation Coefficient

An Introduction to Kendall’s Tau