Skip to content

Initial testing of formulaic's i operator#1196

Draft
leostimpfle wants to merge 1 commit intomasterfrom
formulaic-interaction
Draft

Initial testing of formulaic's i operator#1196
leostimpfle wants to merge 1 commit intomasterfrom
formulaic-interaction

Conversation

@leostimpfle
Copy link
Collaborator

Have started testing formulaic's implementation of the i operator (matthewwardrop/formulaic#265) related to #782

Once the formulaic side is ready, this should largely be a drop-in replacement of our current implementation with some tweaks to the syntax, see for example here:

pyfixest/tests/test_i.py

Lines 199 to 221 in dcf3d47

@pytest.mark.parametrize(
"fml_py, fml_r",
[
("dep_var ~ i(C(state, reduce_rank=True))", "dep_var ~ i(state)"),
(
"dep_var ~ i(C(state, contr.treatment(1), reduce_rank=True))",
"dep_var ~ i(state, ref = 1)",
),
("dep_var ~ i(C(state, reduce_rank=False), year)", "dep_var ~ i(state, year)"),
(
"dep_var ~ i(C(state, contr.treatment(1), reduce_rank=True), year)",
"dep_var ~ i(state, year, ref = 1)",
),
(
"dep_var ~ i(C(state, reduce_rank=False), year) | state",
"dep_var ~ i(state, year) | state",
),
(
"dep_var ~ i(C(state, contr.treatment(1), reduce_rank=True), year) | state",
"dep_var ~ i(state, year, ref = 1) | state",
),
],
)

FYI @s3alfisc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant