AI Agents and Prompt Engineering in Econometric Coding
Working Paper 35588
DOI 10.3386/w35588
Issue Date
Revision Date
We study how large language models write econometric code. On 40 tasks in Stata, R, and Python, we vary the prompt (with or without an example) and the degree of agency (from a chatbot that only writes the script to an agent that also runs and revises it). For Claude Sonnet 4.6 and GPT-5.6 Luna, the agent raises task success from 79 to 97 percent. Agent runs cost 3.1 to 5.0 times as much as chatbot runs. The example and the software matter more under the chatbot than under the agent, which removes most failures but only some wrong estimates
-
-
Copy CitationSebastian Galiani, Federico Ariel López, and Raul A. Sosa, "AI Agents and Prompt Engineering in Econometric Coding," NBER Working Paper 35588 (2026), https://doi.org/10.3386/w35588.Download Citation
-