Full or fractional factorial design with its aliases
doe_factorial_design
Lists the runs of a full or two-level fractional factorial design, in standard or seeded random order.
- Runs
- On the server
- Level
- Checked against a reference: kind not recorded
What it is
Returns a full or two-level fractional factorial's runs in standard or seeded random order, coded and in natural units. Use when planning a screening or factorial experiment; a fraction takes your generators and returns its defining relation, resolution and aliases. Not for analysing a two-factor experiment's results: use `stats_two_way_anova`. Refuses fractions over 11 factors and any design over 2,048 runs in all; numeric levels carry their unit, listed ascending. By column: entry i of every column is run i; coded and natural hold one column per factor, in factorNames order. A measurement's unit is required, never assumed: any unit of the kit's table, returned in its canonical spelling; a unit group takes one unit, never converted.
Field: Statistics and design.
What it does
You give
type(required): 'full' (every combination of levels) or 'fractional' (a two-level fraction from your generators).factors(required): The factors, in the order of the design's columns.centrePoints(required): Centre points after each replicate (0 for none); numeric two-level factors only. Must be at least 0.replicates(required): Replicates of the whole design, at least 1; the whole design at most 2,048 runs in all. Must be at least 1.runOrder(required): 'standard' (the first factor fastest) or 'randomised' (complete randomisation of all runs, replicates and centre points included, from the seed). Required, no default.seed(required): The seed of the deterministic random source; required when runOrder is 'randomised', refused otherwise. An integer from 0 to 2^53 − 1; choose it before seeing the order.
and 2 more, listed below
No request is recorded for this tool.
Limits
- Research statistics and experimental-design arithmetic on the data, margins, prevalence and settings you supply.
- Not for diagnosis or treatment decisions and not a regulatory analysis.
- It does not choose a design, a margin, a cut-off or a sample size for you.
- Designs are constructions from the factors, and any generators, you state.
- Only the factorial design offers a randomised run order: complete randomisation of every run from your seed, with no blocking.
- The other designs come in standard order only.
- A centre point is the arithmetic midpoint of the natural levels, not the geometric centre.
- Every computed number a reply returns, other than an integer or an exact decimal, is rounded once to 12 significant figures: to the nearest, a change of at most 5 × 10⁻¹² of its value, except that a lower bound is rounded down and an upper bound up, a change of less than 1 × 10⁻¹¹; the method computes, and decides any pass or fail, on the unrounded value.
It will not answer when
- a full factorial with fewer than 2 or more than 10 factors, or more than 5 levels for a factor; a fraction with fewer than 3 or more than 11 factors; any design of more than 2048 runs in all, replicates and centre points included (Drybench ruling, 11 November 2026, the reply cap).
- a fraction with a factor not at two levels.
- a generator naming an unknown or repeated factor, a word of one letter, or a word using an added factor.
- two added factors with the same word.
Every input, with its units8 inputs
type(required): 'full' (every combination of levels) or 'fractional' (a two-level fraction from your generators).factors(required): The factors, in the order of the design's columns.centrePoints(required): Centre points after each replicate (0 for none); numeric two-level factors only. Must be at least 0.replicates(required): Replicates of the whole design, at least 1; the whole design at most 2,048 runs in all. Must be at least 1.runOrder(required): 'standard' (the first factor fastest) or 'randomised' (complete randomisation of all runs, replicates and centre points included, from the seed). Required, no default.seed(required): The seed of the deterministic random source; required when runOrder is 'randomised', refused otherwise. An integer from 0 to 2^53 − 1; choose it before seeing the order.report(required): 'design' (runs, resolution, generators) or 'design-and-aliases' (adds the defining relation and the aliases of main effects and two-factor interactions).generators: Fractional only: one generator per added factor. Optional.
Every refusal, with its code10 refusals
| Code | When |
|---|---|
OUT_OF_RANGE | a full factorial with fewer than 2 or more than 10 factors, or more than 5 levels for a factor; a fraction with fewer than 3 or more than 11 factors; any design of more than 2048 runs in all, replicates and centre points included (Drybench ruling, 11 November 2026, the reply cap). |
NOT_TWO_LEVEL | a fraction with a factor not at two levels. |
GENERATOR_INVALID | a generator naming an unknown or repeated factor, a word of one letter, or a word using an added factor. |
GENERATORS_DEPENDENT | two added factors with the same word. |
CENTRE_CATEGORICAL | centre points with a categorical factor. |
CENTRE_NOT_TWO_LEVEL | centre points with a factor not at two levels. |
DUPLICATE_NAME | two factors share a name. |
LEVELS_TOO_FEW | a factor with fewer than two levels. |
LEVELS_EQUAL | a factor with two equal levels. |
LEVELS_NOT_ASCENDING | a numeric factor's levels not listed ascending; they are never sorted, because coding is by position. |
The calculation
The method's equations, constants and worked example.
Equation 1
run r (counted from 0) sets base factor i to level index ⌊r / Π_{j<i} m_j⌋ mod m_i: the first factor changes fastest
runs N = R·(n_base + n_c), n_base = Π m_i for a full factorial and 2^(k − p) for a fraction. In the reply, run numbers count from 1
list positions count from 0 (entry i of every design column is run i + 1)
point is 'factorial' for a design run and 'centre' for a centre point
resolution is 'full' for a full factorial
| Symbol | Meaning |
|---|---|
r | run index within a replicate, counted from 0 |
i, j | base factor positions in the order given, counted from 0 |
m_i | levels of factor i |
N | runs in all |
R | replicates |
n_base | runs per replicate before centre points |
n_c | centre points per replicate |
k | factors |
p | generators (added factors) of a fraction |
Source 1.
Equation 2
coding is by position in the list as given, never sorted: numeric level j of m (j counted from 0, levels listed ascending): x = −1 + 2j/(m − 1)
categorical: x = −1, +1 at two levels, and x = j + 1 (codes 1 … m) above two
| Symbol | Meaning |
|---|---|
x | coded value |
j | level position in the list as given, counted from 0 |
m | levels of the factor |
Source 1.
Equation 3
an added factor's column is the product of its generator's base columns: X_a = Π_{b ∈ word} X_b
| Symbol | Meaning |
|---|---|
X | coded column |
Source 1.
Equation 4
the words {a} ∪ word_a and all their products under symmetric difference (x·x = I), 2^p − 1 words
resolution = the length of the shortest word
the aliases of an effect e are e·w for every word w. Order in the reply: a word (in definingRelation, an effect, or an alias) lists its factors' names in the order the factors are given
definingRelation lists its words shortest first, and words of one length in lexicographic order of their factor positions (at the first position where two words differ, the word with the earlier factor comes first: ABE before ACD)
aliases has one entry for each main effect in factor order, then for each two-factor interaction (i, j), i < j, in lexicographic order ((1, 2), (1, 3), …, (k − 1, k))
each entry's aliasedWith lists e·w for every word w, sorted by the same rule as definingRelation (shortest first, then lexicographic in factor positions), not in the order of the words w
| Symbol | Meaning |
|---|---|
p | number of generators |
Source 1.
Equation 5
a centre point is coded 0 on every factor, and its natural value for a factor is the midpoint of the factor's two levels, (low + high)/2, in the levels' unit. In standard order a replicate's centre points follow its runs (the suite's convention)
NIST 5.3.3.3.2 recommends centre points at the beginning, the middle and the end of the experiment, which standard order does not do: choose the randomised order, or place them yourself
| Symbol | Meaning |
|---|---|
low | the factor's first (lower) level (in the caller's unit), as-given |
high | the factor's second (higher) level (in the caller's unit), as-given |
Source 1.
Equation 6
a call is checked in this order, and the first rule it meets answers: (1) the kit's schema and argument checks, all invalid input (an unknown or misspelt argument, a type, a count, a unit
a seed given with runOrder 'standard' is UNKNOWN_ARGUMENT, a missing seed with 'randomised' MISSING_ARGUMENT)
(2) each factor in the order given: a numeric factor without levels, or a categorical one without levelNames, MISSING_ARGUMENT, and the other list given as well INVALID_OPTION
(3) DUPLICATE_NAME
(4) each factor in the order given: LEVELS_TOO_FEW, then LEVELS_EQUAL or LEVELS_NOT_ASCENDING at the first adjacent pair of levels that fails (a categorical factor: LEVELS_EQUAL for a repeated name)
(5) a fraction without generators MISSING_ARGUMENT, a full factorial with generators INVALID_OPTION
(6) refused: the number of factors OUT_OF_RANGE, then a full factorial's levels above five OUT_OF_RANGE, or a fraction's factor not at two levels NOT_TWO_LEVEL
(7) with centre points: CENTRE_CATEGORICAL, then CENTRE_NOT_TWO_LEVEL
(8) each generator in the order given: GENERATOR_INVALID
then a word that uses an added factor GENERATOR_INVALID
then GENERATORS_DEPENDENT
(9) the runs in all OUT_OF_RANGE
| Symbol | Meaning |
|---|---|
k | factors |
Equation 7
complete randomisation: one Fisher–Yates shuffle of all N runs (replicates and centre points included) by the shared generator prng 1.0.0 from the caller's seed
run k (1-based) is the standard-order run at the shuffle's position k − 1
a run's standard-order position (1-based) is (replicate − 1)·(n_base + c) + standardOrder, standardOrder restarting in each replicate (n_base base runs, c centre points per replicate)
| Symbol | Meaning |
|---|---|
N | runs |
n_base | runs per replicate before centre points |
c | centre points per replicate |
k | position in run order, counted from 1 |
Source 1.
Conventions
- type = full: Every combination of the factors' levels (2 to 5 each), in standard order; no relation or aliases (a full factorial aliases nothing): with report 'design-and-aliases', definingRelation and aliases are returned as empty lists, and resolution is 'full'.
- type = fractional: The two-level fraction 2^(k−p) in which each added factor is the product of its stated generator's base factors, in standard order of the base, with its defining relation, resolution and aliases.
- runOrder = standard: Standard order: the first factor changes fastest; each replicate's runs, then its centre points.
- runOrder = randomised: Complete randomisation of all N runs, replicates and centre points included: replicate numbers label copies of the design, not batches or days. Choose the seed before you see the order. This seed reproduces this order only with doe-factorial 1.1.0 or 1.1.1 (the same order) and pcg32-xsh-rr@1.
A definition, not a model: the equation states what the quantity means. A different convention gives a different number.
Worked example
Worked example: one case of doe-factorial@1.1.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
- type = full
- factors[0].name = temperature
- factors[0].kind = numeric
- factors[0].levels[0] = 20 degC
- factors[0].levels[1] = 25 degC
- factors[0].levels[2] = 30 degC
- factors[0].levels[3] = 37 degC
- factors[1].name = medium
- factors[1].kind = categorical
- factors[1].levelNames[0] = A
- factors[1].levelNames[1] = B
- centrePoints = 0
- replicates = 1
- runOrder = standard
- report = design
Steps
- n-runs = 8, from factors; by equation 1; gives runs.
- c-first = -1, from factors[0].levels[0]; by equation 2; gives design.coded[0].values[0].
- c-second = -0.33333333, from factors[0].levels[1]; by equation 2; gives design.coded[0].values[1].
- c-medium-b = 1, from factors[1].levelNames[1]; by equation 2; gives design.coded[1].values[4].
The working, as the case writes it:
c_j = -1 + 2(j-1)/3: j = 1..4 gives -1, -1/3, 1/3, 1
the two-level categorical factor is coded -1 (A), +1 (B)
factor 1 fastest
Answer
runs = 8
design.coded[0].values[0] = -1
design.coded[0].values[1] = -0.33333333
design.coded[1].values[4] = 1
Where these values came from: our own exact-arithmetic script and a hand-worked case; exact arithmetic.
At build the tool returned this answer within the tolerance the file states: exact: run indices, counts, words of the relation, alias sets, resolution, statuses and codes; coded values to 1e-15 absolute; natural values exact.
Sources
NIST/SEMATECH e-Handbook of Statistical Methods, section 5.3.3 (How do you select an experimental design?)
Used for: Full factorial and two-level fractional factorial designs in standard or seeded randomised order, with the defining relation, resolution and aliases. At: section 5.3.3.3.1, standard order; Table 3.3; section 5.3.3.3.2: low −1, high +1; the multi-level and categorical rules as ruled by Drybench (ruling of 10 November 2026, point 5); section 5.3.3.4.2 (X3 = X1*X2) and 5.3.3.4.3 (design generator, "3 = 12", I = 123); section 5.3.3.4.4: the construction (6 = 345), the defining relation (2^p − 1 words) and resolution (the length of the shortest word); section 5.7, glossary: Center Points (points at the center value of all factor ranges) and Coding Factor Levels (a = (X_h + X_L)/2; the center point, where the coded value is 0, at a); section 5.7, glossary: randomization (the conditions in one run neither depend on the previous run nor predict the next) and blocking ("achieved by restricting randomization"; not offered); the shuffle is the prng record's; the placement of replicates and centre points in one permutation is the library's stated convention (Drybench ruling, 10 November 2026, randomisation).
Read in full, 10 November 2026
How it is checked
- Level
Checked against a reference.
- Checked against
A published dataset, NIST/SEMATECH e-Handbook of Statistical Methods 5.3.3.4.7 design files, Dataplot files of December 1988; an outside program, pyDOE3, 1.6.2; our own exact-arithmetic script and a hand-worked case; an outside program, stored reference values (independent implementation of the prng record) and exact arithmetic (Python fractions), stored reference values SHA-256 7e51ed51ebf432a7fdd920500745bfeebff5501f29f26756ad91ef5f6bdd78f0.
- Cases
No case set is linked to this version.
- Not checked
Restricted randomisation (within replicate or block), split-plot designs and hard-to-change factors are not offered; a seed's order is not checked against any other generator; fractions above 11 factors; blocking; the choice of generators, which is the caller's (no table look-up); designs with more than 5 levels per factor; NIST's misprinted or abridged relations and chains are not asserted (the pyDOE3 companions cover those designs).
Changes to its methods1 change
- 14 November 2026, doe-factorial@1.1.1: In 1.1.1 the centre is low/2 + high/2 where low + high overflows (1.35e308 for these levels), the correctly rounded midpoint. Every other value is unchanged, bit for bit; no published case moved. The record now also states the order of the words in the defining relation and the alias lists, the order the tool always used.