Closed hummuscience closed 1 year ago
Hi @Cumol! thanks for sharing the problem with such amount of detail. This is a confusing point, but I think Bambi and formulae are not doing the wrong thing.
Shortly, if you have an intercept plus AN interaction between two categorical variables, you need to add one of the main effects because the constraints that are applied to the interaction prevent it from spanning the space of the interaction. This is much better explained here in Patsy's docs https://patsy.readthedocs.io/en/latest/formulas.html#redundancy-and-categorical-factors. Formulae does the same thing. Check the block where it does dmatrices("y ~ 1 + a:b", data)
.
If you don't want to have the main effect, which may make interpretations more complicated, then use value ~ 0 + treatment:sequence
.
I explained this in the following issue: https://github.com/lnccbrown/HSSM/issues/308
Bambi model written with the following formula:
y ~ 1 + x:z
should estimate an intercept and x:z. Instead, the model also outputs an estimate for z (or whatever is placed second in the interaction).Running similar code in Formulae outputs the correct model.
Or am I missing something here?