from pyfixest.estimation.formula.parse import Formula
fml = Formula.parse("Y ~ X1 + X2 | f1 + f2")[0]
fml.second_stage, fml.fixed_effects('Y ~ X1 + X2', f1 + f2)
A formulaic-compliant formula.
Splits a fixest-style formula into second stage, fixed effects and, for IV models, first stage. Use parse() instead of calling the class directly. parse() also expands the multiple estimation operators (sw, sw0, csw, csw0, mvsw) into one Formula per model. This is an internal API. Formulas are written as strings and passed to feols(). See the formula syntax tutorial.
('Y ~ X1 + X2', f1 + f2)
Stepwise syntax expands into one formula per estimated model.
| Name | Description |
|---|---|
| Formula.dependent | The dependent variable. |
| Formula.endogenous | Endogenous variables of an instrumental variable specification. |
| Formula.exogenous | Exogenous aka covariates aka independent variables. |
| Formula.first_stage | The first stage formula of an instrumental variable specification. |
| Formula.fixed_effects | The fixed effects of a formula. |
| Formula.fixed_effects_wrapped | Wrapped fixed effects for proper encoding. |
| Formula.formula | The string representation of the formula. |
| Formula.instruments | Instruments of an instrumental variable specification. |
| Formula.is_fixed_effects | Boolean indicating whether the formula is a fixed effects specification. |
| Formula.is_instrumental_variable | Boolean indicating whether the formula is an instrumental variable specification. |
| Formula.second_stage | The second stage formula. |
| Name | Description |
|---|---|
| Formula.parse | Parse fixest-style formula. In case of multiple estimation syntax, |
| Formula.parse_to_dict | Group parsed formulas into dictionary keyed by fixed effects. |
Parse fixest-style formula. In case of multiple estimation syntax, returns a list of multiple regression formulas.
Group parsed formulas into dictionary keyed by fixed effects.