Skip to content

Methods and checksMethods

How every result is reached and what it was checked against, app by app.

Methods and checks pages

Full-factorial ANOVA for three to six crossed factors, Type II or Type III sums of squares, version 1.0.1

stats-factorial-anova@1.0.1: this version's equations with their symbols, each constant's value, their sources and whether each was read, a worked example where the record holds one, its level and what it was checked against, the number of cases, and what was not checked. This version's record is not rewritten; a correction is added under Changes.

What this page can and cannot show

Level: Checked against a reference; statsmodels 0.15.0 (21 cases, not on offset data); no published unbalanced table; k-factor Type III our derivation. Reference kind: an outside program, LaMotte's Type III formula (in-house, numpy); SciPy; statsmodels, numpy 2.5.4; scipy 1.18.1; statsmodels 0.15.0; an outside program, Python fractions, 3.13.18; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, exact rationals for every sum of squares, mean square and F; p from mpmath 1.4.1's regularised incomplete beta at 50 digits; not an outside program.

Checked by this project, not independently reviewed. Every method on this page has its equations, constants, sources and cases on record, and its cases agree with the stated reference within the stated tolerance. A reader can follow each method's worked example by hand; that shows the stated method gives the stated answer for one set of inputs, and does not test the code. The other cases and their values are not printed, so a reader cannot re-run these checks. No independent scientist has yet reviewed them.

Every version of this method · Every method · What the levels mean

Version 1.0.1

Level: Checked against a reference; statsmodels 0.15.0 (21 cases, not on offset data); no published unbalanced table; k-factor Type III our derivation. Reference kind: an outside program, LaMotte's Type III formula (in-house, numpy); SciPy; statsmodels, numpy 2.5.4; scipy 1.18.1; statsmodels 0.15.0; an outside program, Python fractions, 3.13.18; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, exact rationals for every sum of squares, mean square and F; p from mpmath 1.4.1's regularised incomplete beta at 50 digits; not an outside program. stats-factorial-anova@1.0.1

Built, not hosted. Generated from a snapshot of the library's records taken on 2026-11-25, as committed on 2026-11-25. A later snapshot replaces this one, so these records and this page can change.

Verification statement: Type II and Type III for the full factorial in sum-to-zero contrasts, three to six crossed factors, every cell n ≥ 2. Types II and III as in LaMotte (arXiv:1804.00545v1, a preprint, re-read at source 14 November 2026). That column deletion equals Type III for k factors with every cell filled is Drybench's derivation, re-derived by a second agent and not reviewed by a person. df, MS, F and p are standard definitions, not from LaMotte. Compared with statsmodels 0.15.0 anova_lm on 21 cases (none with values more than 1e4 times their spread from 0), with a second implementation in Python by a separate agent of the same model family (58 cases, 26 at the edges), and, for balanced cases, with exact rational arithmetic. A term whose SS is far below the residual SS agrees to about 1e-12 of the corrected total. No published unbalanced k-way table was found.

From observations on every combination of three to six crossed factors (each cell with at least two values), the full-factorial ANOVA table in sum-to-zero contrasts: each main effect's and interaction's df, sum of squares, mean square, F and p, Type II or Type III as stated, with the residual and corrected total; F and p only for values declared independent replicates.

  • How results are reported: SS, MS and F in full double precision; p in full double precision, or withheld. A non-small p does not show that groups are equal.
  • Uncertainty: An ANOVA table reports tests, not intervals.
  • Every reply through it says: Assumes independent units, normally distributed residuals and equal spread in every cell. This table holds 2^k − 1 F tests, none corrected for multiplicity. A non-small p does not show that groups are equal.
  • Computes through this project's own routines: least squares residual sum of squares and rank by Householder QR; upper tail of the F distribution; rounding-level spread test
  • Reference, as its record states it: statsmodels 0.15.0 anova_lm, a second implementation in Python and exact rational arithmetic
  • Level confirmed by this project's ruling of 14 November 2026

What this page can and cannot show

What was checked

87 cases in 3 files, linked by this exact version.

