Open mattansb opened 2 years ago
This is because the slopes are inferred from the types of the individual constituents. Adding cyl:gear to random won't do anything on top of making "gear" random. If gear is random and cyl is fixed, the constraints on the interaction are already set due to the way the interaction is produced using the Kronecker product.
That makes sense. It might be good to error or at least give a warning that the product term was ignored in whichRandom
A relevant topic is "Mixed models" of the tutorial. https://cran.r-project.org/web/packages/BayesFactor/vignettes/manual.html#mixed
In the tutorial, a classical ANOVA example is
summary(aov(RT ~ shape*color + Error(ID/(shape*color)), data=puzzles))
and an anovaBF equivalent is
bf = anovaBF(RT ~ shape*color + ID, data = puzzles,
whichRandom="ID")
When I read it, I thought anovaBF would be (for consistency with the classical ANOVA code)
bf = anovaBF(RT ~ shape*color + ID + ID:shape + ID:color, data = puzzles,
whichRandom=c("ID", "ID:shape", "ID:color"))
It may be good to mention that BayesFactor automatically infers slopes in the tutorial for novices as well as giving a warning message sugested by @bwiernik.
When adding a random slope into a model, it does not appear in the
dataTypes
slot (https://github.com/easystats/insight/pull/566):