0

I am running a linear mixed model analysis, in which I have a dependent variable(pupil mean), two fixed factors (condition and phase type) and one random factor (subj). I want to compute the related bayes factor with lmBF function of the BayesFactor package in R. However, the variable full_BF_pupil keeps giving different results at each run.

For example: at 1st run: 1.386933e+137 ±2.19%, 2nd run: 1.381459e+137 ±2.18%

Even if the difference is very small, since other computations are made on this value the final results are more different. What is this due to? Is there a more reliable function for my purposes? Thank you, this is the code line of interest.

 full_BF_pupil = lmBF(pupil_mean_bin~ cond*phasetype+ subj, data = BR_pre, whichRandom="subj")
  • Yep - that's the Bayesian way. From memory, Bayesians employ something called Monte Carlo methods, which involves repeated random sampling to make numerical estimations of unknown parameters. This allows modelling of very complex situations where many random variables are involved. But computation is taxing. Long story short, you'll always get a different answer due to the randomness. If you want reliability, choose a Frequentist method. :D – Edward Mar 16 '20 at 14:38
  • Have you tried setting a random seed, e.g., `set.seed(2020)` before running that line? – merv Mar 16 '20 at 15:19
  • Nope, I didn't. Why specifically 2020? Thank you very much – Miriam Acquafredda Mar 17 '20 at 10:02
  • Ok, now I get it, it was random, as you said. It works! Thanks a lot. – Miriam Acquafredda Mar 17 '20 at 10:55

0 Answers0