Now consider the formula 1 + (b - 1). In Patsy, this is analogous to the case above: first (b - 1) is reduced to just b, and then 1 + b produces a model with intercept included. In R, the parentheses are ignored, and 1 + (b - 1) gives a model that does not include the intercept.
What is a patsy formula?
Python has a very useful library called Patsy that lets programmers create formulas to use with statsmodels regressions. These formulas allow us to be specific about how we want statsmodel to generate a model and can be used to easily create interaction terms.
How many independent variables are considered in the Patsy formula Yi x1 x2 )'?
This formula specifies a model with 2 independent variables: x1 and the sum of x1 and x2 .