how to perform a two way anova with python

Solutions on MaxInterview for how to perform a two way anova with python by the best coders in the world

showing results for - "how to perform a two way anova with python"
Giorgio
03 Jan 2017
1import statsmodels.api as sm
2from statsmodels.formula.api import ols
3
4#perform two-way ANOVA
5model = ols('height ~ C(water) + C(sun) + C(water):C(sun)', data=df).fit()
6sm.stats.anova_lm(model, typ=2)
7
8	           sum_sq	  df	      F	   PR(>F)
9C(water)	 8.533333	 1.0	16.0000	 0.000527
10C(sun)	        24.866667	 2.0	23.3125	 0.000002
11C(water):C(sun)	 2.466667	 2.0	 2.3125	 0.120667
12Residual	12.800000	24.0	    NaN	      NaN
13
similar questions
queries leading to this page
how to perform a two way anova with python