Search code examples
rbayesian

Bayes Factor values in the R package BayesFactor


I've followed the instructions on how to run a Bayesian 't-test' using default priors in the BayesFactor package in R.

Some of the returned values are astronomical.

Here is an example comparison with a huge Bayes factor:

#install.packages('BayesFactor')
library(BayesFactor)

condition1 <- c(0.94, 0.9, 0.96, 0.74, 1, 0.98, 0.86, 0.92, 0.918367346938776, 
                0.96, 0.4, 0.816326530612245, 0.8, 0.836734693877551, 0.56, 0.66, 
                0.605263157894737, 0.836734693877551, 0.84, 0.9, 0.92, 0.714285714285714, 
                0.82, 0.5, 0.565217391304348, 0.8, 0.62)

condition2 <- c(0.34, 0.16, 0.23, 0.19, 0.71, 0.36, 0.02, 0.83, 0.11, 0.06, 
                0.27, 0.347368421052632, 0.21, 0.13953488372093, 0.11340206185567, 
                0.14, 0.142857142857143, 0.257731958762887, 0.15, 0.29, 0.67, 
                0.0515463917525773, 0.272727272727273, 0.0895522388059701, 0.0204081632653061, 
                0.13, 0.0612244897959184)

bf = ttestBF(x = condition1, condition2, paired = TRUE)
bf

This returns:

Bayes factor analysis
--------------
[1] Alt., r=0.707 : 144035108289 ±0%

Against denominator:
  Null, mu = 0 
---
Bayes factor type: BFoneSample, JZS

For the most part the comparisons range from below 1 up to a few hundred. But I'm concerned that this value (144035108289!) is indicative of something erroneous on my part.

FYI: the p-value in the null-hypothesis test on the same data as above = 4.649279e-14.

Any assurances or insights into this returned BF would be much appreciated.


Solution

  • I calculated the BF using manual input of t-value and sample size like this using the same package:

    exp(ttest.tstat(t=14.63, n1=27, rscale = 0.707)[['bf']])
    

    It gives the same BF. It seems this is largely due to a relatively big sample size (27). The returned BF appears to be on the up-and-up.