Formulation(formula, absorb=None, absorb_method=None, absorb_options=None)¶
Configuration for designing matrices and absorbing fixed effects.
+- Set union of terms.
-- Set difference of terms.
*- Short-hand. The formula
a * bis the same as
a + b + a:b.
/- Short-hand. The formula
a / bis the same as
a + a:b.
:- Interactions between two sets of terms.
**- Interactions up to an integer degree.
However, since factors need to be differentiated (for example, when computing elasticities), only the most essential functions are supported:
Data associated with variables should generally already be transformed. However, when encapsulated by
I(), these operators function like normal mathematical operators on numeric variables:
Internally, mathematical operations are parsed and evaluated by the SymPy package, which is also used to symbolically differentiate terms when derivatives are needed.
formula (str) – R-style formula used to design a matrix. Variable names will be validated when this formulation and data are passed to a function that uses them. By default, an intercept is included, which can be removed with
absorbis specified, intercepts are ignored.
absorb (str, optional) – R-style formula used to design a matrix of categorical variables representing fixed effects, which will be absorbed into the matrix designed by
formulaby the PyHDFE package. Fixed effect absorption is only supported for some matrices. Unlike
formula, intercepts are ignored. Only categorical variables are supported.
absorb_method (str, optional) –
Method by which fixed effects will be absorbed. For a full list of supported methods, refer to the
By default, the simplest methods are used: simple de-meaning for a single fixed effect and simple iterative de-meaning by way of the method of alternating projections (MAP) for multiple dimensions of fixed effects. For multiple dimensions, non-accelerated MAP is unlikely to be the fastest algorithm. If fixed effect absorption seems to be taking a long time, consider using a different method such as
absorb_optionsto specify a MAP acceleration method, or configuring other options such as termination tolerances.
absorb_options (dict, optional) – Configuration options for the chosen
method, which will be passed to the