Blog articleMethodology & analyticsComputer science

Using ANOVA to compare algorithms in computer science experiments: design, assumptions and alternatives

Computer science theses often claim that one algorithm beats others. ANOVA can test such claims, but only if the experiment is designed around the right unit of replication and the analysis respects how results on shared datasets and seeds are paired.

What you will learn

  • Identify the unit of replication in an algorithm comparison
  • Choose between one-way, factorial, blocked and repeated-measures ANOVA for a given design
  • Check assumptions on residuals and use Welch or non-parametric alternatives when they fail
  • Control multiple comparisons, including comparisons against a baseline
  • Report effect sizes, variability across seeds and enough detail for replication

What you will unlearn

  • Scores of several algorithms on the same datasets are independent groups.They are paired by dataset, so the dataset must enter the model as a block or repeated factor.
  • The raw scores must be normally distributed.ANOVA assumes approximately normal residuals within groups, which is a different and weaker condition.
  • Ten-fold cross-validation gives ten independent observations.Folds share most of their training data, so treating them as independent understates the variance.
  • A significant F test shows which algorithm is best.It shows only that some means differ; planned contrasts or adjusted post hoc tests are needed, with effect sizes.

Skills you will practise

  • Experimental design for algorithm comparison
  • Choosing ANOVA designs
  • Checking assumptions
  • Multiple comparison control
  • Effect sizes
  • Reproducible reporting

What ANOVA can and cannot tell you

Analysis of variance tests whether the means of several conditions differ more than chance variation would predict. In computer science it is used to compare algorithms, configurations or system settings on a performance measure such as accuracy, runtime or energy use. With two conditions it reduces to a t test; its value lies in handling several conditions and several factors at once.

A significant F statistic says that not all means are equal. It does not say which algorithm is best, how large the differences are, or whether they matter in practice. Those answers come from contrasts, post hoc tests and effect sizes (Lakens, 2013), and from a design that makes the comparison fair.

ANOVA is also one option among several. When the design is unbalanced, when some algorithms fail to finish on some datasets, or when both datasets and seeds vary, a linear mixed model with dataset and seed as random effects handles the structure more flexibly. The principles below apply to either approach.

ANOVA in computer science research methodology
Figure 1. ANOVA in computer science research methodology.

Design first: the unit of replication

The most common error in algorithm comparisons is to misidentify what counts as an independent observation. If three algorithms are each run on the same ten datasets, the thirty scores are not three independent groups of ten. Each dataset contributes a score to every algorithm, and some datasets are simply harder than others. The dataset is a block, and the analysis must account for it.

The same applies to random seeds and cross-validation folds. Folds overlap heavily in their training data, so fold scores are correlated and do not count as independent replicates. Random seeds matter too: in deep reinforcement learning, Henderson et al. (2018) ran one algorithm with ten seeds, split the runs into two groups of five and obtained performance curves that differed significantly. Decide in advance what the replicates are (datasets, seeds or both), fix the number before running experiments, and give every algorithm the same tuning budget (Lindauer & Hutter, 2020).

Choosing the right ANOVA

Matching the ANOVA design to the structure of the experiment
DesignExampleAnalysis
Independent groupsDifferent, randomly assigned user groups test three interfacesOne-way ANOVA, or Welch's F if variances differ
Two or more crossed factorsAlgorithm by data size, each combination run on separate random instancesFactorial ANOVA with interaction
Same units under every conditionEach algorithm run on the same set of datasets or seedsRepeated-measures or randomised block ANOVA; Friedman test if assumptions fail
Comparisons against one baselineNew method compared with each existing methodDunnett's procedure for comparisons with a control
Measurements over timeThroughput at several load levels on the same systemRepeated-measures ANOVA with sphericity correction, or a mixed model

When each algorithm is run on the same datasets, a repeated-measures (or randomised block) ANOVA removes the variation due to dataset difficulty and tests the algorithm effect against the right error term. If residuals are far from normal or the scores are ranks, the Friedman test, a non-parametric test for repeated measures, compares algorithms by their ranks within each dataset.

Checking assumptions properly

  • Independence. Settled by design, not by a test: identify blocks and repeated factors as above.
  • Normality. Examine the residuals, not the raw scores, with a Q-Q plot. Moderate departures matter little with balanced designs; bounded measures such as accuracy near 1 may need transformation or a non-parametric test.
  • Equal variances. Algorithms often differ in stability as well as in mean. For one-way designs, Delacre et al. (2019) recommend Welch's F test by default, because it loses little when variances are equal and protects error rates when they are not.
  • Sphericity. For repeated measures with more than two conditions, apply a correction such as Greenhouse-Geisser and say so.

