richarddmorey / BayesFactor

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

Cannot Plot large BFlinearModel #81

Open Nodragem opened 8 years ago

Nodragem commented 8 years ago

Hello,

Usually I have no problem to plot BFlinearModel, but in my last data analysis, I'm testing a model looking like that:

generalTestBF(initialDev ~ FixationSide*S1.Duration*Gap.Duration*Participant, 
                                 data=result, whichRandom="Participant")

on a dataset that uses trial-by-trial measures of initialDev on 11 participants (~65 measures by condition by Participant; that is 500-600 trials by participants).

R output is as follow when I plot the BFlinearModel:

Error in seq.default(floor(rng[1]), ceiling(rng[2]), 1) : 
  'from' cannot be NA, NaN or infinite
Nodragem commented 8 years ago

I think that it is because the BF are reaching a too high value. If I sort the BF and try to plot the 10 best (i.e. the 10 highest BF), it still throws the error. If I divide the sorted BF by the maximum BF and then plot the 10 best, it works.

richarddmorey commented 8 years ago

The best I can do here is offer a better error message; when Bayes factors are that large, plotting them will be difficult.

Nodragem commented 8 years ago

Yes, I was thinking about an error message that tells something like:

The list of models contains Bayes Factors too high to be plotted. 
One solution is to divide all the Bayes Factors by the Bayes Factor of a relevant model.
Examples:
modelBF / max(modelBF)
modelBF/ modelBF[8]

It probably needs some work to be more elegant but the idea is that the user knows what to do next. Best.