correlation
correlation copied to clipboard
Is Bayesian Kendall's tau working as expected?
Based on my reading of the below code, if you set bayesian = TRUE
and method = "kendall"
then you get routed to .cor_test_bayes(method = "kendall")
from L256 of cor_test()
and then method = "pearson"
on L24 of cor_test_bayes()
without ever rank-transforming the data. Unless I am missing something, this is just calculating Pearson correlations on the untransformed data and calling them Kendall's tau correlations.
https://github.com/easystats/correlation/blob/73471db03fe91accf9f32c102dfa5041c26564dc/R/cor_test.R#L233-L268
https://github.com/easystats/correlation/blob/73471db03fe91accf9f32c102dfa5041c26564dc/R/cor_test_bayes.R#L16-L26
Example:
correlation::correlation(mtcars[, 1:3], bayesian = TRUE, method = "kendall")
#> # Correlation Matrix (kendall-method)
#>
#> Parameter1 | Parameter2 | rho | 95% CI | pd | % in ROPE | BF | Prior
#> --------------------------------------------------------------------------------------------------
#> mpg | cyl | -0.80 | [-0.90, -0.64] | 100%*** | 0% | > 1000*** | Beta (3 +- 3)
#> mpg | disp | -0.79 | [-0.90, -0.65] | 100%*** | 0% | > 1000*** | Beta (3 +- 3)
#> cyl | disp | 0.86 | [ 0.74, 0.93] | 100%*** | 0% | > 1000*** | Beta (3 +- 3)
#>
#> Observations: 32
Created on 2021-12-20 by the reprex package (v2.0.1)
I think you might be right 🙈
A decent approach might be to use the BBcor package as the backend here? https://github.com/donaldrwilliams/bbcor/
yes i think we should fall back to BBcor to support more bayesian correlations types