Skip to content

New effect size: Most Extreme (ECDF) Differences#698

Draft
mattansb wants to merge 2 commits intomainfrom
MED
Draft

New effect size: Most Extreme (ECDF) Differences#698
mattansb wants to merge 2 commits intomainfrom
MED

Conversation

@mattansb
Copy link
Copy Markdown
Member

@mattansb mattansb commented Mar 27, 2026

  • Convert htest (ks.test())
  • Better name than MED?
  • merge pdf and y args somehow?
library(effectsize)

x <- rnorm(50)
y <- runif(30)

# Do x and y come from the same distribution?
ks.test(x, y)
#> 
#>  Exact two-sample Kolmogorov-Smirnov test
#> 
#> data:  x and y
#> D = 0.52, p-value = 3.885e-05
#> alternative hypothesis: two-sided
med(x, y)
#> d    |       95% CI
#> -------------------
#> 0.52 | [0.07, 0.97]

# Is the CDS of x larger than that of y?
ks.test(x, y, alternative = "l")
#> 
#>  Exact two-sample Kolmogorov-Smirnov test
#> 
#> data:  x and y
#> D^- = 0.1, p-value = 0.6509
#> alternative hypothesis: the CDF of x lies below that of y
med(x, y, alternative = "l")
#> d    |       95% CI
#> -------------------
#> 0.10 | [0.00, 0.48]
#> 
#> - One-sided CIs: lower bound fixed at [0.00].

plot(ecdf(x), xlim = range(c(x, y)), col = "blue")
lines(ecdf(y), col = "red")

# Does x come from a shifted gamma distribution with shape 3 and rate 2?
ks.test(x+2, "pgamma", 3, 2)
#> 
#>  Exact one-sample Kolmogorov-Smirnov test
#> 
#> data:  x + 2
#> D = 0.3478, p-value = 6.565e-06
#> alternative hypothesis: two-sided
med(x+2, pdf = "pgamma", shape = 3, rate = 2)
#> d    |       95% CI
#> -------------------
#> 0.35 | [0.07, 0.62]

plot(ecdf(x + 2), xlim = range(x + 2), col = "blue")
curve(pgamma(x, 3, 2), col = "red", add = TRUE)

Created on 2026-03-27 with reprex v2.1.1

@mattansb mattansb marked this pull request as draft March 27, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant