import pandas as pd
import seaborn as sns
import statsmodels.api as sm
from statsmodels.formula.api import ols
tips=sns.load_dataset('tips')
tips
model=ols('total_bill~day+time',data=tips).fit()
two_anova_table=sm.stats.anova_lm(model,typ=2)
print("\n Two anova result based on day and time:")
print(two_anova_table)
p_val1=0.510480
p_val2=0.127347
if p_val1>0.05:
print('Accept H0')
else:
print('Reject H0')
if p_val2>0.05:
print('Accept H0')
else:
print('Reject H0')
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