Doing a statistical test using Claude¶
I had a small CSV with data of four groups of mice with tumours — two controls of different kinds, two treatments — and the day each mouse died. Fifteen numbers in a semicolon-delimited file, cancer_treatment.csv. Survival curves are plotted below.

I did not begin by specifying an analysis. I asked Claude to read the CSV and show me what it contained. It loaded the file, read it in, and interpreted the data — noting the group sizes, death times, and that this was typical survival data. Then it offered multiple analyses it could run. It suggested Kaplan–Meier curves with a log-rank test, which is correct. But I also had to restrain its "enthusiasm": don't pool the controls; explain that I want Treatment 1 compared with Treatment 2 as well as each against control; and ask it to re-run the analysis to account for an end of the experiment on 50 days. Five pairwise comparisons means a family-wise error rate of about 23% at α = 0.05, so a Bonferroni correction to α = 0.01. Four of the five comparisons are significant:
| Comparison | raw p | significant at α = 0.01 |
|---|---|---|
| Treatment 1 vs Control 1 | 0.0059 | yes |
| Treatment 1 vs Control 2 | 0.0004 | yes |
| Treatment 2 vs Control 1 | 0.5744 | no |
| Treatment 2 vs Control 2 | 0.0062 | yes |
| Treatment 1 vs Treatment 2 | 0.0013 | yes |
You can see the code it produced at survival_analysis.py.
Then I asked for the figure redrawn for a leading cancer journal. The first draft had a risk-table underneath, the p-value box on top of the curves, and half the panel empty because the x-axis ran to a round number. I gave three instructions in one message: drop the table, move the box to bottom left, fix the whitespace. Back came an 88 mm single-column figure at 7 pt Arial with the axis trimmed to the study window. Each round trip took under a minute, because Claude was rendering the PNG and looking at it, not describing what it imagined. Then I asked for a box round the legend, and it did that too.

Also see¶
- 4 A Skill as an example of context — how the figure styling gets kept.
- 2 Difference between Generative AI and Agentic AI
Attachments/— the data, the scripts and the figures.