Skip to content

ENH: forcing interaction terms to be orthogonal to main effects #9480

Open

Description

@josef-pkt

(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,

e.g.
#8713 for ANOVA
#6464 for MANOVA

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

Activity

  1. added this to the 0.16 milestone on Jan 17, 2025
  2. josef-pkt commented on Jan 20, 2025

    @josef-pkt
    MemberAuthor

    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.)

  3. josef-pkt commented on Jan 20, 2025

    @josef-pkt
    MemberAuthor

    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)

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions