Skip to content

Conversation

@arcaldwell49
Copy link
Contributor

Description

This PR aims at adding WMWodds (Agresti's Generalized Odds Ratio) to the rank based effect sizes. Using the odds_to_probs function, the output can be considered a concordance probability or a non-parametric probability of superiority.

Proposed Changes

I created the wmw_odds function which effectively mimics rank_biserial but instead calculates the odds. Tests and vignettes have also been added.

@arcaldwell49 arcaldwell49 marked this pull request as ready for review September 23, 2022 21:12
@arcaldwell49
Copy link
Contributor Author

Conflicts will need to be resolved, but all changes to files other than rank_effectisizes.R, man/rank_biserial.Rd, and tests/testthat/test-rankES.R can be ignored or ditched.

@mattansb
Copy link
Member

I'm reading the docs, and it seems like this function would be better suited under the common-language effect sizes.

Also, it seems like this function produces the same results are rank_biserial() |> rb_to_cles() |> probs_to_odds() (with or without ties) with CIs from wmw_odds() being slightly (?) more conservative.

library(effectsize)

p <- rb_to_cles(rank_biserial(mpg ~ am, data = mtcars))
p[c(2, 4:5)] <- lapply(p[c(2, 4:5)], probs_to_odds)
colnames(p)[2] <- "odds"
p[-1]
#> odds |       95% CI
#> -------------------
#> 0.20 | [0.09, 0.47]

# The same...?
wmw_odds(mpg ~ am, data = mtcars)
#> odds |       95% CI
#> -------------------
#> 0.20 | [0.07, 0.58]





x <- c(1.83,  0.50,  1.62,  2.48, 1.68, 1.88, 1.55, 3.06, 1.30)
y <- c(0.878, 0.647, 0.598, 2.05, 1.06, 1.29, 1.06, 3.14, 1.29)

p <- rb_to_cles(rank_biserial(x, y))
p[c(2, 4:5)] <- lapply(p[c(2, 4:5)], probs_to_odds)
colnames(p)[2] <- "odds"
p[-1]
#> odds |       95% CI
#> -------------------
#> 2.52 | [0.84, 7.55]

# The same...?
wmw_odds(x, y)
#> odds |       95% CI
#> -------------------
#> 2.52 | [0.66, 9.61]




p <- rb_to_cles(rank_biserial(cyl ~ am, data = mtcars))
p[c(2, 4:5)] <- lapply(p[c(2, 4:5)], probs_to_odds)
colnames(p)[2] <- "odds"
p[-1]
#> odds |       95% CI
#> -------------------
#> 3.66 | [1.60, 8.37]

# The same...?
wmw_odds(cyl ~ am, data = mtcars)
#> odds |       95% CI
#> -------------------
#> 3.66 | [1.48, 9.07]

Created on 2022-09-24 by the reprex package (v2.0.1)

So unless there is a reason not to use rank_biserial() |> rb_to_cles() |> probs_to_odds(), I think we should go forward with this instead (sorry for all your hard work!)

@arcaldwell49
Copy link
Contributor Author

Okay, I have two reasons.

  1. The coverage of confidence intervals for the rank_biserial() |> rb_to_cles() |> probs_to_odds() is quite poor IMO. I ran a short set of simulations for the Fisher r-to-z for WMWodds and coverage is not adequate even under the null hypothesis. The Agresti normal approximation I have written is still quite liberal when the effect size is large (odd < .75 and odds > 1.5 respectively), but certainly performs better than the Fisher transform approach.

  2. wmw_odds has an option for paired samples. Currently, the cles function does not allow for paired samples comparisons. Now, I will admit the confidence intervals for this method are very conservative.

For example:

> cles(extra ~ group, data = sleep, parametric = FALSE, paired = TRUE)
Error in rank_biserial(x = x, y = y, paired = FALSE, mu = mu, ci = ci,  : 
  formal argument "paired" matched by multiple actual arguments

> wmw_odds(extra ~ group, data = sleep, parametric = FALSE, paired = TRUE)
odds |       95% CI
-------------------
0.05 | [0.01, 0.53]

rank_biserial(extra ~ group, data = sleep, parametric = FALSE, paired = TRUE) |> rb_to_cles() |> probs_to_odds(
+ )
 Error: Common language effect size only applicable to 2-sample rank-biserial correlation.

It's totally up to you and your team, but as a user of effectsize, I would really like this function 😓

Happy to convert this over to cles if you want to reconsider its inclusion!

@mattansb
Copy link
Member

Here's what I suggest:

  1. Add this function to CLES using the transformations I noted above

  2. Open a new issue / pr to discuss improving the CI covered for all of these methods - since they are all monotonic transformations of one another, it makes sense to me they can be improved together.

@arcaldwell49
Copy link
Contributor Author

Ok, I will get on that shortly and thank you!

I will close this pull request and start working on the CLES improvements.

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.

2 participants