Conversation
|
After first look at the code base: much better and much cleaner than before. No fundamental suggestions for improvement from my side. Thank you! |
|
Note to self: Look into allowing |
|
@leostimpfle fixed a bug in the bin() function + adjusted the tests. You can run them via 40 passed
2 failed
- tests/test_i.py:286 test_factor_x_factor[Y ~ i(f_str, i.g)-Y ~ i(f_str, g)]
- tests/test_i.py:304 test_factor_x_factor_with_fe[Y ~ i(f_str, i.g) | fe1-Y ~ i(f_str, g) | fe1]
E AssertionError: Name mismatch:
E py=['f_str::apple:g::X', 'f_str::apple:g::Y', 'f_str::apple:g::Z', 'f_str::banana:g::X', 'f_str::banana:g::Y', 'f_str::banana:g::Z', 'f_str::cherry:g::X', 'f_str::cherry:g::Y']
E r=['f_str::apple:g::Y', 'f_str::apple:g::Z', 'f_str::banana:g::X', 'f_str::banana:g::Y', 'f_str::banana:g::Z', 'f_str::cherry:g::X', 'f_str::cherry:g::Y', 'f_str::cherry:g::Z']
E assert ['f_str::appl...na:g::Z', ...] == ['f_str::appl...ry:g::X', ...]
E
E At index 0 diff: 'f_str::apple:g::X' != 'f_str::apple:g::Y' |
Agreed that this is somewhat unintuitive. An alternative to changing the attribute names could be to include the encoded fixed effects directly in the formula. For example, instead of
This is a hangover from my early attempts to use
Not needed, and I have removed it
Yes, all good. Thanks @s3alfisc! |
* Simplify formula parsing * Fix pre-commit [skip ci] * Enable multiple dependent variables #1116 * Add endogenous variables as covariates * Add drop_intercept * Update test_formula_parse * Fix parsing * Update first_stage * Add default value to Formula * Disable variable-based checks * Fix did2s * Add multiverse stepwise syntax, closes #1136 * Delegate variable-level checks to formulaic's parser
|
Closed in favour of #1186 |
This is a proof of concept for a refactor of PyFixest's formula parsing. The PR introduces a new module
parsethat refactors formula parsing from the ground up.The core logic is implemented in
pyfixest.estimation.formula.parse.parsewhich takes in a formula string and returns a collection of parsed formulas represented bypyfixest.estimation.formula.parse.Formula.All references to the old
FormulaParserare bypassed (mostly by renaming the oldFixestFormulausing imports of the formfrom pyfixest.estimation.formula.parse import Formula as FixestFormula)