Skip to contents

Cliff's \(\delta\), the nonparametric dominance effect size for two independent samples, with Cliff's asymmetric confidence interval.

Usage

cliffDelta(
  x,
  y,
  conf.level = NA,
  sides = c("two.sided", "left", "right"),
  na.rm = FALSE
)

Arguments

x, y

non-empty numeric vectors of data values. Positive \(\delta\) means that values of x tend to be larger.

conf.level

confidence level of the interval. If set to NA (the default), only the point estimate is returned.

sides

character string specifying the sidedness of the confidence interval (one of "two.sided" (default), "left" or "right"). See ConfidenceIntervals(). The open side is \(\pm 1\).

na.rm

logical. Should missing values be removed (separately in both samples)? Defaults to FALSE, in which case a missing value gives NA.

Value

if conf.level = NA, a numeric scalar. Otherwise a named numeric vector with elements est, lci and uci. The attribute probs holds the estimated \(P(X > Y)\), \(P(X = Y)\) and \(P(X < Y)\), the attribute magnitude the verbal category (see Details).

Details

$$\delta = P(X > Y) - P(X < Y),$$ estimated by the mean of \(\mathrm{sign}(x_i - y_j)\) over all \(n_x n_y\) pairs. \(\delta\) lies in \([-1, 1]\); it is 0 when neither group tends to give larger values, and \(\pm 1\) when every value of one group exceeds every value of the other. Ties count as neither. It depends on the data only through their order, so it is invariant under monotone transformations and insensitive to outliers.

\(\delta\) is a linear function of the probability of superiority \(p = P(X > Y) + \frac12 P(X = Y)\) (Vargha & Delaney's \(A\), the common-language effect size, the AUC): \(\delta = 2p - 1\). It is also the Mann-Whitney \(U\) rescaled: \(\delta = 2U/(n_x n_y) - 1\). The three probabilities are returned in the attribute probs.

The confidence interval is Cliff's (1996, eq. 5.12), which does not assume equal distributions under the alternative and respects the bounds \(\pm 1\). Its variance estimate combines the variances of the per-observation dominance values of both samples with the variance of the pairwise signs. When \(|\hat\delta| = 1\) this variance is zero, and the interval is derived, as in Wilcox's cid(), from Pratt's binomial interval for the proportion 1 out of \(\max(n_x, n_y)\). Wilcox (2022) found this interval to perform well also with heavy ties and unequal variances.

The computation needs \(O((n_x + n_y)\log(n_x + n_y))\) operations, not the \(n_x n_y\) of the pairwise definition.

The attribute magnitude classifies \(|\delta|\) with the thresholds of Romano et al. (2006): negligible \(< 0.147\), small \(< 0.33\), medium \(< 0.474\), large otherwise. These correspond to Cohen's 0.2, 0.5 and 0.8 under normality and are a rough guide only.

References

Cliff, N. (1993) Dominance statistics: ordinal analyses to answer ordinal questions. Psychological Bulletin, 114, 494-509.

Cliff, N. (1996) Ordinal Methods for Behavioral Data Analysis. Erlbaum, Mahwah, NJ.

Romano, J., Kromrey, J. D., Coraggio, J., Skowronek, J. (2006) Appropriate statistics for ordinal level data. Annual meeting of the Florida Association of Institutional Research.

Wilcox, R. R. (2022) Introduction to Robust Estimation and Hypothesis Testing, 5th ed. Academic Press, sec. 5.7.

Examples

x <- Pizza$delivery_min[Pizza$driver == "Carter"]
y <- Pizza$delivery_min[Pizza$driver == "Miller"]

cliffDelta(x, y, na.rm = TRUE)
#> [1] -0.07490598
#> attr(,"probs")
#>      P(X>Y)      P(X=Y)      P(X<Y) 
#> 0.460923077 0.003247863 0.535829060 
#> attr(,"magnitude")
#> [1] "negligible"
cliffDelta(x, y, conf.level = 0.95, na.rm = TRUE)
#>         est         lci         uci 
#> -0.07490598 -0.19730907  0.04979674 
#> attr(,"probs")
#>      P(X>Y)      P(X=Y)      P(X<Y) 
#> 0.460923077 0.003247863 0.535829060 
#> attr(,"magnitude")
#> [1] "negligible"

# an ordinal variable works as well
cliffDelta(c(1, 2, 2, 3, 3, 3, 4), c(1, 1, 2, 2, 2, 3))
#> [1] 0.452381
#> attr(,"probs")
#>    P(X>Y)    P(X=Y)    P(X<Y) 
#> 0.5952381 0.2619048 0.1428571 
#> attr(,"magnitude")
#> [1] "medium"

# complete separation: interval from the binomial bound
cliffDelta(11:20, 1:10, conf.level = 0.95)
#>       est       lci       uci 
#> 1.0000000 0.4822689 1.0000000 
#> attr(,"probs")
#> P(X>Y) P(X=Y) P(X<Y) 
#>      1      0      0 
#> attr(,"magnitude")
#> [1] "large"