Replicating results from JASP in R w/ BayesFactor
Hello. I'm trying to replicate my results from JASP in R as part of an Rmarkdown document. It's a one-sample t-test. I'm interested in seeing whether the average mean accuracy is above chance (.5, binary responses).
ttestBF(training_summary$mean, nullInterval = c(-Inf, .5))
returns
Bayes factor analysis
--------------
[1] Alt., r=0.707 -Inf<d<0.5 : 0.003461124 ±NA%
[2] Alt., r=0.707 !(-Inf<d<0.5) : 1.183431e+19 ±NA%
Against denominator:
Null, mu = 0
---
Bayes factor type: BFoneSample, JZS
However, the same test (I think) in JASP returns BF10 of 6.052e+12 with an error % of 1.531e-17. This is a one-sample Bayesian t-test with the "test value" set to 0.5, > test value on the same data arranged the same way (one value between 0 and 1 for each participant).
I realized my mistake, then ran this, which matched JASP's output:
bfInterval <- ttestBF(training_summary$mean, mu = .5, nullInterval = c(-Inf, 0))
bfInterval[2]
Bayes factor analysis
--------------
[1] Alt., r=0.707 !(-Inf<d<0) : 6.052567e+12 ±NA%
Against denominator:
Null, mu = 0.5
---
Bayes factor type: BFoneSample, JZS
My question: Why is there no error %? And what is the correct statement for this question? Is the null interval normalized around the null value of the mean, so the second statement would be correct (and in line with JASP) or am I missing something?
Comments
Hi jjth,
I'm not sure why there isn't an error %. JASP calls the BayesFactor package. Of course the error is very small, but that shouldn't be an issue.
What do you mean when you say "what is the correct statement for this question?" -- both JASP and BayesFactor return the same huge Bayes factor. As far as "null interval" goes, I assume this is the BayesFactor way of indicating a one-sided test. Ahhh I get it! So yes, I assume that the nullInterval should really read c(-Inf,0.5). This is easy to check: do a one-sided test in JASP with some specific test value (say 0.5), and then do it again after subtracting 0.5 from each data point but entering a test value of 0. The results ought to be identical, and in JASP, they are. You can do a similar check for the BayesFactor package. I am sure the result is correct, but I agree that the NullInterval notation has the potential for confusion.
Cheers,
E.J.