How to get rid of main effects when coding interaction between categorical variables in patsy?

358 views Asked by At

I have a problem very similar to :

Interaction effects in patsy with patsy.dmatrices giving duplicate columns for ":" as with "+" , or "*"

except that I have other categorical variables besides the interaction term. My formula is :

f = 'VarDep ~ C(MoisAvantDep):C(Groupe) + C(JourSemDep) + C(MoisDep) + jour_nuit'

When I run an ols regression in statsmodels with this formula, I get main effects for the variable "Groupe", which I would like to avoid. I tried to add -1 in the formula (as suggested in the above mentioned discussion), but still get the main effects.

Any suggestion ?

0

There are 0 answers