experimental-design
Skill1 starsChanged 3 months agoMITView on GitHub
Plan and analyze experiments with design of experiments (DOE) using pyDOE2/dexpy, response surface methodology, power analysis and sample-size calculations with statsmodels, and Bayesian optimization with BoTorch. Use when sizing an A/B test, building a fractional factorial, fitting a response surface, or running a sequential design.
- Installs packages
13 other projects use a version of this.
Adopted by
Most recently taken up by
- delorenj/skillstheir own version, first seen Nov 8, 2026
- DaeSeokSong/oh-my-ouroborostheir own version, first seen Nov 1, 2026
- PracticalSwan/agent-skillstheir own version, first seen Nov 1, 2026
- patoangolano/bio-stacktheir own version, first seen Oct 15, 2026
- Luooops/skillstheir own version, first seen Oct 13, 2026
- ashurbio/claude-skillstheir own version, first seen Oct 8, 2026
Used with
Projects with it also use statistical-analysis.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
AnthropicSkillstatistical-analysis
Apply statistical methods including descriptive stats, trend analysis, outlier detection, and hypothesis testing. Use when analyzing distributions, testing for significance, detecting anomalies, computing correlations, or interpreting statistical results.
Also in 3 projects that use this
Other versions13 projects use a version of this.
Word for word · 1
- Pratikrishi97/sciagent-skills★ 1100% same
Edited · 0
None found.
Wrote their own version · 12
- xjtulyc/awesome-rosetta-skills★ 34same name
- PracticalSwan/agent-skills★ 22same name
- delorenj/skills★ 17same name
- DaeSeokSong/oh-my-ouroboros★ 3same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- rmusser01/tldw-stuff★ 2same name
- AngelCampa1/decision-making-skills★ 1same name
- Luooops/skills★ 1same name
- yigityildiz0/scientific-agent-skills★ 1same name
- andfrancot-alt/claude-skills★ 0same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository41 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- admet-predictionSkill
- astrophysicsSkill
- biostatisticsSkill
- cheminformaticsSkill
- citation-managementSkill
- climate-scienceSkill
- clinical-nlpSkill
- clinical-researchSkill
- computational-chemistrySkill
- computational-physicsSkill
- data-visualizationSkill
- deep-learningSkill
- drug-discoverySkill
- epidemiologySkill
- evolutionary-biologySkill
- genomicsSkill
- geospatial-analysisSkill
- grant-writingSkill
- hpc-computingSkill
- instrument-integrationSkill
- lab-automationSkill
- literature-reviewSkill
- materials-scienceSkill
- medical-imagingSkill
- ml-for-scienceSkill
- notebook-best-practicesSkill
- protein-analysisSkill
- proteomicsSkill
- quantum-computingSkill
- reaction-modelingSkill
- remote-sensingSkill
- reproducible-environmentsSkill
- reproducible-researchSkill
- retrosynthesisSkill
- scientific-computingSkill
- scientific-data-managementSkill
- scientific-presentationsSkill
- scientific-writingSkill
- transcriptomicsSkill
The file
We split this skill into the rules it gives an agent
5 rules. 0 are common, 5 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 11 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 141
Always randomize run order.
- Distinctive: line 144
Use coded units (-1, +1) for analysis.
- Distinctive: line 148
Prefer center points over 3-level factors to test curvature cheaply.
- Distinctive: line 151
Use power simulations (Monte Carlo) when closed-form power is unavailable.
- Distinctive: line 235
Pre-registration: commit to the design and analysis before data collection.
“Common” is measured: kept by at least 6 in 10 of the 11 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Experimental Design
Overview
Good experimental design (DOE) lets you ask the right question of the data before you collect it. This skill covers full/fractional factorial designs, Box-Behnken and central composite designs for response surface methodology (RSM), sample-size and power calculations, randomization with blocking and confounding, and sequential designs via Bayesian optimization with BoTorch. The unifying statistical framing is: pre-register the design, collect data per the randomization, then analyze with an OLS / mixed-effects model that matches the design structure. Anything else is observational data dressed up as an experiment.
When to use this skill
- You are sizing an A/B test, clinical trial, or lab study.
- You are fitting a response surface to find an optimum.
- You need a fractional factorial to screen many factors with few runs.
- You are building a sequential design (Bayesian optimization) for an expensive black-box function.
- You are pre-registering a design and writing the analysis plan.
Prerequisites
- Python 3.10+
- Core:
numpy,pandas,scipy,statsmodels,pyDOE2 - Optional:
dexpy,botorch,gpytorch,matplotlib(for diagnostics) - System: none
- pip install:
pip install numpy pandas scipy statsmodels pyDOE2 pip install dexpy botorch gpytorch matplotlib
Core workflows
1. Full factorial design with pyDOE2
from pyDOE2 import fullfact
import pandas as pd
# 3 factors: A (2 levels), B (2 levels), C (3 levels)
design = fullfact([2, 2, 3])
df = pd.DataFrame(design, columns=["A", "B", "C"])
df = df.astype(int)
# Randomize run order
df = df.sample(frac=1, random_state=42).reset_index(drop=True)
df["run_order"] = df.index + 12. Central composite design (response surface)
from pyDOE2 import ccdesign
import numpy as np
# 3 factors, face-centered (alpha=1) for a bounded region
coded = ccdesign(3, face="ccf")
# Decode to natural units: x in [-1, 1] -> [low, high]
bounds = {"T": (60, 100), "pH": (5, 7), "conc": (10, 50)}
natural = np.zeros_like(coded)
for j, (lo, hi) in enumerate(bounds.values()):
natural[:, j] = lo + (coded[:, j] + 1) * 0.5 * (hi - lo)3. Power analysis with statsmodels
from statsmodels.stats.power import TTestIndPower, FTestAnovaPower
# Sample size for two-sample t-test, d=0.5, alpha=0.05, power=0.8
analysis = TTestIndPower()
n = analysis.solve_power(effect_size=0.5, alpha=0.05, power=0.80)
print(f"n per group: {n:.1f}") # ~64
# Power of a one-way ANOVA with k=4 groups, n=20/group, f=0.25
p = FTestAnovaPower().solve_power(effect_size=0.25, nobs=20, alpha=0.05,
k_groups=4)
print(f"ANOVA power: {p:.2f}")4. Analyze a factorial with OLS
import pandas as pd
import statsmodels.formula.api as smf
import statsmodels.api as sm
# df has columns: A, B, y (numeric, A/B coded -1/+1)
df = pd.DataFrame({
"A": [-1, -1, 1, 1] * 4,
"B": [-1, 1, -1, 1] * 4,
"y": [10, 14, 18, 22, 9, 13, 19, 23, 11, 15, 17, 21, 10, 14, 18, 22],
})
model = smf.ols("y ~ A * B", data=df).fit()
print(model.summary())5. Bayesian optimization with BoTorch
import torch
from botorch.models import SingleTaskGP
from botorch.fit import fit_gpytorch_model
from botorch.acquisition import ExpectedImprovement
from botorch.optim import optimize_acqf
from gpytorch.mlls import ExactMarginalLogLikelihood
from botorch.utils.transforms import normalize, unnormalize
bounds = torch.tensor([[0.0], [10.0]], dtype=torch.double)
# Pretend we have 5 evaluations
train_X = torch.linspace(0, 10, 5, dtype=torch.double).unsqueeze(-1)
train_Y = -((train_X - 4) ** 2) # maximize the negative (i.e. minimize x-4)^2
gp = SingleTaskGP(normalize(train_X, bounds), train_Y)
mll = ExactMarginalLogLikelihood(gp.likelihood, gp)
fit_gpytorch_model(mll)
EI = ExpectedImprovement(gp, best_f=train_Y.max(), maximize=True)
candidate, _ = optimize_acqf(EI, bounds=bounds, q=1, num_restarts=5, raw_samples=20)
next_x = unnormalize(candidate, bounds)
print(f"Next trial at x = {next_x.item():.2f}")Best practices
- Pre-register the design and analysis plan before collecting any data.
- Always randomize run order; never run in standard order (leaves time drift confounded with factor effects).
- Block on known nuisance variables (operator, day, plate).
- Use coded units (-1, +1) for analysis; decode to natural units only for the final report.
- Size for the smallest effect you care about, not the effect you hope for.
- Match the analysis model to the design (e.g. random effects for blocks).
- Prefer center points over 3-level factors to test curvature cheaply.
- For sequential designs, decay exploration over time (EI -> PI).
- Report effects with 95% CIs, never only p-values.
- Use power simulations (Monte Carlo) when closed-form power is unavailable.
Common pitfalls
- Using
fullfactin standard order withoutsample(frac=1)leaves time drift confounded with factors; reviewers will reject. - Sample-size calculations with effect_size picked post-hoc ("the effect we saw") inflates false positives.
- Forgetting to center and scale continuous factors makes main effects uninterpretable and breaks interaction terms.
- Treating a Box-Behnken design as a factorial; it has no corner points and cannot detect pure quadratic effects well.
- Bayesian optimization with too few initial points and high noise gives the GP pathological uncertainty; use 2-3 per dimension minimum.
- Confounding in fractional designs (e.g. resolution III for two-factor interactions) is silently set by the alias structure; check the design generators before analyzing.
- Pooling center points into the model breaks the curvature estimate; keep them separate.
- Power analysis in Python defaults differ across libraries (effect_size convention f vs d); double-check definitions.
Worked example
Design a 2^3 full factorial with 3 center points per condition, run in randomized order, analyze with OLS, and detect curvature.
import numpy as np, pandas as pd
import statsmodels.formula.api as smf
from pyDOE2 import fullfact
rng = np.random.default_rng(20240601)
# 2^3 factorial in coded units
coded = fullfact([2, 2, 2]).astype(int)
coded = pd.DataFrame(coded, columns=["A", "B", "C"]) * 2 - 1 # -> {-1, +1}
# Add 3 center points
center = pd.DataFrame(np.zeros((3, 3)), columns=coded.columns)
df = pd.concat([coded, center], ignore_index=True)
df["y"] = (10 + 2 * df["A"] + 3 * df["B"] + 1.5 * df["A"] * df["B"]
+ 1.5 * (df["A"] ** 2) # curvature
+ rng.normal(0, 0.5, size=len(df)))
df = df.sample(frac=1, random_state=20240601).reset_index(drop=True)
df["run_order"] = df.index + 1
# Quadratic model captures curvature
df["A2"] = df["A"] ** 2
df["B2"] = df["B"] ** 2
model = smf.ols("y ~ A + B + C + A:B + A2 + B2", data=df).fit()
print(model.summary())Tools & libraries
| Tool | Purpose | Install |
| numpy | Numeric core | pip install numpy |
| pandas | Design tables | pip install pandas |
| scipy | Distributions and tests | pip install scipy |
| statsmodels | Power, OLS, mixed models | pip install statsmodels |
| pyDOE2 | Factorial, CCD, Box-Behnken | pip install pyDOE2 |
| dexpy | Living-stat DOE library | pip install dexpy |
| botorch | Bayesian optimization | pip install botorch |
| gpytorch | Gaussian processes | pip install gpytorch |
| matplotlib | Diagnostic plots | pip install matplotlib |
| pyDOE (legacy) | Original pyDOE | pip install pyDOE |
| Formulaic | alt formula API | pip install formulaic |
References
- statsmodels power module: https://www.statsmodels.org/stable/stats.html#power
- pyDOE2 docs: https://github.com/clicumu/pyDOE2
- dexpy: https://github.com/statease/dexpy
- BoTorch tutorial: https://botorch.org/tutorials/
- NIST Engineering Statistics Handbook (DOE): https://itl.nist.gov/div898/handbook/pri/section2/pri2.htm
- Box-Hunter-Hunter (classical DOE): https://onlinelibrary.wiley.com/doi/book/10.1002/9781118628361
- Myrvold Bayesian opt: https://botorch.org/docs/
- Pre-registration template (OSF): https://www.cos.io/initiatives/registered-reports
Ethics & safety
- Pre-registration: commit to the design and analysis before data collection; this prevents garden-of-forking-paths inflation.
- Multiplicity: report all tests run, correct for multiple comparisons, and avoid "as-if-randomized" language unless the design was randomized.
- Equity: power for subgroups, not just the average, when treatment effects are expected to differ.
- Animal / human subjects: obtain IRB/IACUC approval; only test within approved factor ranges.
- Reproducibility: publish the design matrix, model, and seed alongside the results; reviewers must be able to rerun the analysis.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

