You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ENH: forcing interaction terms to be orthogonal to main effects #9480
(random idea while looking at and literature for interaction effects in two-way anova and possible post-hoc mutliple comparison tests)
In general, in unbalanced multiway anova the interaction terms are not orthogonal to the main effect terms.
(AFAIR) Even in the balanced case, orthogonality of the interaction terms in the regression version depends on the coding of the categorical variables. Although in the balanced case we can use a orthogonal encoding like Helmert,
The idea is to compute the orthogonal complement and transform the exog.
e.g. #3039 (previous idea for this focused on variable addition tests)
(Thinking about the old variable addition case)
AFAIU, both score and LR tests are independent of the parameterization and score test for interaction effect conditional on included main effects would automatically only the the orthogonal component.
This sounds like a good approach and needs recipe examples.
This will not directly help for the multiple comparison of interaction effects #6799 because we need interpretable parameters to specify a pairwise or no interaction hypothesis.
another aside:
multiple testing in score_test
I don't remember whether my current vectorization of the score test works correctly.
Do we have several hypotheses under the same null, or do we also correct for misspecified alternative #8288?
(results will differ because in the latter we also condition on other non-orthogonal interaction effects).
my guess is that we currently the former version of vectorization in score_test
Docs: illustrate orthogonal coding in balanced anova cases, Helmert, sum (?)
we can numerically verify that interaction terms and main effects are orthogonal.
This should avoid issues with using the "wrong" encoding in the balanced case.
However, it does not resolve the problems with correlated effects in the unbalanced cases.
Another possibility to investigate:
AFAICS, formulaic allows for full dummy sets, i.e. perfectly or structurally collinear design.
We can use fit_constrained to impose sum to zero constraints on the separate effects.
(We need an example to see how this works, including inference with rank deficient cov_params.)
aside: in two-way model, type 1 and type 2 (?) anova looks at interaction effect after a main effects only model, i.e. is analogous to LR-test.
(although: type 1 anova for 2 main effects makes not much sense if there is no meaningful prior sequencing)
Activity
josef-pkt commentedon Jan 20, 2025
Docs: illustrate orthogonal coding in balanced anova cases, Helmert, sum (?)
we can numerically verify that interaction terms and main effects are orthogonal.
This should avoid issues with using the "wrong" encoding in the balanced case.
However, it does not resolve the problems with correlated effects in the unbalanced cases.
Another possibility to investigate:
AFAICS, formulaic allows for full dummy sets, i.e. perfectly or structurally collinear design.
We can use fit_constrained to impose sum to zero constraints on the separate effects.
(We need an example to see how this works, including inference with rank deficient cov_params.)
josef-pkt commentedon Jan 20, 2025
aside: in two-way model, type 1 and type 2 (?) anova looks at interaction effect after a main effects only model, i.e. is analogous to LR-test.
(although: type 1 anova for 2 main effects makes not much sense if there is no meaningful prior sequencing)