Closed jonathon-love closed 10 years ago
There is missing data in the dependent variable. This is not allowed. I will add a warning in the next version. Try removing rows with missing data:
data = data[!is.na(data$Rating),]
anovaBF(Rating ~ Frightening * Disgusting, data)
which will return a Bayes factor, as expected.
Bayes factor analysis
--------------
[1] Frightening : 0.7745435 ±0%
[2] Disgusting : 5.296542e+39 ±0%
[3] Frightening + Disgusting : 4.665278e+39 ±0.98%
[4] Frightening + Disgusting + Frightening:Disgusting : 4.563757e+43 ±1.34%
Against denominator:
Intercept only
---
Bayes factor type: BFlinearModel, JZS
cheers, but isn't it suspicious that it does generate BFs for some models? i would expect all of them to fail.
The BayesFactor package uses test statistics where possible (that is, where sampling is unnecessary), computed from R's own statistical routines. So it is inheriting R's behavior in some cases, but not others. In the next version the data will be checked first thing, so that won't occur. [but yes, you are right that it is suspicious. I was thinking the same thing at first.]
How would you feel about adding an option to allow the BayesFactor package to ignore missing values? This would save us the time of copying the whole column each time we call the package (unless, that's all you'd be doing under the hood anyway)
Yes, that's what I'd be doing under the hood (removing the missing data). The BayesFactor package creates a copy of the data for the BayesFactor object (to check for consistency between analyses, so that the c() method and /-operator methods disallow people doing impossible analyses). I'd be uncomfortable if the data that is saved in the object differs from the data that was explicitly passed to the function by the user.
running the following, with the dataset "Bugs Long Form.csv":
produces: