<jupyter_start><jupyter_text>Assumption of homogeneity of variances is violated. Clear from boxplots and levene tests.<jupyter_code>st.shapiro(data['Sperm'])
_ = pg.qqplot(data['Sperm'], confidence=False)<jupyter_output><empty_output><jupyter_text>normality assumption is also violated.  Doing Normal Anova<jupyter_code>m01 = ols('Sperm~C(Soya)', data=data).fit()
m01.summary()<jupyter_output><empty_output><jupyter_text>When doing normal anova it seems that the test is not significant at p=0.05  The main ANOVA summary table shows us that because the observed significance value is greater than .05 we can say that there was no significant effect of soya intake on men’s sperm count. This is strange  coz , the Kruskal–Wallis test produced a significant result! The reason for this difference is that the data violate the assumptions of normality and homogeneity of variance. As I mention in non-parametric tests chapter, although parametric tests have more power to detect effects when their assumptions are met, when their assumptions are violated non-parametric tests have more power! This example was arranged to prove this point: because the parametric assumptions are violated, the non-parametric tests produced a significant result and the parametric test did not because, in these circumstances, the non-parametric test has the greater power!  Doing welch-f test<jupyter_code>aov = pg.welch_anova(dv='Sperm', between='Soya', data=data)
aov<jupyter_output><empty_output><jupyter_text>This output shows Welch’sF; note that the Welch test agrees with the non-parametric test in that the significance of F is below the .05 threshold. However, in these circumstances, because normality and homogeneity of variance have been violated we’d use a non-parametric test anyway!  Doing Robust anova , Kruskal-wallis<jupyter_code>st.kruskal(data_0['Sperm'], data_1['Sperm'], data_4['Sperm'], data_7['Sperm'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07183462532299742, 'fraction_numerical': 0.007751937984496124, 'mean_word_length': 6.446153846153846, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '347531', 'license': 'MIT', 'n_tokens_mistral': 565, 'n_tokens_neox': 526, 'n_words': 226, 'path': 'Python/statistics_with_Python/10_GLM1_ANOVA/Smart_Alex/Task3_soya.ipynb', 'repo_name': 'snehilk1312/AppliedStatistics', 'size': '1935'}