Programming languages in economics: Cool research, bro, but what about, er, economics?
Let's just call it a runtime error
Worstall on Wednesday Ignoring the central insight and purpose of economics seems odd in an economics paper.
You peeps here at El Reg are most unlikely to be regular readers of papers published by US body NBER, the National Bureau for Economic Research. So I've brought you one we can all puzzle over together (PDF here), "A Comparison of Programming Languages in Economics".
The intention of the researchers was to try to work out which was the best programming language to use in trying to run one of the standard econometric models (those crazed models of how macroeconomists think the real world works).
They code the same model, the same algorithms (without changing them at all even for the known differences with which different languages can handle them) and then time the runs in C++, Python, Fortran, Mathematica, MatLab and so on. They find very different run times, some languages taking hundreds of times longer than others. For those interested in the details, please do read the full paper: I don't understand the details just as I don't the econometric model they're running.
However, I am very interested in an observation made by a mate of mine, Tim Almond (coder for hire if anyone is looking). Despite this being an economics paper, about an economic model, they appear to avoid addressing the "economics" part of what they're looking at. The researchers are solely looking at the runtime of the model, nothing else.
That should get a good laugh from you lot just as it does from me, even though it's for very different reasons. The programmers among you will know instinctively that you don't choose a language just for its runtime. What you'd want to know is what the total time from blank piece of paper to the answer would be.
Some languages (for reasons other than just familiarity) are going to be much easier for tasks like setting up the model run than others will be. Mathematica, or MatLab, just as examples, might be a great deal faster for set-up than if you were to have to rummage around in Fortran or C++. Certainly this writer assumes that they are because that's how they're designed. Higher level languages are easier to set up at the price of slower runtimes.
Looking at this from an economist's point of view, it is akin to insisting we should be economising on the scarce resource (that is what economics is about, after all – the allocation of scarce resources). Perhaps it's true that processor time is the "scarce resource" and thus runtimes are the important limiting factor. But I have to admit that I rather doubt it in the case of a simple macroeconomic model (now, the one the Treasury runs, maybe, but not a simple test model). What is rather more likely is that the "scarce resource" is an economist capable of decent coding in a lower-level language. Or even the time required to do the coding. After all, the runtime can be overnight if needed.
As the paper's authors say:
Our focus on speed should not be taken as the only important metric for language comparison. Other issues (ease of programming, existence of auxiliary tools, vibrant com- munities of fellow programmers) should be considered as well.
Err, yes, yes, that's where all the economics of it is.
Sponsored: Transform Your IT Infrastructure