Also check for leakage before trusting any comparison. Information from the test data entering training or tuning inflates results and has affected many machine-learning-based studies (Kapoor & Narayanan, 2023).

After the F test: comparisons, effect sizes and power

Decide which comparisons matter before seeing the results. If the claim is that a new method beats each existing method, compare it with each baseline using a procedure designed for comparisons with a control (Dunnett, 1955), rather than testing every pair. If all pairs matter, use an adjusted procedure and report adjusted p values.

Report an effect size with every test. Eta squared and partial eta squared are common, but their values depend on the design; generalised eta squared allows comparison across designs (Olejnik & Algina, 2003; Lakens, 2013). Give the mean difference in the original units (for example, accuracy points or milliseconds) with a confidence interval, because that is what readers can interpret.

Finally, justify the number of datasets or seeds. Power analysis tools such as G*Power can estimate the number needed to detect a given effect (Faul et al., 2007), and Lakens (2022) sets out other legitimate justifications, such as resource limits stated openly.

Linking the analysis to your research questions

The statistical test belongs to the methodology, not only to the results chapter. Each research question or hypothesis should map to a stated comparison: which algorithms, on which benchmarks, measured how, and tested with which procedure. Writing this mapping before the experiments are run protects against choosing the analysis that happens to give a significant result, and it lets examiners see that the test answers the question asked.

Justify the benchmarks as carefully as the test. A comparison on datasets chosen because the new method does well on them says little about performance elsewhere. State how benchmarks were selected, whether any were excluded and why, and whether the conclusions are meant to generalise to a wider class of problems. Then make sure the discussion chapter claims no more than the design supports: a difference found on twelve benchmark graphs is evidence about those graphs and similar ones, not about every graph.

Worked example (illustrative)

A hypothetical thesis proposes a new graph-partitioning heuristic and compares it with three published heuristics on twelve benchmark graphs, with five random seeds per graph. The outcome is solution quality. The researcher averages the five seeds for each graph and algorithm, giving one score per cell, and fits a repeated-measures ANOVA with algorithm as the within-graph factor. Because the claim concerns the new method against each baseline, three planned comparisons with the new method as the control are tested (Dunnett, 1955). Residual plots show skew from two very easy graphs, so the Friedman test is reported as a sensitivity analysis.

The write-up reports the mean difference and confidence interval for each comparison, generalised eta squared for the algorithm effect (Olejnik & Algina, 2003), the spread across seeds, the tuning budget given to each method, and code and data availability, in line with current reproducibility expectations (Pineau et al., 2021).

Experimental design and data validation with ANOVA
Figure 2. Experimental design and data validation with ANOVA.

Common mistakes

  • Treating scores on shared datasets, folds or seeds as independent groups.
  • Testing normality on raw scores instead of residuals.
  • Running many unadjusted pairwise tests and highlighting the significant ones.
  • Reporting p values without effect sizes or variability across seeds (Henderson et al., 2018).
  • Tuning the proposed method more thoroughly than the baselines (Lindauer & Hutter, 2020).
  • Explaining a performance gain with a story the experiment did not test (Lipton & Steinhardt, 2019).

Report the design, the replicates, the test and its assumptions, effect sizes and any deviations from plan, following general reporting standards for quantitative research (Appelbaum et al., 2018). Your university's thesis regulations set the format; the statistical reasoning is the same in Singapore as anywhere else. For more on reporting, see reporting ANOVA and ANCOVA and reporting hypothesis tests.

Key takeaways

Your next step

Want to apply this to your own study?

  1. 1Tell us your topic, data and deadline
  2. 2A statistician reviews your work with you
  3. 3You get a plan and a quote
Quantitative analysis

