Howdy, Stranger!

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

Supported by

Simulating Bayes Factors: Extreme variability and absurd values?

I'm doing some Bayesian simulations (via R/BayesFactor) to better understand some data that I have, and have run into some strange results. Generated data is for a 2-group, between-subjects design (N = 500 per group, 10,000 samples generated) with a medium effect. Here's the code I used:

library(truncnorm)

seed <- round(runif(10000)*1000000)

makedata = function(x) {
  set.seed(x)
  #Generate condition 1 values
  a1 = rtruncnorm(500, a=0, b=1, mean = 0.55, sd = .22)
  #Generate condition 2 values
  b1 = rtruncnorm(500, a=0, b=1, mean = 0.46, sd = .26)
  a2 = as.data.frame(a1)
  b2 = as.data.frame(b1)
  a3 = a2 
  b3 = b2
  dat = bind_cols(a3, b3)
}

The distributions of condition means appear as expected:

..and for the effect size distribution, the results are reasonable as well:

However, where it gets weird are the corresponding Bayes Factors for the mean differences. Here are the descriptives for the BF10s:

These values seem absurd (particularly the range/variability), at least given the seemingly reasonable values of group means and effect sizes. I'm aware that large BFs are possible with large samples/large effects, but I'm wondering if the higher variability in BFs is par for the course for Bayes Factors, or if something is going wrong with my simulations (which I'm happy to provide further details about). I've included the rest of the (highly unoptimized) code used to generate the datasets and means/effect sizes/BFs below:

datasets = lapply(seed, makedata) #Make datasets
BFresults = lapply(datasets, function(x) ttestBF(x = x$a1, y = x$b1, paired = FALSE)) #Bayesian t-tests for each dataset
BFresultsdata = lapply(BFresults, function(x) as.data.frame(x)) #Make them data frames
BFs = lapply(BFresultsdata, function (x) x[["bf"]]) #Get Bayes Factors
BFsD = as.data.frame(BFs)
BFsDT = as.data.frame(t(BFsD))
names(BFsDT) = c("BF10")
BFajrjcont1000 = BFsDT #Final data frame with all Bayes Factors

effresults = lapply(datasets, function(x) cohen.d(d = x$a1, f = x$b1, paired = FALSE)) #Effect sizes for each dataset
effsizes = lapply(effresults, function(x) x$estimate) #Get Cohen's ds
effsizesdata = as.data.frame(effsizes)
EffsDT = as.data.frame(t(effsizesdata))
names(EffsDT) = c("d")
Effajrjcont1000 = EffsDT #Final data frame with all Cohen's ds

ameanresults = lapply(datasets, function(x) mean(x$a1)) #Get condition 1 means
bmeanresults = lapply(datasets, function(x) mean (x$b1)) #Get condition 2 means
ameandata = as.data.frame(ameanresults) 
ameandataDT = as.data.frame(t(ameandata))
bmeandata = as.data.frame(bmeanresults)
bmeandataDT = as.data.frame(t(bmeandata))
meansdataajrjcont1000 = bind_cols(ameandataDT, bmeandataDT) #Final data frame with condition means

describe(BFajrjcont1000$BF10)
describe(Effajrjcont1000$d)
describe(meansdataajrjcont1000)


Comments

  • Hi Eric,

    Two quick remarks:

    1. Since BFs are defined as ratios, averaging them is problematic. For instance, assume data set 1 gives BF10 = 3, and data set 2 gives BF10 = 1/3. Overall, the data are nondiagnostic, but averaging 3 and 1/3 does not give 1. This is why people usually first apply a log transform before averaging.
    2. When the effect size is large, and you have n=500, your BF can be huge. How huge depends on the height of the posterior distribution at delta=0. When the posterior distribution is peaked/far away from zero, this means that the effect depends on the tail of a distribution (which falls of exponentially). So yes, for whopper-sized effects, the absolute size of the BF can vary quite a bit. But I would argue that it does not matter that much whether BF = 10,000 or 1,000,000.

    Cheers,

    E.J.

  • E.J.,

    Thanks for the reply! Looking at the descriptives and distribution of the log(BF10)s, things make more sense. To make sure I'm understanding the 2nd point correctly: is it that the variability in BF10s w/larger effects is due to the dependence on the tails of the posterior distributions, which are more sensitive to sample-to-sample changes than say, the peak?

    Thanks!

    Eric

  • Yes, that's right

    Cheers,

    E.J.

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 http://45.77.173.118/ 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