BayesFactor anovaBF syntax
I would like to get Bayes factors for ANOVAs that are analogous to the classical F-tests, and I just want to make sure I understand correctly how to write the syntax, especially regarding subject IDs.
For example, I have between-subject independent variables
b_between, and within-subject variables
d_within, dependent variable
subject_id to identify each subject; in a dataset
If I understand correctly, for a full ANOVA, I should use:
anovaBF(values~a_between*b_between*c_within*d_within+subject_id, data = my_data, whichModels="bottom", whichRandom="subject_id") # and I assume the order of variables does not matter, e.g. it could also be d_within*a_between*c_within*b_between+subject_id
For only within-subjects ANOVA, I should use:
anovaBF(values~c_within*d_within+subject_id, data = my_data, whichModels="bottom", whichRandom="subject_id")
For only between-subjects ANOVA, I should use:
anovaBF(values~a_between*b_between, data = my_data, whichModels="bottom", whichRandom="subject_id")
So in the last case I have no
+subject_id - otherwise I get
Error in base::try(expression, silent = silent) : not enough observations. (Perhaps because there is only a single line per
Two main questions:
1. Regardless of reasons, are the solutions above corrects?
2. If the solutions are correct, why do I have to specify subject ID twice (once as
whichRandom and once in the beginning as
+subject_id) for within-subject variables, and why not when there are only between-subject variables?