I don't understand what you mean by "a subset of the interactions". One thing you might mean is a formula like
y ~ pred1 + pred2 + pred3 + pred1:pred3 + pred1:pred2
or the equivalent
y ~ pred1*pred2*pred3 - pred2:pred3
where the latter makes it obvious that we're including some of the possible interactions, but not all of them (we've left out pred2:pred3
).
But, this is easy to do, so I'm guessing that what you actually meant may be, you want to include a subset of the coefficients associated with a single interaction? If so, then no, that isn't something that's currently implemented. It's fairly dubious from a statistical perspective as well; if you start leaving out random columns, then you change the interpretation of all the other columns in very difficult to interpret ways. Also I can't really think of a good implementable syntax for describing the partial interaction you want... if you can then feel free to file a feature request on patsy.
Also, I don't believe that statsmodels includes a way to fit a restricted model like that, no. It would be a good feature request.