2-way ANOVA in Python statsmodels yields different Sum of Squares than SPSS

by user219200   Last Updated September 19, 2018 23:19 PM

I am learning to use Python for my statistical analyses, and while figuring out how to perform a 2-way ANOVA with statsmodels I found that my Python code yielded slightly aberrant values. Comparing the outputs you can see that the SS_Factor_1 values, and the Adjusted R2 are different for Python vs SPSS/Graphpad. Is this because of a mistake in my code, or some other reason? Are these differences due to something inherent in each software and so small I should just ignore them?

Python code:

formula = 'dependent_variable ~ C(factor_1) * C(factor_2)'
model = ols(formula, data=df_freq_time).fit()
aov_table = anova_lm(model, typ=2)
aov_table

Python output: output

Also R2 = 0.722, and adj R2 = 0.694

SPSS 2-way ANOVA results: SPSS output ANOVA table

Graphpad Prism 2-way ANOVA results: Graphpad output ANOVA table



Related Questions


ANOVA type 2 or 3

Updated August 28, 2018 22:19 PM

Calculate interaction sum of squares by hand

Updated July 15, 2016 08:08 AM

Manually calculating SS within for a one way ANOVA

Updated August 12, 2015 18:08 PM

How is SSerror calculated in a factorial design?

Updated October 16, 2017 14:19 PM