$npx -y skills add K-Dense-AI/scientific-agent-skills --skill experimental-designDesign experiments and studies BEFORE data is collected — choosing a design, randomizing, blocking, and laying out treatment combinations so the results will actually be interpretable. Use whenever someone is planning a study, asks how to assign subjects/samples to groups, mentio
| 1 | # Experimental Design |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | 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. |
| 6 | |
| 7 | The three ideas behind almost every good design (Fisher's principles): |
| 8 | - **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. |
| 9 | - **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. |
| 10 | - **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. |
| 11 | |
| 12 | 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. |
| 13 | |
| 14 | ## When to Use This Skill |
| 15 | |
| 16 | - Planning any comparative experiment or trial and deciding how to assign units |
| 17 | - Randomizing subjects/samples to arms (simple, blocked, stratified, or cluster) |
| 18 | - Removing nuisance variation by blocking or stratification |
| 19 | - Designing multi-factor experiments: full or fractional factorial, screening designs |
| 20 | - Optimizing a response over continuous factors (response-surface designs) |
| 21 | - Within-subject / repeated-measures, crossover, split-plot, or Latin-square designs |
| 22 | - Cluster- or group-randomized designs (sites, clinics, classrooms, litters) |
| 23 | - Deciding the number and level of replicates and avoiding pseudoreplication |
| 24 | - Sequential, group-sequential, or adaptive designs with interim analyses |
| 25 | - Laying out plates/batches and randomizing run order to defeat drift |
| 26 | |
| 27 | ## Installation |
| 28 | |
| 29 | ```bash |
| 30 | uv pip install "numpy>=1.26" "pandas>=2.0" pyDOE3 |
| 31 | ``` |
| 32 | |
| 33 | `pyDOE3` is the maintained successor to pyDOE/pyDOE2 and supplies factorial, |
| 34 | fractional-factorial, Plackett-Burman, central-composite, Box-Behnken, and |
| 35 | Latin-hypercube generators. The bundled scripts wrap it to return designs in real |
| 36 | factor units with named columns and randomized run order. |
| 37 | |
| 38 | --- |
| 39 | |
| 40 | ## Choosing a design |
| 41 | |
| 42 | Start from the question and the structure of your units, not from a favorite design. |
| 43 | |
| 44 | ``` |
| 45 | What are you trying to learn? |
| 46 | │ |
| 47 | ├─ Compare a few predefined conditions (A vs B vs C)? |
| 48 | │ ├─ Units independent, possibly with a known nuisance factor (day, batch, site)? |
| 49 | │ │ → Completely randomized (no nuisance) or RANDOMIZED BLOCK design. |
| 50 | │ ├─ Each unit can receive every condition in sequence (washout possible)? |
| 51 | │ │ → CROSSOVER / repeated-measures design (more power, watch carry-over). |
| 52 | │ └─ You can only randomize groups, not individuals (schools, clinics)? |
| 53 | │ → CLUSTER-randomized design (analyze at the cluster level; see pseudoreplication). |
| 54 | │ |
| 55 | ├─ Screen MANY factors (5+) to find the few that matter? |
| 56 | │ → FRACTIONAL FACTORIAL or PLACKETT-BURMAN screening design. |
| 57 | │ |
| 58 | ├─ Quantify main effects AND interactions among a handful of factors? |
| 59 | │ → FULL 2^k FACTORIAL design. |
| 60 | │ |
| 61 | ├─ Find the settings that OPTIMIZE a response (curvature matters)? |
| 62 | │ → RESPONSE- |