richarddmorey / BayesFactor

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

Improve the way of determining the sampling method. #64

Closed jonathon-love closed 8 years ago

jonathon-love commented 9 years ago

yo dawg,

BayesFactor would be totally awesome if you could add a good way to determine the sampling method used.

jonathon

richarddmorey commented 9 years ago

As it turns out, I had already mostly done this. But just pushed a branch that has more. Install the version from the sampling-method-info branch, then try this:

library(BayesFactor)
result = generalTestBF(RT ~ shape*color + ID, data = puzzles, whichRandom = "ID", neverExclude="ID", progress=FALSE)
result@numerator[[1]]@analysis

Output:

$bf
[1] 12.68154

$properror
[1] 0.01402769

$N
[1] 10000

$method
[1] "simple"

$sampled
[1] TRUE

$code
[1] "d5d6170c90e7"

You can then replicate the analysis with the same setting, which will turn off the trial run:

recompute(result[1], iterations = 500, method = result@numerator[[1]]@analysis$method)
quentingronau commented 9 years ago

Hi Richard,

For the t-test, if I set posterior=TRUE, is there also a trial run? If this is the case, would it be possible to also return the sampling method and to use this information to determine the method for a subsequent run (maybe this is already possible and I just could not figure out how it works or maybe you always use the same sampling method for the t-test)?

Cheers, Quentin

richarddmorey commented 9 years ago

No, there is no trial run. The sampling method for the posterior sampling in the t test case is always Gibbs.

quentingronau commented 9 years ago

Ok, thank you!

richarddmorey commented 8 years ago

fixed by 8fade3c