<jupyter_start><jupyter_text>Análise de variância (ANOVA)- Um gerente suspeita que a desempenho de 3 equipes com diferentes turnos (manhã, tarde, noite) variam. Suspeita que o turno impacte o desempenho da equipe. Dados foram coletados.<jupyter_code>import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
sns.set(color_codes =True)
%matplotlib inline
import statsmodels.api as sm
from scipy import stats
from scipy.stats import ttest_1samp, ttest_ind, mannwhitneyu, levene, shapiro, wilcoxon
AN = pd.read_excel("https://github.com/julianovale/lean_6_sigma_python/blob/master/anova.xlsx?raw=true")
AN<jupyter_output><empty_output><jupyter_text>Preparando o DataFrame<jupyter_code>ANS=AN.stack().rename_axis(('Series','Timing')).reset_index(name="Val")
ANS
sns.boxplot(x=ANS.Timing, y=ANS.Val, width = 0.3)
stats.normaltest(ANS.Val).pvalue # se valor-p > 0.05 aceito H0: a amostra é normal<jupyter_output><empty_output><jupyter_text>Importações necessárias<jupyter_code>from statsmodels.formula.api import ols
from statsmodels.stats.anova import anova_lm
y=ANS.Val
x=ANS.Timing
formula='y ~ x'
model = ols(formula, ANS).fit()
aov_table = anova_lm(model)
aov_table<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10577705451586655, 'fraction_numerical': 0.007323026851098454, 'mean_word_length': 7.2, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 1, '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': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '311632', 'license': 'MIT', 'n_tokens_mistral': 492, 'n_tokens_neox': 476, 'n_words': 106, 'path': '0006_teste_hipotese_ANOVA.ipynb', 'repo_name': 'julianovale/lean_6_sigma_python', 'size': '1229'}