richarddmorey / BayesFactor

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

Negative BF value #110

Closed staplesc closed 6 years ago

staplesc commented 7 years ago

I'm using anovaBF, but occasionally get a negative Bayes factor. I'm a beginner in R, and not a statistics whiz (clearly!) Any suggestions on what I might be doing wrong?

I'm using R3.4.1. The BayesFactor package is version 0.9.12-2.

Thanks in advance for your help.

richarddmorey commented 7 years ago

Can you provide some reproducible code?

DominiqueMakowski commented 6 years ago

Dear @richarddmorey , I too have this result:

set.seed(123)
bf <- BayesFactor::ttestBF(x=rnorm(31, 0.54, 0.22), mu=0.5)
print(paste0("BF = ", round(bf@bayesFactor$bf, 2)))

Is there something wrong?

richarddmorey commented 6 years ago

No, that's the logarithm of the Bayes factor. Try

set.seed(123)
bf <- BayesFactor::ttestBF(x=rnorm(31, 0.54, 0.22), mu=0.5)
as.vector(bf)
DominiqueMakowski commented 6 years ago

thanks a lot :)