Run through the tool at build against an outside program, LaMotte's Type III formula (in-house, numpy); SciPy; statsmodels, numpy 2.5.4; scipy 1.18.1; statsmodels 0.15.0; an outside program, Python fractions, 3.13.18; a reference program this project wrote itself, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14, exact rationals for every sum of squares, mean square and F; p from mpmath 1.4.1's regularised incomplete beta at 50 digits; not an outside program: 65 agree within the tolerance the file states, 22 refuse as the case expects, 0 differ, 0 were not run.

  • File 1, 27 cases

    • Where the expected values came from: an outside program, LaMotte's Type III formula (in-house, numpy); SciPy; statsmodels numpy 2.5.4; scipy 1.18.1; statsmodels 0.15.0
    • Recorded on: 2026-11-10
    • Reference: LaMotte's Type III formula (in-house, numpy); SciPy; statsmodels, numpy 2.5.4; scipy 1.18.1; statsmodels 0.15.0; licence BSD-3-Clause
    • Tolerance as the file states it: SS and MS relative 1e-9 or 1e-12·Σ(y − ȳ)² absolute, whichever is larger; F relative 1e-9 or 1e-12·Σ(y − ȳ)²/(df·MS_residual); p relative 1e-8 (Drybench ruling, 10 November 2026, level review, condition 1); df, counts, names, statuses and codes exact
  • File 2, 5 cases

    • Where the expected values came from: an outside program, Python fractions 3.13.18
    • Recorded on: 2026-11-10
    • Reference: Python fractions, 3.13.18; licence PSF-2.0
    • Tolerance as the file states it: SS and MS relative 1e-12 or 1e-12·Σ(y − ȳ)² absolute, whichever is larger (Drybench ruling, 10 November 2026, G3 floor); df, counts, names, statuses and codes exact
  • File 3, 55 cases

    • Where the expected values came from: an outside program, second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only) 2026-11-14
    • Recorded on: 2026-11-14
    • Reference: second implementation (Python 3.13; NumPy, SciPy distribution functions and mpmath only), 2026-11-14; licence BSD-3-Clause
    • Tolerance as the file states it: every number relative 1e-9 (absolute 1e-21 below 1e-12, in its own unit: a sum of squares that is 0 by structure comes out as rounding residue from floating least squares; p absolute 1e-307 below 1e-297); df, counts, statuses, codes and strings exact

Apart from the worked example, the cases and their values are not printed here. This shows agreement with this project's recorded cases. It does not show that a method suits your work, and it is not a qualification.

What was not checked

Post-hoc tests, simple effects and marginal-mean comparisons (held: the comparison family in k factors needs its own ruling); empty cells and fractional or incomplete designs; random and mixed effects, covariates and blocking; Type I sums of squares; a published unbalanced k-way table (none found).

Equations

Equation 1

