I am trying to create mixed model with within-subjects IDs for ANOVA analysis. Here is my code:
formula = 'DepVar ~ C(Condition)*C(Passage)*C(Order) + (1|C(Participant))'
model = ols(formula, data=anova_df).fit()
Data in the 'Participant' column are strings. When I try to run this, however, I get the following error:
PatsyError: Error evaluating factor: TypeError: unsupported operand type(s) for |: 'int' and '_CategoricalBox'
TaskTime ~ C(Condition)*C(Passage)*C(Order) + (1|C(Participant))
^^^^^^^^^^^^^^^^^^
Removing the C gives another error:
PatsyError: Error evaluating factor: TypeError: Cannot perform 'ror_' with a dtyped [object] array and scalar of type [bool]
TaskTime ~ C(Condition)*C(Passage)*C(Order) + (1|Participant)
What am I doing wrong here? I've read elsewhere that this is the appropriate way to consider repeated measures.
Note that if I convert all Participant IDs from strings to integers, the code:
TaskTime ~ C(Condition)*C(Passage)*C(Order) + (1|Participant)
works. I've heard it's bad practice to do this, however, as participant IDs should be treated categorically.