Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Bayes Factors for non-parametric tests

Is there a way to get Bayes Factor for a Mann-Whitney U ?


  • Yes. Johnny has developed and implemented it. I'll ask him about the current status as far as the JASP implementation is concerned (the paper is at


  • Hi Peterose1,

    If you want to conduct the two-sample test, this is readily available in JASP. I am still in the process of implementing the one-sample versions - if you want I can link you some R-code that gives you a Bayes factor and posterior distribution.



  • Thanks, JonnyB. We are doing a 2-sample comparison, so can use JASP.



  • Hi there,

    I'm in search of R-code to output a Bayes factor with the two-sample test so as to embed it in my markdown doc. Would you mind sharing, or pointing me in this direction?

    Many thanks,


  • Hi Elise,

    The R-code can be found on the OSF page of the corresponding article (under review atm).

    You give it the observations from the two groups (first two arguments of the function), then take the vector of 'deltaSamples' that it outputs and feed it into the giveBayesFactorZeroOne function.

    The article can be found on Arxiv (



  • Dear JohnnyB,

    Thanks for supporting R codes to run Bayes Factor for a Mann-Whitney U. However, as a newbie of R and statistic, I am getting difficulties to run those codes (after loading rankSumSampler.R to R environment). Do we need to use the WinBUGS package or several packages like this to run the above codes?.

    I am appreciating you if you have the guidance in detail for newbies.

    Thank you very much and waiting for hearing from you.

  • Hi Elnino,

    What error message are you getting? The only R package you need installed is the logspline package - you can install it with install.packages("logspline"). After that all code should run. If you have any additional questions about this you can also send me an email at johnnydoorn at gmail dot com and I can help you out!



  • Dear JohnnyB.

    Thank you for your kind help. I am firstly trying with your above teaching and if there are troubles that happened, I hope that you will also help me via an E-mail as a discussion.

    I am following a paper of "Bayesian rank-based hypothesis testing for the rank sum test, the signed rank test, and Spearman's ρ" to wish to have a little paper in my field as a first paper for graduating (I am a Vietnamese Ph.D. student in National Japanese University).

    Thank you very much,

    Tan-Duc Nguyen

  • Hi Johnny,

    It's awesome that you shared the R code, but I too have some questions about how to use it.

    1. The result is always "BF01" (e.g. regardless of specific xVals or yVal input vectors), i.e. the giveBayesFactorZeroOne output BF < 1 is always evidence for difference, while BF > 1 is always evidence for equivalence, right?

    2. The usage is the same for rankSumGibbsSampler (for unpaired) and signRankGibbsSampler (for paired), so e.g. I just give either the rankSumGibbsSampler(v1, v2)$deltaSamples or signRankGibbsSampler(v1, v2)$deltaSamples for the giveBayesFactorZeroOne function? In the two R files, the giveBayesFactorZeroOne is given separately each time, but it's identical. (I see the optional parameter "paired = TRUE", but it's never actually used in that function.)

    3. How do I get BFs from spearmanGibbsSampler? It returns "rhoSamples" – can I perhaps use that as argument for the giveBayesFactorZeroOne function (in place of deltaSamples)?

    4. I suppose this is something extra, but is there perhaps some easy way to set any of these tests to be one-sided?

  • Hi Gaspar,

    1) Yes, the R-code is limited that way, in that it only does the two-sided tests.

    2) The giveBAyesFactorZeroOne is the same for both the rank sum and signed rank test, since it applies the Savage-Dickey density ratio (i.e., the ratio of the prior and posterior densities at the point of testing - 0), and both of those tests use a Cauchy prior distribution. Initially I thought it would be different, hence the argument in the function definition.

    3) you can pass the rhoSamples to the function, and specify the "corTest" argument to TRUE - then it will compute the Bayes factor for the correlation (also through the Savage-Dickey density ratio, but now with a uniform prior distribution).

    4) the nonparametric t-tests are also implemented in JASP, and there I did add the option to do one-sided testing. In JASP, you also get some nice plots of the prior/posterior distribution.

    Kind regards,


  • I see, great – thanks so much for the super fast reply!

  • Being a newbie in JASP, but fluent in R. I've downloaded all files from OSF link However it seems that this set of files does not contain giveBayesFactorZeroOne function. I cannot run `giveBayesFactorZeroOne(rankSumGibbsSampler(v1, v2)$deltaSamples)`. Can anyone give me a hint what am I doing wrong? Thanks!

  • Hi Pmilin,

    Did you also download and source the rankBasedCommonFunctions.R file?

    I restructured it a bit to maintain a clearer overview of all the functions.



  • Hi Johnny,

    Yes I did and call me crazy but it does not contain contain giveBayesFactorZeroOne function!

    Help! :-)

  • Hi Pmilin,

    Oh sorry, I just realized I renamed it to "computeBayesFactorOneZero", to make it a bit more accurate. Apologies for the confusion!



  • No worries! 😂

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games