<jupyter_start><jupyter_text>Checking various assumptions before doing Anova<jupyter_code>data_1 = data[data['group']==1]
data_2 = data[data['group']==2]
data_3 = data[data['group']==3]
stat, p = st.levene(data_1['exam'], data_2['exam'], data_3['exam'])
print(stat, p)
_ = sns.boxplot(x='group', y='exam', data=data)
_ = sns.lineplot(x='group', y='exam',data=data, err_style='bars')
anova_table = sm.stats.anova_lm(m01)
anova_table
prediction = pd.DataFrame(m01.fittedvalues)
prediction.columns = ['predicted'] 
prediction['standarized_prediction']  = (prediction['predicted']-prediction['predicted'].mean())/prediction['predicted'].std()
prediction.head()
summary_frame = sms.OLSInfluence(m01).summary_frame()
summary_frame = pd.merge(summary_frame, prediction, how = 'inner', left_index = True, right_index = True)
summary_frame .head()
_ = sns.scatterplot(x = 'standard_resid', y='standarized_prediction', data = summary_frame)
_ = plt.axhline(y=0)
st.shapiro(data['exam'])
_ = pg.qqplot(summary_frame['standard_resid'], confidence=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18020541549953314, 'fraction_numerical': 0.014939309056956116, 'mean_word_length': 9.307692307692308, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '392024', 'license': 'MIT', 'n_tokens_mistral': 409, 'n_tokens_neox': 398, 'n_words': 56, 'path': 'Python/statistics_with_Python/10_GLM1_ANOVA/Smart_Alex/Task1_teaching.ipynb', 'repo_name': 'snehilk1312/AppliedStatistics', 'size': '1071'}