-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with ranktransform for correlations #87
Comments
I would expect (I don't know any correlation that uses a signed rank variable... maybe some weird point biserial something?) (why was that happening? It does seem like a mistake to me too...) |
I'm not sure, indeed an error, I'll set signed to False (additionally I misread the email so I thought there was something wrong with the computation itself) |
Oh, I see, it is a double issue:
x <- c(-1,2,-3,4)
effectsize::ranktransform(x, sign = TRUE)
#> [1] -2 3 -1 4
# should be:
abs(x) * sign(x)
#> [1] -1 2 -3 4 Created on 2020-06-23 by the reprex package (v0.3.0) |
🙉 |
Fixing (: |
in your R package 'correlation' the function 'cor_test' uses the following procedure to rank-transform the data if both the 'bayesian' and the 'robust' arguments are set to TRUE.
effectsize::ranktransform(data[c(x,
y)], sign = TRUE, method = "average")
I am not sure whether you intended to use signed ranks. Using signed ranks, original values are rank-transformed in ascending order and signs are preserved. For instance, a vector with values -10, -8, -5, -1 and 3 is rank-transformed to -1 -2 -3 -4 5.
In my calculations I found that, due to this signed rank-transformation, the robust bayesian estimate differed considerably from the spearman coefficient (which is based on unsigned ranks). This may also result in flipped correlations. Maybe you want to have a look at the ranktransform code snippet in the cor_test function.
Should we address it here or in correlation? 🤔
The text was updated successfully, but these errors were encountered: