Plan, generate, verify and analyze designed experiments (DOE) using the process-improve library. Use whenever the user wants to design an experiment, screen factors, optimize a process or formulation, build a response surface, choose a fractional factorial or Plackett-Burman or Box-Behnken or central composite or definitive screening design, check a design's resolution or aliasing or power, analyze experimental results, fit effects and interactions, produce a Pareto or half-normal or main-effects or interaction or contour plot, or find optimal factor settings. Also use when asked to check whether an existing design matrix is any good.
Resources
3Install
npx skillscat add kgdunn/process-improve/doe-designer Install via the SkillsCat registry.
Designed experiments
You are helping someone spend their lab time well. Every run costs money and
days, so the design has to be right before the first sample is made, and the
analysis has to be honest about what the data can and cannot support.
The one rule that matters most
Never write out a design matrix yourself. Generate it with a tool, then
verify it.
This is not a stylistic preference. Vazquez, Rother and Charles-Gonzalez
(2026, arXiv:2512.17113) had GPT and Gemini models construct two-level
fractional factorial designs with 8, 16 and 32 runs and 4 to 26 factors, and
compared the results against the best-known designs on resolution and minimum
aberration. The models produce optimal designs reliably only up to about eight
factors, and degrade beyond that. A degraded design still looks entirely
plausible on the page. A resolution-2 design aliases one
main effect with another, so the experiment cannot answer its own question, and
nobody finds out until the results make no sense.
The catalogs in this library do not have that failure mode. So:
- Call
generate_design(orcreate_factorial_design) to build the matrix. - Run
verify_design.pyon it, or callevaluate_designwith themoment_aberrationmetric. - Report the resolution and what it costs the user, in words, every time.
If a user pastes in a design from a chatbot, a spreadsheet or an old report,
verify it before analyzing anything. moment_aberration works on any
two-level matrix with no generators or defining relation needed, so there is
never an excuse to skip the check.
Workflow
Work through these in order. Do not jump to generating a design before you
know what the user is actually trying to learn.
1. Interview before designing
You need these before a design is meaningful. Ask for whatever is missing,
but ask in one batch, not one question at a time:
- Response(s): what is measured, in what units, and is the goal to
maximize, minimize or hit a target? How repeatable is the measurement? - Factors: what can actually be set, with a plausible low and high for
each. Distinguish factors from things that are merely recorded. - Budget: how many runs are affordable, and over what calendar time.
- Constraints: combinations that are impossible or unsafe; factors that
are expensive to change between runs (these force a split-plot). - Prior knowledge: what is already known or suspected to matter. This is
what separates a screening problem from an optimization problem.
A common and important correction: users often arrive asking for a response
surface when they have eleven candidate factors. That is a screening problem.
Say so, and explain the staging.
2. Recommend a strategy
recommend_strategy takes the interview answers and returns a staged plan
with run counts, transition rules, budget allocation, assumptions and risks.
It applies deterministic decision rules rather than judgment, so use it
instead of reasoning from scratch about which design to pick.
python scripts/doe_tool.py call recommend_strategy --input strategy.jsonExperiments are almost always staged: screen, then optimize, then confirm.
Spending the whole budget on one big design is the most common expensive
mistake. Aim to spend roughly a quarter to a third of the budget on the first
stage and keep the rest for what the first stage teaches you.
3. Generate the design
python scripts/doe_tool.py call generate_design --input design_spec.jsonDesign types available: full_factorial, fractional_factorial,plackett_burman, box_behnken, ccd, dsd, d_optimal, i_optimal,a_optimal, mixture, taguchi. Omit design_type to let the tool choose
from the factors and budget.
Always include center points (default 3) for continuous factors: they buy a
pure-error estimate and a curvature test for very little money.
See references/choosing-a-design.md for which design fits which situation.
4. Verify, always
python scripts/verify_design.py design.csv --require-resolution 4This exits non-zero when the design does not meet the bar, so it is safe to
use as a gate. Then tell the user in plain words what the resolution means for
their experiment. references/verification.md has the wording for each
resolution and the other quality metrics worth reporting.
5. Randomize and hand over the run sheet
Give the user a run sheet in real units, not coded ones, with the run order
randomized and a column to write results into. Randomization is not optional:
it is what protects the experiment against drift in ambient conditions,
operator fatigue and raw-material lots. If the user cannot randomize (a
factor is too expensive to change), say that the analysis will need to treat
it as a split-plot, and record which factor it was.
6. Analyze
python scripts/doe_tool.py call analyze_experiment --input results.jsonAnalysis types: anova, effects, coefficients, significance,residual_diagnostics, lack_of_fit, curvature_test, model_selection,box_cox, lenth_method, confidence_intervals, prediction,confirmation_test.
Always run residual_diagnostics. A model with a good R-squared and patterned
residuals is worse than useless, because it is confidently wrong. For an
unreplicated factorial there are no degrees of freedom for error, so uselenth_method rather than an F-test.
references/analysis-workflow.md has the full sequence and the traps.
7. Plot
python scripts/render_plot.py --analysis analysis.json --type pareto --output pareto.pngLead with a Pareto or half-normal plot of the effects, then main-effects and
interaction plots for whatever turned out to matter. Write .png for a
static image or .html for an interactive page that needs nothing installed.
8. Optimize and confirm
optimize_responses finds settings that balance several responses via
desirability. Whatever it returns is a prediction, and predictions at the
edge of the design space are the least trustworthy ones. Always propose
confirmation runs and check them with analysis_type: confirmation_test.
9. Decide the next round
python scripts/doe_tool.py call recommend_next_step --input study.jsonAfter every round, pass every run made so far and do what action says,
rather than choosing the next design by hand. It judges the terms, tests
whether anything stands out at all, and returns the next runs in real units,
the reasons with their numbers, and what to do with the runs once made:
append them to runs and call again; for confirm, pass them asconfirmation_runs; for widen_ranges and move_region, change the ranges
as the reply says and start the runs afresh. Pass history, the actions so
far, and ranges_can_move: false when a range is a hard limit. Quote itsreasons to the user: they are the evidence, not a paraphrase of it.
Tools
Every tool below is reachable through scripts/doe_tool.py call <name>, andscripts/doe_tool.py list prints whatever the registry currently holds. Runpython scripts/doe_tool.py spec <name> to see the exact input schema before
calling, rather than guessing at field names.
| Tool | Use it for |
|---|---|
recommend_strategy |
"How should I plan this?" Staged plan from factors, budget, domain |
doe_knowledge |
Definitions, design-type descriptions, diagnostics, decision logic |
query_concept_graph |
How the textbook's terms connect, in Cypher: what remedies a symptom, what a method needs, how two ideas are related. Every answer carries the book line. Needs pip install relate-db |
generate_design |
Build a design matrix |
write_run_sheet |
The runs as a CSV or Excel sheet for the lab or an upload: actual or coded units, columns named or X01..Xnn, empty response columns |
read_run_sheet |
A filled sheet back into the factors' names and actual units, whichever units and labels it was written in |
create_factorial_design |
Quick 2^k full factorial |
evaluate_design |
Resolution, aliasing, moment aberration, D/I/G-efficiency, VIF, power |
compare_designs |
Several designs side by side for one model: A, D, E, G, I, max correlation, power |
simulate_design_performance |
"Would this design find what I expect?" Designs run many times on the process you expect and analyzed as the next step analyzes them: the share that finds each term, false alarms, distance from the best settings |
analyze_experiment |
ANOVA, effects, diagnostics, Lenth, Box-Cox, confirmation |
analyze_omars |
The staged analysis of a definitive screening (DSD) or OMARS design; returns a model formula to fit and optimize |
yates_table |
The working a textbook prints for a full 2^k or 3^k factorial: Yates's columns, effects and sums of squares; with keep, a 2^k model's fitted values by the reverse algorithm |
interaction_components |
The two-degree-of-freedom components of interactions of three-level factors: AB and AB^2 (Yates's J and I), ABC to AB^2C^2 (Z, Y, X, W) |
recommend_next_step |
"What do I run next?" After every round: confirm, axial runs, fold-over, the path of steepest ascent, or stop, with the runs in real units |
suggest_next_runs |
"Where do I run next?" when no quadratic fits, for a computer experiment, or for runs made one at a time: the runs (1 to 50) where a Gaussian process of every run expects the most improvement, inside the limits, to raise or lower a response or to bring it to a target; little_to_gain says when to confirm instead |
fit_gaussian_process |
A model of a computer experiment (passes through every run), or with noise of runs no quadratic fits: each input's correlation parameter and its share of the variance (sensitivity), and predictions with standard errors |
variance_components |
"How much of the spread comes from the batch, the operator, the test?" REML variance components of random factors, crossed or nested, with intervals and each fixed term's test |
multistratum_anova |
Runs made in groups of several sizes (split-plot, strip-plot, blocks): each term tested against its own stratum's error; without a response, the skeleton's degrees of freedom, to judge a design before it is run |
fit_linear_model |
Explicit model formula when you need control |
augment_design |
Add runs: fold-over, axial points, replicates, de-aliasing |
optimize_responses |
Multi-response desirability optimization |
visualize_doe |
21 plot types, returns Plotly and ECharts specs |
trade_off_table |
Two-level runs-against-factors table: what each budget buys, and its aliasing |
doe_knowledge is the right first call whenever the user asks a conceptual
question ("what is aliasing?", "why center points?"). It returns curated
content from the library's knowledge base rather than a paraphrase.
When the question is about how ideas connect ("what fixes curvature?", "how
is aliasing related to steepest ascent?"), use query_concept_graph. Call it
with no input first: it returns the labels, the link types and example
queries. Quote the evidence of each link you use: it is the line of the
textbook that states it.
Reporting
Give the user, every time:
- The design, in real units, with the run order randomized.
- Its resolution, and one sentence on what that costs them.
- What the design cannot answer. This is the most commonly omitted and most
valuable part of the report. - After analysis: which effects are real, the size of each in response units,
and the residual diagnostics verdict.
Round sensibly. A factor setting of 152.3847 C is false precision, and an
effect quoted to six figures invites more confidence than eight runs support.
References
Load these as needed; they are not required reading for every task.
references/choosing-a-design.md- which design for which situation, run
counts, and the screening-versus-optimization distinction.references/verification.md- what resolution and the other quality
metrics mean, and how to phrase them.references/analysis-workflow.md- the analysis sequence, unreplicated
designs, transformations, and diagnostic traps.references/worked-example.md- a complete end-to-end session.
Setup
The scripts need process-improve:
pip install 'process-improve[plotting]'Each script also carries a PEP 723 header, so uv run --script <script> will
build the environment on its own with nothing installed up front. If a script
reports a missing import, the message names the extra to install.