3
$\begingroup$

Trying to get the Bayes Factor for a correlation between two variables in my data, I tried three different functions. All implement the Jeffreys–Zellner–Siow (JZS) prior, but I get quite different results with the three approaches. Two questions:

  1. Is this suspicious, or is it reasonable that they produce different values, as the implementations are slightly different?

  2. Is there a consensus on the best measure to use?

My data:

a=rnorm(100,1,2)
b=rnorm(100,.8,1.5)
myData <- data.frame(a=a, b=b)

I try the jzs_corbf function, described and implemented here (shorter version)

cor.resu.a_b <- cor.test(myData$a, myData$b, method=c("pearson"))
cor.resu.a_b$estimate
n = 100
r = cor.resu.a_b$estimate
jzs_corbf(r,n)
[1] 0.08206358

I also tried the convenience function from the BayesFactor package:

require(BayesFactor)
regressionBF(b ~ a, data = myData, progress=FALSE)

Bayes factor analysis
--------------
[1] a : 0.2181081 ±0%

Against denominator:
  Intercept only 
---
Bayes factor type: BFlinearModel, JZS

And I also tried the a function described recently (code)

bf10JeffreysIntegrate(n=100, r=r)

      cor 
0.1297927

While in this case the differences are only numerical, in my real data I get quite big differences that make it more difficult to decide on an interpretation.

Related

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.