Today's fun GPT+Econ exercise: asking it to develop example code for structural estimation from a description + latex equations. The goal was to get it to give me a function that could estimate an approximate mixed-logit model. Step 1: ask GPT-4 how best to structure my prompt
Step 2: Ask for a verbal algorithm. I wrote this quickly, just directly copying three equations from my JMP, and left in a subscripting typo (the "t" subscript in e_{t} isn't defined)
First-try result seems pretty good (more after screenshot cuts off)! It made some reasonable decisions that I wasn't clear about, so I had to iterate a couple of times about order of operations and things. Then (Step 3) I asked it to convert the algorithm to code
The code also had a couple of minor bugs (hallucinated an IV regression package in python) but only took 2 minutes to fix and it got it right on the next try. Also constructed e_t in Step 3 correctly even though my subscript was wrong!

Mar 25, 2023 · 7:22 PM UTC

I'm sure these screenshots aren't super informative. Main point-- once we get access to web search and python eval plug-ins, I think a little bit of better prompting would be able to generate a smooth pipeline from an "Estimation" section in a paper into passable initial code.
I've said before that IO should try to be closer to "reg y x,r" . You can have copilot clean up your ugly code into a simple package, or have GPT-X write the functions from scratch. Either way, cost of generating complicated+clean econ code should drop
Replying to @jamesbrandecon
even has data checking !!