richarddmorey / BayesFactor

BayesFactor R package for Bayesian data analysis with common statistical models.
https://richarddmorey.github.io/BayesFactor/
132 stars 49 forks source link

Extracting Bayes factor from ttestBF output #152

Closed pietromarchesi closed 3 years ago

pietromarchesi commented 3 years ago

Is there a way to extract the Bayes factor as a float from the ttestBF output? I am trying this:

> a = c(0.5, 0.6, 0.4, 0.5, 0.67, 0.5)
> b = c(0.7, 0.8, 0.7, 0.91, 0.93, 0.87)
> 
> ttestBF(x=a, y=b, paired=TRUE)

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

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

> 
> out = ttestBF(x=a, y=b, paired=TRUE)
> out@bayesFactor[['bf']]
[1] 4.304001

But I am unable to dig the 73.99527 out, I only get this 4.304001, which I also see popping up in the numerator slot.

EDIT: solved with extractBF(out)['bf']