BayesFactor Package R: Two different Output

谁说胖子不能爱 提交于 2019-12-11 06:03:10

问题


I'm using the BayesFactor package but I get two different output for the same data using two very similar codes. I'm wondering which one is correct?

if(!require(BayesFactor)){install.packages('BayesFactor')}

require(BayesFactor)
##################################################

exp(ttest.tstat(t= 2 , n1=40, n2=40, nullInterval =c(0, Inf), rscale = sqrt(2)/2,
        complement = FALSE, simple = FALSE)$bf)   ### !CHECK THIS OUTPUT! ###


exp(ttest.tstat(t= 2 , n1=40, n2=40, nullInterval =c(0, Inf), rscale = sqrt(2)/2, 
       complement = FALSE, simple = TRUE))    ### !CHECK THIS OUTPUT! ###

回答1:


It is mentioned in the documentation of ?ttest.tstat

If simple is TRUE, returns the Bayes factor (against the null). If FALSE, the function returns a vector of length 3 containing the computed log(e) Bayes factor, along with a proportional error estimate on the Bayes factor and the method used to compute it.

In essence, we don't need to take the exp when simple=TRUE

ttest.tstat(t= 2 , n1=40, n2=40, nullInterval =c(0, Inf),
   rscale = sqrt(2)/2, complement = FALSE, simple = TRUE)
#     B10 
# 2.502954 

whereas with simple=FALSE

exp(ttest.tstat(t= 2 , n1=40, n2=40, nullInterval =c(0, Inf),
        rscale = sqrt(2)/2, complement = FALSE, simple = FALSE)$bf)
#[1] 2.502954


来源:https://stackoverflow.com/questions/42289948/bayesfactor-package-r-two-different-output

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!