import numpy as np import pandas as pd import statsmodels.api as sm from statsmodels.formula.api import ols y=(18,15,15,17,17,16,14,14,13,16,15,14) print(y) v=('A','A','A','A','B','B','B','B','C','C','C','C') print(v) c=('I','II','III','IV','I','II','III','IV','I','II','III','IV') print(c) dict = {'Yield':y,'Variety':v,'Chemist':c} print(dict) twd = pd.DataFrame(dict) print(twd) model=ols('Yield~Variety+Chemist',data=twd).fit() anova_two_able=sm.stats.anova_lm(model,typ=2) anova_two_able
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter