A factory runs three machines and asks: is their mean output truly different, or just random wobble? One-way ANOVA answers it by comparing variation between machines to variation within them. Move the means and watch the F-statistic and p-value react.
ANOVA is an omnibus test: a significant result says the means aren't all equal, but not which ones — that needs a post-hoc test (e.g. Tukey).
Big F → the machines' averages are far apart compared with their internal noise → likely a real difference. The p-value turns F into a probability.
Each column is a machine's 12 output samples; the thick line is its mean, the dashed line is the grand mean. Slide a machine's mean and watch the F-statistic and p-value recompute — both are real, using the F-distribution. Press resample to redraw the random noise.
A clear explainer from StatQuest on how ANOVA works through linear models, plus a quick route to post-hoc testing.
Embedded video is from YouTube and belongs to its creator. If a frame is blank, your network may block YouTube.
Run the F-test in one line with SciPy, then the full table and post-hoc with statsmodels.
import pandas as pd
from scipy import stats
df = pd.read_csv("machines.csv") # columns: machine, output
A = df[df.machine=="A"].output
B = df[df.machine=="B"].output
C = df[df.machine=="C"].output
F, p = stats.f_oneway(A, B, C) # one-way ANOVA
print("F =", round(F,3), " p =", round(p,4))
print("Reject H0 (means differ)" if p < 0.05 else "Fail to reject H0")
import statsmodels.api as sm
from statsmodels.formula.api import ols
model = ols("output ~ C(machine)", data=df).fit()
table = sm.stats.anova_lm(model, typ=2)
print(table) # sum_sq, df, F, PR(>F)
# If significant, find WHICH machines differ
from statsmodels.stats.multicomp import pairwise_tukeyhsd
tukey = pairwise_tukeyhsd(df.output, df.machine, alpha=0.05)
print(tukey.summary())
# Also check assumptions: normality of residuals, equal variances (Levene).
One-way ANOVA was applied to the machines' output. The F-statistic and p-value were computed; a p-value below 0.05 indicates the mean outputs differ significantly, and a Tukey post-hoc test identifies which machines stand apart — supporting a data-driven decision (CO3).