from pyfixest.estimation.formula.parse import Formula
fml = Formula.parse("Y ~ X1 + X2 | f1 + f2")[0]
fml.second_stage, fml.fixed_effects(.lhs:
Y
.rhs:
1 + 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.
(.lhs:
Y
.rhs:
1 + X1 + X2,
f1 + f2)
Stepwise syntax expands into one formula per estimated model.
| Name | Description |
|---|---|
| Formula.absorbs_intercept | Whether any fixed effect supplies group-specific intercepts. |
| Formula.dependent | The dependent variable. |
| Formula.endogenous | Endogenous variables of an instrumental variable specification. |
| Formula.exogenous | Exogenous aka covariates aka independent variables. |
| Formula.fixed_effect_slopes | Distinct varying-slope terms in normalized specification order. |
| Formula.fixed_effect_specifications | Fixed effects represented as symbolic within::Effect terms. |
| Formula.fixed_effects | The fixed effects of a formula. |
| Formula.fixed_effects_key | Rendered fixed effects, grouping models that share demeaning caches. |
| Formula.formulaic_fixed_effects | Fixed-effect level terms in Formulaic’s internal representation. |
| Formula.has_varying_slopes | Whether any fixed effect has varying slopes, as in f1[z]. |
| 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 | Parsed response and regressors for second-stage materialization. |
| Name | Description |
|---|---|
| Formula.as_first_stage | Return the parsed OLS specification for an IV first stage. |
| Formula.parse | Parse fixest-style formula. In case of multiple estimation syntax, |
| Formula.render | Render an expanded formula preserving lookup and expression semantics. |
Return the parsed OLS specification for an IV first stage.
Parse fixest-style formula. In case of multiple estimation syntax, returns a list of multiple regression formulas.
Render an expanded formula preserving lookup and expression semantics.
This is the readable public model name. Distinct parsed formulas render to distinct strings, so the rendered text also identifies models and fixed-effect groups internally. Materialization uses the retained parsed stages.