richarddmorey / BayesFactor

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

A huge difference of BF of ttest between ttestBF and JASP #170

Closed AaronZheng87 closed 5 months ago

AaronZheng87 commented 5 months ago

Dear developers I found there are different results when I use BayesFactor::ttestBF and JASP to calculate BF10 value based on independent t test. But the result from JASP met the result from BayesFactor::lmBF, I am wondering why?

Looking forward to your reply!

9bo2KGCTuk al7heqe2cp 6u4Q6awOmI
richarddmorey commented 5 months ago

Without your data and code, it is impossible to say what's going on (or even to understand your analysis) but I see in your JASP analysis a BF of 21.332, and in your BayesFactor analysis a BF of 21.33138. Are these the BFs you're saying are different?

AaronZheng87 commented 5 months ago

Dear developer

I used the ttestBF function and the result is 8.612346e+89 ±0%:

ttestBF(y = dat$BEH, x = dat$PRIME, paired=FALSE,rscale=sqrt(2)/2)

it is different This is different from the result of jasp: 21.332. But the result of JASP is similar to the result of lmBF:21.33138

The whole code is:

rm(list=ls())
library(pacman)
p_load(tidyverse, BayesFactor, foreign)
dat <- read_csv('data.csv')
dat %>% 
  glimpse()
dat$PRIME <- factor(dat$PRIME)
ttestBF(y = dat$BEH, x = dat$PRIME, paired=FALSE,rscale=sqrt(2)/2)

data.csv

Thank you for your reply, and l am looking forward to hearing from you.

richarddmorey commented 5 months ago

Could you provide me with the code you used to get the lmBF result?

AaronZheng87 commented 5 months ago

Dear developer here is my code and screenshot:

lmBF(BEH ~ PRIME, data = dat)
截屏2024-01-15 10 07 52
richarddmorey commented 5 months ago

From your lmBF analysis, it appears that PRIME is a grouping variable? If so, your ttestBF syntax is wrong. You're comparing your DV to the the grouping variable. See the BayesFactor manual for the syntax you want.