Uses of typ in anova_lm()
Asked Answered
T

1

6

Sorry, I'm new to python and stats. And I was curious about the typ in the anova_lm() function. What does typ 1,2,3 mean and how do they differ? This is an example code of the typ=2 used.

aov_table = sm.stats.anova_lm(results, typ=2)
aov_table
Thiouracil answered 15/3, 2019 at 3:50 Comment(0)
C
6

the documentation of statsmodels.stats.anova.anova_lm states:

typ: str or int {“I”,”II”,”III”} or {1,2,3}

The type of Anova test to perform. See notes.

You can read about the types of ANOVA for example here. The difference is how you account for unbalance data and how you perform the calculation of sums of squares. This choice is based on your data. To quote from there:

In general, if there is no significant interaction effect, then type II is more powerful, and follows the principle of marginality. If interaction is present, then type II is inappropriate while type III can still be used, but results need to be interpreted with caution (in the presence of interactions, main effects are rarely interpretable).

There has also been many posts on stack-exchange on which one to choose and how to interpret your results. https://stats.stackexchange.com/questions/345684/which-one-to-choose-type-i-type-ii-or-type-iii-anova

Hope that helps.

Carlock answered 1/1, 2020 at 15:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.