SS_III(T) = RSS(full model without T's sum-contrast columns) − RSS(full model)
with every cell filled and the full factorial this is LaMotte's Type III, y′(P_X − P_(X0, X2*))y, and tests equal-weight marginal means H_T η = 0 (Drybench ruling, 10 November 2026, k-factor derivation, design Q1). That column deletion equals Type III for k factors with every cell filled is Drybench's derivation, not reviewed by a person
a second agent re-derived it for filled cells through an invertible saturated sum-contrast design (14 November 2026)
Symbol Meaning and unit
T a main effect or interaction
RSS residual sum of squares (in the caller's unit squared), as-given^2
sum contrasts a factor of L levels, in the order given, has L − 1 columns: level l (counted from 0, l < L − 1) is 1 in column l and 0 in the others, the last level −1 in every column; an interaction's columns are the products of its factors' columns; terms in the order main effects, then two-factor interactions, … in factor order

Source: LaMotte LR. A formula for Type III sums of squares. arXiv:1804.00545v1 [stat.ME], 29 March 2018, section section 2, p. 5 (P3 = P_X − P_(X0, X2*), from the SPSS definition quoted on p. 3); section 3, pp. 7–11 (two factors: Type III = restricted-minus-full SS); p. 2 (column deletion is correct only in some cases), arXiv:1804.00545v1 (the only version); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 1ffe218946c8. Free to read (arXiv non-exclusive licence to distribute), checked 2026-11-11. No erratum found (searched arXiv API listing of 1804.00545: v1 is the only version), 2026-11-11.

Equation 2

SS_II(T) = RSS(X0) − RSS(X0, T), X0 = the intercept and every term not containing T
Symbol Meaning and unit
X0 the terms not containing T

Source: LaMotte LR. A formula for Type III sums of squares. arXiv:1804.00545v1 [stat.ME], 29 March 2018, section p. 6: Type II has sp(X0, X1) as the full model and sp(X0) as the restricted model, arXiv:1804.00545v1 (the only version); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 1ffe218946c8. Free to read (arXiv non-exclusive licence to distribute), checked 2026-11-11. No erratum found (searched arXiv API listing of 1804.00545: v1 is the only version), 2026-11-11.

Equation 3

MS(T) = SS(T)/df(T), df(T) = Π_{f ∈ T}(levels_f − 1)
residual: SS = RSS(full), df = N − Π levels, MS = SS/df
F(T) = MS(T)/MS(residual)
p = P(F_{df(T), N − Π levels} ≥ F)
corrected total SS = Σ(y − ȳ)² on N − 1 df. Balanced (every cell holds the same number n of values): Types II and III agree, and SS(A) = n·(Π levels/L_A)·Σ_a(ȳ_a − ȳ)², SS(AB) = n·(Π levels/(L_A·L_B))·Σ_ab(ȳ_ab − ȳ_a − ȳ_b + ȳ)², and so on by inclusion and exclusion of the marginal means. The table is withheld (ZERO_VARIANCE_GROUP) when no cell spreads beyond rounding: in every cell max − min ≤ 2·n_c·ε·M, n_c the cell's size, M its largest |y| and ε = 2^−52. df, MS, F, p, the corrected total and the balanced closed forms are standard definitions, not in LaMotte
Symbol Meaning and unit
N observations
levels_f, L_A levels of factor f, of factor A
ȳ_a, ȳ_ab, ȳ marginal means of level a, of the cell ab, and the grand mean (in the caller's unit), as-given
n_c values in a cell
M largest absolute value in a cell (in the caller's unit), as-given
ε double-precision machine epsilon
F F statistic
p p-value

Source: LaMotte LR. A formula for Type III sums of squares. arXiv:1804.00545v1 [stat.ME], 29 March 2018, section p. 1 and p. 6: the sums of squares an effect's F statistic tests, against the full model's residual (Type II's full and restricted models, p. 6); df, MS, F, p and the balanced closed forms are standard definitions, not in LaMotte, arXiv:1804.00545v1 (the only version); read in full on 2026-11-10 by an AI-assisted session; not yet checked by a person. Read from the file itself, SHA-256 beginning 1ffe218946c8. Free to read (arXiv non-exclusive licence to distribute), checked 2026-11-11. No erratum found (searched arXiv API listing of 1804.00545: v1 is the only version), 2026-11-11.

Conventions

What each mode computes:

  • sumsOfSquares = type-iii: Each effect compares marginal means weighted equally over the other factors' levels.
  • sumsOfSquares = type-ii: Each term is adjusted for the terms that do not contain it, not for those that do; with unequal cell counts the hypothesis tested for a lower-order term depends on those counts.

Constants

Constants: none used.

Worked example

Worked example: one case of stats-factorial-anova@1.0.1, from its inputs through each step to the answer. Values are written as a person writes them; the working carries more digits, so your own figure may differ in the last digit shown.

Inputs

  • factors[0].name = temperature
  • factors[0].levels[0] = te1
  • factors[0].levels[1] = te2
  • factors[1].name = pH
  • factors[1].levels[0] = pH1
  • factors[1].levels[1] = pH2
  • factors[2].name = feed
  • factors[2].levels[0] = fe1
  • factors[2].levels[1] = fe2
  • observations[0].levels[0] = te1
  • observations[0].levels[1] = pH1
  • observations[0].levels[2] = fe1
  • observations[0].value = -1.19 g
  • observations[1].levels[0] = te1
  • observations[1].levels[1] = pH1
  • observations[1].levels[2] = fe1
  • observations[1].value = -0.98 g
  • observations[2].levels[0] = te1
  • observations[2].levels[1] = pH1
  • observations[2].levels[2] = fe2
  • observations[2].value = -1.17 g
  • observations[3].levels[0] = te1
  • observations[3].levels[1] = pH1
  • observations[3].levels[2] = fe2
  • observations[3].value = 1.96 g
  • observations[4].levels[0] = te1
  • observations[4].levels[1] = pH2
  • observations[4].levels[2] = fe1
  • observations[4].value = 0.57 g
  • observations[5].levels[0] = te1
  • observations[5].levels[1] = pH2
  • observations[5].levels[2] = fe1
  • observations[5].value = 0.26 g
  • observations[6].levels[0] = te1
  • observations[6].levels[1] = pH2
  • observations[6].levels[2] = fe2
  • observations[6].value = 1.13 g
  • observations[7].levels[0] = te1
  • observations[7].levels[1] = pH2
  • observations[7].levels[2] = fe2
  • observations[7].value = 1.12 g
  • observations[8].levels[0] = te2
  • observations[8].levels[1] = pH1
  • observations[8].levels[2] = fe1
  • observations[8].value = -1.07 g
  • observations[9].levels[0] = te2
  • observations[9].levels[1] = pH1
  • observations[9].levels[2] = fe1
  • observations[9].value = -0.11 g
  • observations[10].levels[0] = te2
  • observations[10].levels[1] = pH1
  • observations[10].levels[2] = fe2
  • observations[10].value = 1.89 g
  • observations[11].levels[0] = te2
  • observations[11].levels[1] = pH1
  • observations[11].levels[2] = fe2
  • observations[11].value = 0.07 g
  • observations[12].levels[0] = te2
  • observations[12].levels[1] = pH2
  • observations[12].levels[2] = fe1
  • observations[12].value = 1.42 g
  • observations[13].levels[0] = te2
  • observations[13].levels[1] = pH2
  • observations[13].levels[2] = fe1
  • observations[13].value = -0.65 g
  • observations[14].levels[0] = te2
  • observations[14].levels[1] = pH2
  • observations[14].levels[2] = fe2
  • observations[14].value = 2.47 g
  • observations[15].levels[0] = te2
  • observations[15].levels[1] = pH2
  • observations[15].levels[2] = fe2
  • observations[15].value = 1.4 g
  • replicates = technical
  • sumsOfSquares = type-iii

Steps

  1. mean-te1 = 0.2125 g, from observations; by equation 1.
  2. mean-te2 = 0.6775 g, from observations; by equation 1.
  3. ss-temperature = 0.8649 g², from mean-te1, mean-te2; by equation 1; gives terms[0].ss.
  4. ss-residual = 9.8005 g², from observations; by equation 1; gives residual.ss.
  5. ms-residual = 1.2250625 g², from ss-residual; by equation 3; gives residual.ms.

The working, as the case writes it:

for a 2-level term, H_T ȳ at each cell is ± (the contrast of cell means)/2^k summed over the 2^k cells
SS_T = n · Σ_cells (H_T ȳ)² = (n·2^k/4^|T|)·(Σ ± ȳ)²/2^(k-|T|)…
computed here by inclusion-exclusion over the marginal means in fractions

Answer

  • terms[0].ss = 0.8649 g²
  • residual.ss = 9.8005 g²
  • residual.ms = 1.2250625 g²

Where these values came from: an outside program, Python fractions 3.13.18; exact rational arithmetic: SS_T = n·||H_T ȳ||² over the cell means (balanced: every type agrees).

At build the tool returned this answer within the tolerance the file states: SS and MS relative 1e-12 or 1e-12·Σ(y − ȳ)² absolute, whichever is larger (Drybench ruling, 10 November 2026, G3 floor); df, counts, names, statuses and codes exact.

Who worked this case: not recorded.

What it refuses, and its input ranges

  • OUT_OF_RANGE: more than 128 combinations of levels (Drybench ruling, 10 November 2026, caps, item 1; with at most 1000 observations, 32 levels per factor and level names of 16 characters, enforced as list and text limits) Next: Use fewer factors or levels, so that the combinations of levels are within the stated limit.
  • EMPTY_CELL: a combination of levels with no observation, including a declared level with no rows: Type III then differs from the restricted-minus-full SS (LaMotte, p. 11) Next: Give at least two observations for every combination of levels, or leave out the levels with none.
  • CELL_N_TOO_SMALL: a cell with one observation: every cell needs at least two Next: Give at least two observations for every combination of levels.

Flags and notes a reply may carry

A note a reply may carry:

  • BALANCED: Cell counts are equal: Types II and III agree.
  • UNBALANCED: Cell counts are unequal: Types II and III test different hypotheses for the lower-order terms; report which type was used.

Changes

No correction is logged for stats-factorial-anova@1.0.1.

Tools that use it

Cite this version

Full-factorial ANOVA for three to six crossed factors, Type II or Type III sums of squares. Drybench; stats-factorial-anova@1.0.1; https://www.drybench.com/methods/m/stats-factorial-anova/1.0.1 (accessed [date]).