experimental-design
它能做什么
这个工具帮助你规划科学实验或研究。它会决定如何把参与者或样本分配到不同组别,如何引入随机性,以及如何对相似的单位进行分组,以确保结果清晰可靠。
适用场景
- ✓规划研究、决定如何划分参与者时。
- ✓希望确保结果可靠、避免常见错误时。
- ✓需要制定计划来测试不同条件或疗法时。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/experimental-design/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我想比较两种药物。应该如何把 100 名患者分成两组,才能确保比较是公平的?”
每周 5 个新技能,1 分钟读完。
工作原理
该工具运用一些基本原则,例如用随机化避免偏倚,用重复来估计变异性,用区组化控制可能影响结果的因素。它可以帮你在收集数据之前选出最佳方案。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Experimental Design
Overview
The design of a study — how units are assigned to conditions, what is held constant, what is varied, and in what structure — determines what questions the data can answer. No analysis can rescue a confounded or pseudoreplicated design after the fact. This skill is about the decisions made before data collection: picking a design that isolates the effect of interest, randomizing to license causal claims, blocking to remove known nuisance variation, and structuring multi-factor experiments so effects are estimable rather than tangled together.
The three ideas behind almost every good design (Fisher's principles):
- Randomization — assign treatments at random so that confounders, known and unknown, are balanced in expectation. This is what turns a comparison into a causal claim.
- Replication — independent repetition at the right level, so you can estimate variability and your effects aren't artifacts of a single unit. The most common fatal error is pseudoreplication: counting repeated measurements on the same unit as independent replicates.
- Blocking / local control — group similar units (by batch, day, site, litter) and randomize within blocks, removing that nuisance variation from the error term instead of letting it inflate noise.
This skill helps you choose among design types, generate the actual randomization or DOE layout (with reproducible scripts), and avoid the structural mistakes that make data uninterpretable.
When to Use This Skill
- Planning any comparative experiment or trial and deciding how to assign units
- Randomizing subjects/samples to arms (simple, blocked, stratified, or cluster)
- Removing nuisance variation by blocking or stratification
- Designing multi-factor experiments: full or fractional factorial, screening designs
- Optimizing a response over continuous factors (response-surface designs)
- Within-subject / repeated-measures, crossover, split-plot, or Latin-square designs
- Cluster- or group-randomized designs (sites, clinics, classrooms, litters)
- Deciding the number and level of replicates and avoiding pseudoreplication
- Sequential, group-sequential, or adaptive designs with interim analyses
- Laying out plates/batches and randomizing run order to defeat drift
Installation
uv venv --python 3.13 .venv-design
uv pip install --python .venv-design/bin/python "numpy==2.5.3" "pandas==3.0.6" "pydoe==1.5.0"
pyDOE3 was archived in May 2026; active
development returned to pydoe. The bundled
wrappers target pydoe==1.5.0, imported as lowercase pydoe, and return
designs in real factor units. All seven DOE wrappers and both script demos were
executed with Python 3.13, NumPy 2.5.3, pandas 3.0.6, and SciPy 1.18.1. On
Windows, the environment interpreter is .venv-design/Scripts/python.exe.
Archive the environment versions and exported schedules: a seed alone does not
promise identical output across package or script upgrades.
Choosing a design
Start from the question and the structure of your units, not from a favorite design.
What are you trying to learn?
│
├─ Compare a few predefined conditions (A vs B vs C)?
│ ├─ Units independent, possibly with a known nuisance factor (day, batch, site)?
│ │ → Completely randomized (no nuisance) or RANDOMIZED BLOCK design.
│ ├─ Each unit can receive every condition in sequence (washout possible)?
│ │ → CROSSOVER / repeated-measures design (watch carry-over and correlation).
│ └─ You can only randomize groups, not individuals (schools, clinics)?
│ → CLUSTER-randomized design (account for clustering; see pseudoreplication).
│
├─ Screen MANY factors (5+) to find the few that matter?
│ → FRACTIONAL FACTORIAL or PLACKETT-BURMAN screening design.
│
├─ Quantify main effects AND interactions among a handful of factors?
│ → FULL 2^k FACTORIAL design.
│
├─ Find the settings that OPTIMIZE a response (curvature matters)?
│ → RESPONSE-SURFACE design: central composite or Box-Behnken.
│
└─ Explore a simulation/computer model over a continuous space?
→ SPACE-FILLING design: Latin hypercube.
Detailed guidance per branch:
- Randomization, blocking, stratification, controls →
references/randomization_and_blocking.md - Factorial, fractional-factorial, screening, response-surface, DOE concepts (aliasing, resolution) →
references/factorial_and_doe.md
…
常见问题
实验中的随机化是什么?
随机化是随机分配处理或分组的做法,就像掷硬币一样,使未知因素不会影响结果,从而能够得出关于因果关系的结论。
什么是重复,为什么它很重要?
重复是指在独立的单位上重复进行实验或测量。这对于估计数据中的自然变异性、确保观察到的效应不是偶然出现的,至关重要。
什么是区组化?
区组化是把相似的单位(例如来自同一家医院的患者,或来自同一批次的样本)分成一组,然后在组内进行随机分配。这有助于从最终结果中消除这些组别带来的无关变异,使主要效应更加清晰。
详情
作者的原始描述
Designs experiments and studies BEFORE data is collected — choosing a design, randomizing, blocking, and laying out treatment combinations so results are interpretable. Use whenever someone is planning a study, asks how to assign subjects/samples to groups, mentions randomization, blocking, stratification, controls, factorial or fractional-factorial designs, design of experiments (DOE), screening
热度
- GitHub 星标
- 51k
- 排名
- #3458
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …