AI Agents and Prompt Engineering in Econometric Coding
Sebastian Galiani,
Federico Ariel López and
Raul A. Sosa
No 35588, NBER Working Papers from National Bureau of Economic Research, Inc
Abstract:
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
JEL-codes: C18 C87 (search for similar items in EconPapers)
Date: 2026-08
New Economics Papers: this item is included in nep-ain and nep-cmp
Note: DEV
References: Add references at CitEc
Citations:
Downloads: (external link)
http://www.nber.org/papers/w35588.pdf (application/pdf)
Access to the full text is generally limited to series subscribers, however if the top level domain of the client browser is in a developing country or transition economy free access is provided. More information about subscriptions and free access is available at http://www.nber.org/wwphelp.html. Free access is also available to older working papers.
Related works:
This item may be available elsewhere in EconPapers: Search for items with the same title.
Export reference: BibTeX
RIS (EndNote, ProCite, RefMan)
HTML/Text
Persistent link: https://EconPapers.repec.org/RePEc:nbr:nberwo:35588
Ordering information: This working paper can be ordered from
http://www.nber.org/papers/w35588
The price is Paper copy available by mail.
Access Statistics for this paper
More papers in NBER Working Papers from National Bureau of Economic Research, Inc National Bureau of Economic Research, 1050 Massachusetts Avenue Cambridge, MA 02138, U.S.A.. Contact information at EDIRC.
Bibliographic data for series maintained by ().