Bambi error - me or limitation of Bambi?

Hey all,

Sorry if this is the wrong venue for Bambi questions but thought I might try here.

I tried to implement the following formula:

y ~ time * tx + (time | therapist/subjects)

which expands to:

y ~ time * tx + (time | therapist:subjects) + (time | therapist)

and I get the following error:

“ValueError: Factor on right hand side of group specific term must be a single term”

Is it possible to implement three-level conditional hierarchical models in Bambi or am I simply writing this incorrectly? If I am writing it incorrectly, how would I need to reformat it to work with Bambi/Formulae?

2 Likes

Tomas Capretto replied on Github: ValueError: Factor on right hand side of group specific term must be a single term. · Issue #358 · bambinos/bambi · GitHub. It is an error in Formulae, the library handling formulas in Bambi. He said he will be fixing it in the next week or so. What an amazing guy.

4 Likes

Tomas implemented the solution and it works! It is a PR so you will need to use this before importing/pip installing Bambi and importing Formulae:

!pip install git+https://github.com/bambinos/formulae.git@refs/pull/31/head

3 Likes