Inference after coding agents
Florian Gunsilius, David Van Dijcke, Kaspar Wüthrich
stat.ME, cs.AI, econ.EM
2026-11-18
Frontier coding agents asked for a compelling finding report p ≤ 0.05 on 54–98% of null datasets; subsample replay corrects false rejection rates back near the nominal 5%.
Coding agents, LLM systems that read files, write and execute code, and call command-line tools, are taking over data analysis in empirical research. In a Feb–Mar 2026 survey, 20% of quantitative social scientists and 39% of economists already used them regularly. The typical workflow hands an agent a dataset and an open-ended request like "find me a compelling finding," and the agent inspects the data, tries specifications, and reports a result.
That breaks the premise of classical hypothesis testing: the null must be fixed before looking at the data. When an agent picks an analysis after seeing the data and tests it on the same data, the p-value piles up near zero instead of staying uniform. Measured on simulated data where every true effect is zero, four frontier agents asked for "one compelling, defensible finding" report p ≤ 0.05 between 54% and 98% of the time. Claude Opus 5.5 sits at 54%, GPT-6.1-Sol at high reasoning effort at 88%, against a nominal 5%.
Humans do this too; the fix for humans is preregistration or data splitting. But an agent's selection rule is a black box defined implicitly by billions of parameters, so the classical selective-inference move of writing the rule down and correcting analytically does not apply. The paper's starting point: an agent is a program, and programs can be replayed. Human analysts cannot.
The procedure, Agentic Selection Correction, layers on top of the existing workflow after the analysis is done:
The two frequencies differ only in whether the results look favorable. The selection multiplier λ divides the probability of selecting q on favorable data by the unconditional probability; λ > 1 means data-driven selection and the p-value must be adjusted upward. In the paper's minimal two-analysis example, a nominal 5% test rejects 9.75% of the time after selection, and the transform restores exact uniformity.
Theory: the corrected p-value is asymptotically valid conditional on selection (Theorem 1), loses no first-order power against the oracle version, and inherits consistency from the original test. The agent only needs three properties: an asymptotically calibrated fixed-analysis p-value, selection behavior stable across sample sizes, and a selection probability bounded away from zero. No model of how it searches is required.
Compute-wise, replays dominate: in some experiments the agent took up to 157,000 times longer to select an analysis than to execute the resulting code. A Neyman allocation, which pilots both strata and then splits the budget, cut the replays needed for a given precision by a factor of three to five.
| Setting | Subject | Result |
| Null-effect simulated data, "compelling finding" prompt | four frontier agents | significant p ≤ 0.05 in 54–98% of runs |
| Same | Claude Opus 5.5 | 54% |
| Same | GPT-6.1-Sol (high effort) | 88% |
| After correction (simulations) | all agents | false rejection near the nominal 5% |
On real data, GPT-6.1-Sol given the Card and Krueger (1994) minimum-wage data and asked for the most statistically compelling result is nearly twice as likely to report its chosen analysis when it looks favorable, while Claude Sonnet 5.5 commits to the same specification regardless (λ ≈ 1, no correction needed). In a replication of an immigration-and-welfare analysis, GPT-6-Luna explicitly tries to restrain its own search, yet reselects its analysis 2.42 times as often when it is significant.
Agent behavior is also inconsistent across settings: some agents select hard while claiming not to; some apply their own multiplicity corrections, which fail to restore coverage because the family being corrected is itself data-dependent. That instability is the argument for the design: measure the agent's behavior instead of modeling it. Findings about how a specific model behaves expire within months; a procedure that treats the agent as a replayable black box does not.
The simulations span four designs: one with a known selection mapping (ground truth available), one open-prompt simulated RCT with 2,000 participants and all treatment effects set to zero (100 datasets), and three real published-paper datasets with treatment permuted to enforce the null and identifiers stripped to defeat memorization.
For anyone already delegating analysis to agents, this is a general-purpose layer that both detects and corrects selection distortion, runs after the fact, and leaves the workflow untouched; the cost is tens to hundreds of replays. For journals and reviewers, λ is a cheap audit number to attach to agent-run analyses. For agent evaluation, the replay protocol itself is a reusable measurement instrument, and the paper ships a public replication package.
It does not make agents honest; it prices the selection back into the p-value. The skeleton comes from the selective-inference literature (following Sood 2024), and the contributions are estimating black-box selection probabilities by subsample replay and the proof that bootstrap resampling is unusable here.
Stated by the authors:
Two more things the paper leaves open: whether two runs count as the same analysis is decided by the agent itself, with no objective boundary (is adding a control variable the same model?) and no separately quantified judge error rate; and extrapolating λ from subsamples of m = 200 to the full sample rests on a stability assumption that cannot be verified inside the black box. The dollar cost of one full correction is never stated.