'Uses of typ in anova_lm()
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
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | My Work |