References

  1. Appelbaum, M., Cooper, H., Kline, R. B., Mayo-Wilson, E., Nezu, A. M., & Rao, S. M. (2018). Journal article reporting standards for quantitative research in psychology: The APA Publications and Communications Board task force report. American Psychologist, 73(1), 3–25. https://doi.org/10.1037/amp0000191
  2. Delacre, M., Leys, C., Mora, Y. L., & Lakens, D. (2019). Taking parametric assumptions seriously: Arguments for the use of Welch's F-test instead of the classical F-test in one-way ANOVA. International Review of Social Psychology, 32(1), 13. https://doi.org/10.5334/irsp.198
  3. Dunnett, C. W. (1955). A multiple comparison procedure for comparing several treatments with a control. Journal of the American Statistical Association, 50(272), 1096–1121. https://doi.org/10.1080/01621459.1955.10501294
  4. Faul, F., Erdfelder, E., Lang, A.-G., & Buchner, A. (2007). G*Power 3: A flexible statistical power analysis program for the social, behavioral, and biomedical sciences. Behavior Research Methods, 39(2), 175–191. https://doi.org/10.3758/BF03193146
  5. Henderson, P., Islam, R., Bachman, P., Pineau, J., Precup, D., & Meger, D. (2018). Deep reinforcement learning that matters. Proceedings of the AAAI Conference on Artificial Intelligence, 32(1), 3207–3214. https://doi.org/10.1609/aaai.v32i1.11694
  6. Kapoor, S., & Narayanan, A. (2023). Leakage and the reproducibility crisis in machine-learning-based science. Patterns, 4(9), 100804. https://doi.org/10.1016/j.patter.2023.100804
  7. Lakens, D. (2013). Calculating and reporting effect sizes to facilitate cumulative science: A practical primer for t-tests and ANOVAs. Frontiers in Psychology, 4, 863. https://doi.org/10.3389/fpsyg.2013.00863
  8. Lakens, D. (2022). Sample size justification. Collabra: Psychology, 8(1), 33267. https://doi.org/10.1525/collabra.33267
  9. Lindauer, M., & Hutter, F. (2020). Best practices for scientific research on neural architecture search. Journal of Machine Learning Research, 21(243), 1–18. https://www.jmlr.org/papers/v21/20-056.html
  10. Lipton, Z. C., & Steinhardt, J. (2019). Troubling trends in machine learning scholarship. ACM Queue, 17(1). https://queue.acm.org/detail.cfm?id=3328534
  11. Olejnik, S., & Algina, J. (2003). Generalized eta and omega squared statistics: Measures of effect size for some common research designs. Psychological Methods, 8(4), 434–447. https://doi.org/10.1037/1082-989X.8.4.434
  12. Pineau, J., Vincent-Lamarre, P., Sinha, K., Larivière, V., Beygelzimer, A., d'Alché-Buc, F., Fox, E., & Larochelle, H. (2021). Improving reproducibility in machine learning research (a report from the NeurIPS 2019 reproducibility program). Journal of Machine Learning Research, 22(164), 1–20. https://www.jmlr.org/papers/v22/20-303.html

How to cite this article

Choose your referencing style, then copy. Check your university's or journal's guide for local variations.

PhD Research Lab Academy. (2026, April 13). Using ANOVA to compare algorithms in computer science experiments: design, assumptions and alternatives. PhD Research Lab. https://www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore/

PhD Research Lab Academy. “Using ANOVA to Compare Algorithms in Computer Science Experiments: Design, Assumptions and Alternatives.” PhD Research Lab, 13 Apr. 2026, www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore. Accessed [access date].

PhD Research Lab Academy (2026) Using ANOVA to compare algorithms in computer science experiments: design, assumptions and alternatives. PhD Research Lab. Available at: https://www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore/ (Accessed: [access date]).

PhD Research Lab Academy. “Using ANOVA to Compare Algorithms in Computer Science Experiments: Design, Assumptions and Alternatives.” PhD Research Lab. April 13, 2026. https://www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore.

PhD Research Lab Academy, ‘Using ANOVA to Compare Algorithms in Computer Science Experiments: Design, Assumptions and Alternatives’ (PhD Research Lab, 13 April 2026) <https://www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore> accessed [access date].

PhD Research Lab Academy. Using ANOVA to compare algorithms in computer science experiments: design, assumptions and alternatives [Internet]. PhD Research Lab; 2026 Apr 13 [cited [access date]]. Available from: https://www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore/

PhD Research Lab Academy, “Using ANOVA to compare algorithms in computer science experiments: design, assumptions and alternatives,” PhD Research Lab, Apr. 13, 2026. [Online]. Available: https://www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore. [Accessed: [access date]].

@online{phd_research_methodology_writing_services_in_singapore_2026,
  author = {{PhD Research Lab Academy}},
  title = {{Using ANOVA to compare algorithms in computer science experiments: design, assumptions and alternatives}},
  organization = {PhD Research Lab},
  date = {2026-04-13},
  url = {https://www.phdassistance.com/blog/phd-research-methodology-writing-services-in-singapore},
  urldate = {[access date]}
}

This article is for learning. Use it to understand the method and cite the original sources above in your own work; do not copy or submit it as your own.

Using ANOVA to compare algorithms in computer science experimentsNeed help applying it to your study?
Quantitative analysis