Object-oriented thinking in economics

I have been meddling with the programming language Python for some years now in order to become self-sufficient in programming simulations. In doing so, I learned the basics of object-oriented computer programming (OOP for short).

OOP is a style of writing computer programs, with some languages, such as Java, heavily supporting it (Java enforces it, in fact) and other languages, such as Python, supporting it strongly. Coming to OOP from economics was conceptually easy. Now I am thinking that OOP has something to tell us regarding how we teach economics or how we present it to the wider world. This post is my first written rumination on this topic.

First, let me define an object in the OOP sense. I need to give you some background first. I expect you are aware, even if you never wrote any computer code, that such code is a string of data, ultimately encoded in binary notation, that tells the computer to do certain things with part of this data. To take a simple example, if you want the computer to choose randomly between the names of participants in a lottery, you have to include the names in your program (data) and write commands that result in one of these names being chosen randomly and this choice being communicated to the user. This little program has data (it “knows” some things) and it has ways of acting on these data (it “knows” what to do with the things it knows).

In any reasonably complicated programming problem, it helps us as programmers to compartmentalize the code. We make a chunk of code to perform task A, another to perform task B, and so on, and finally we write code to coordinate these chunks as they go along merrily doing their thing. Each one of these code chunks has some data it knows and some things it can do with the data it knows. (Computer scientists, I know I am simplifying. I only want to convey the basics of OOP here.) An object in OOP language is a chunk of code that has some data and some things it can do (usually called “methods”, but you can think of them as commands specific to this chunk). The programming language in which you are specifying these objects provides ways for objects to communicate with each other, passing data around, and to ask each other to perform one of its methods (execute one of the commands it has).

How is this relevant to economics? You are probably already chomping at the bit to answer, but here is my take. When we set up any model in economics, at least if our model is “microfounded” as we say, we have some agents who know certain things and do certain things. Suppose, for example, that you want to make a computer model of an exchange economy. You need a number of individuals, each with an endowment and a preference relation over the commodity space. These individuals need to be able to perceive prices, decide which net trades are feasible given a particular price vector, and, finally, they need to be able to propose and execute trades with each other. (OK, maybe you wanted a Walrasian auctioneer thrown in as well? I leave it as an exercise then to determine what data and which methods the auctioneer object in the code will need.)

I cannot think of a mainstream economics model that cannot be conceptualized in these terms. Indeed, computational economics has flourished in the last several years and you can find plenty of examples of what I am talking about by visiting, for example, the amazingly comprehensive website that Leigh Tesfatsion has set up. (This kind of “microfounded” computational economics goes by the name agent-based computational economics.)

So why don’t we teach our students using the concept that each economic agent in our models is an object (in the OOP sense) that interacts with others based on rules set up by the institutional infrastructure of the economy and physical feasibility conditions?

I can think of two answers right now, one deeper than the other. I will examine each one and argue that they do not convince me, starting with the shallower one.

The shallow answer is that our students will find it hard to understand the OOP language of objects and their interactions. I am much more likely to agree that our students in introductory courses will not understand supply and demand graphs or the simple linear equations we try to use to overcome their math anxieties. But almost all students in introductory courses will have played computer games. For them, all you have to do to introduce OOP objects is to refer to an avatar in an online role-playing game or a tile in Tetris. Stepping from these examples to explaining economic objects in code does not in fact impose the need for a computer language at all. You can use pseudo-code and the ideas stand; any time your students feel shaky, just bring in another computer-game inspired example.

The deeper answer is that while encapsulating an individual in an exchange economy in the language of OOP objects is easy, if we start thinking in the algorithmic terms this mental shift suggests, things like arriving at a Walrasian equilibrium become hard problems. There might even be a student in your class who knows enough computer science and will tell you to your face that our cavalier approach of taking shortcuts like calculating an equilibrium with Lagrange multiplier techniques and setting supply equal to demand is a rotten approach, as it hides the remarkably difficult problem of arriving at an equilibrium.

So how can I deal with this answer? My point is that we should adopt the OOP viewpoint precisely so as to force our students or readers to confront the fact that reaching an equilibrium in an economic model is much trickier a proposition than the typical paper in Econometrica or JET lets on. As economists, we have internalized the mental shortcuts that make us jump to equilibria in fairly complicated models and then analyze the properties of these equilibria. But there is much to be learned by confronting the need to specify exactly how economic agents interact in time, each with its own data an abilities to perform actions such as buying and selling, manage to get to an equilibrium (if they do). Do we really want a Walrasian auctioneer who gropes around in price space to find an equilibrium? What if the economy happens not to have a stable equilibrium (the question can arise whether we are looking at a market model or any other kind of agent-based model). These are not idle concerns; they show clearly some of the limitations of economic theorizing and to ignore them is intellectual arrogance at best, dishonesty at worst.

There is one final point in my mind about this, which I will leave to be developed in a future post. Thinking in terms of institutional infrastructure can be considered the overall code of our economic computer program. This can encompass the ways information gets passed around from agent to agent as the economy operates as well as the outcome function that determines what allocations occur and when as the agents take various actions. The more precise we are in specifying these the better, just as much as the more careful we are to specify computable ways to reach an equilibrium (see the previous paragraph) the better. As this post already exceeds 1250 words, however, this final point will have to be explored later.

Duncan Foley criticizes Walrasian equilibrium theory

Duncan Foley is an astute critic of Walrasian general equilibrium theory in economics. He knows the theory deeply, having made seminal contributions as early as 1970 to its extension to incorporate public goods and to the limits of using Walrasian equilibrium prices, in the presence of transaction costs, to reflect the present value of future commodities. In a recent paper in the Journal of Economic Behavior and Organization (What’s wrong with the fundamental existence and welfare theorems? volume 75, 2010, 115-131), he makes a strong attack on the reverence with which economists hold Walrasian theory.

I agree with Foley’s criticisms but they do not imply that we should abandon Walrasian equilibrium altogether. Let me discuss the criticisms and my reaction.

At the heart of the matter is the assumption that all trades happen at equilibrium prices. For this to happen, we have to imagine that every trader somehow anticipates which equilibrium will occur (it is not too hard to write down a model economy with many Walrasian equilibria) and treats all transactions that are predicated on different prices as tentative.

This is similar to the logic of Nash equilibrium; Foley does not bring in this connection, but I want to do so. Here’s how the story goes for Nash equilibrium. In a normal form game, each player is supposed to guess which of (the, again, potentially many, depending on the game) Nash equilibria will occur and then chooses a strategy that is a best response to the strategies the other players would play at this Nash equilibrium. Relaxing this rather extreme coordination assumption on the beliefs of players about the strategies of the other players is possible; it has been done in developing the theory of rationalizable strategies. The trade-off is that rationalizability has gained a more reasonable assumption on beliefs but has lost predictive acuity; it is easy to find games in which all strategies are rationalizable, so the theory makes no useful prediction.

Foley proposes an equilibrium concept he calls exchange equilibrium. This notion envisions people making mutually advantageous trades at disequilibrium prices; these prices then converge to a small set, in terms of size, but still a continuum set. Which exact equilibrium is reached in this set depends on the time path of transactions. Foley suggests that this is the correct equilibrium notion for a competitive marketplace, but it implies that preferences, endowments, and technology are not, taken together, enough information to pin down the equilibrium. Furthermore, in an exchange equilibrium agents with the same preferences need not be treated equally, unlike the situation in Walrasian equilibrium. Foley shows that, under general assumptions on an exchange economy, the set of exchange equilibria is non-empty and also that it has a stability property. His main conclusion is that Walrasian equilibrium has blinded economists from the aforementioned realization that the triumvirate of “preferences, endowments, technology” is just not enough to pin down an equilibrium. This is worth repeating, as economists, especially theorists, too often take the view that the triumvirate explains well enough what needs explaining in terms of economic exchange.

I suspect that Walrasian equilibrium can still serve as an approximation of the exchange equilibrium set. To the extent it is easier to compute Walrasian equilibria, this is useful. But I find Foley’s critique compelling, and wish that theorists will examine the properties of exchange equilibrium more intensively, extend the concept to production economies, and think about was of incorporating uncertainty without ending up with an equilibrium notion that yields a huge set of predictions or relies hugely on the time path of transactions. My hunch is that the time path of transactions is not powerful enough to completely obliterate the equilibrating tendency in markets; in Foley’s exchange equilibrium it does no such thing, but I can imagine a very weak predictive performance in domains with production and uncertainty. Still, exchange equilibrium is worth taking very seriously, and we should be teaching this paper of Foley’s to our graduate students.

I would love to see Foley move on to the multiplicity of equilibria problem in game theory, but I will not hold my breath for it to happen.

More praise for Peter Diamond

Oh, and a very sensible take on the use of mathematics in economics, from Mark Thoma:

It is really hard to convince new graduate students that mathematics without the underlying economic intuition, i.e. technique for the sake of technique, is pretty useless. It’s the economics that are important — mathematics is simply a tool that allows us to better understand the economic content of the models we work with — the math itself is not the point of the exercise. In fact, the best models are the ones that are boiled down to the essentials so that they isolate important phenomena in a way that makes them transparent. Mathematical complexity is not always the best way to reach this goal. Models should be as complex as needed to highlight the essential issues, to use Krugman’s term they should be “elegant,” and additional complexity beyond that point detracts from their elegance and obscures rather than clarifies the central features of the model. Sometimes a high degree of complexity is required, but not always.

This quotation comes from this post, which is definitely worth reading in its entirety as it also quotes at length some very a propos praise of Peter Diamond that puts the above quotation in good context.

Bank of Sweden Prize in economics in memory of Alfred Nobel 2010

The prize went to Peter Diamond, Dale Mortensen, and Christopher Pissarides for their work on search in markets, that is, markets where sellers and buyers don’t automatically get to meet each other and so waiting for a better price might be the optimal thing to do, which prevents perfect market clearing from ever occurring. Obvious application: the labor market, especially in times of high unemployment, such as now. Political overtones: Peter Diamond was blocked from being appointed to the Fed by the Senate, where concerns were raised about his competence. Hah!

Rather than write more about this very important topic, I recognize that I cannot compete with the blogosphere. Here are some links to read more.

First, the official documents from the Nobel committee: http://static.nobelprize.org/nobel_prizes/economics/laureates/2010/press.pdf
http://static.nobelprize.org/nobel_prizes/economics/laureates/2010/ecoadv10.pdf

The Economist.com site has a nice overview article here: And the Nobel goes to…

Over at marginalrevolution.com, Tyler Cowen has a bevy of articles, rich in background and document links:
Some personal observations on the prize
Christopher A. Pissarides
A prize for unemployment
Dale T. Mortensen
Peter A. Diamond

Efficiency: A Term to Use Sparingly

Microeconomic Theory II for PhD students starts again on Tuesday here at Temple University. I intend to talk about understanding economics as a way to (i) see clearly what the objectives are (whether they come from us as economists or not), (ii) see how the aggregation of many persons’ aims is fraught with terrible difficulties (Arrow’s impossibility theorem), and (iii) introduce the idea of incentives as something that needs alignment with the aims, which alignment may be very hard to achieve in a society (Gibbard-Satterthwaite theorem). I have made my lecture notes available here (warning: terse and notation-heavy stuff, be patient in reading).

Lest this sound like an impossible paragraph, let me hasten to follow it by one in plain English. To this end, I will point first to Princeton economics professor Uwe Reinhardt’s very recent posting in the Economix blog of the New York Times. Please do read it before continuing to read this post.

In this very good piece, Professor Reinhardt points out how often the term “efficiency” is trotted out to make audiences feel that the economist speaker/writer addressing them is making an objective, scientific claim. Not so fast! Efficiency, in the technical sense of economics (“Pareto efficiency”), means that a state of affairs prevails in the economy so that there is no feasible change that will improve the welfare of at least one person while harming no one.

Think about it for a second; it sounds appealing, at first. Why not aim to extinguish the “welfare waste” that inefficient states possess?

But it is not so easy. Nobel laureate Amartya K. Sen has classic criticisms (see his Nobel lecture, page 198 and onwards, or look up his 1977 classic paper, “Rational Fools”) of efficiency. (He is not the only one, but he is quite probably the most respected scholar, among economists, who has such criticisms.) The Rational Fools paper, if memory serves me right, is the one that pointed out that the state of affairs in which Roman Emperor Nero would have been prevented from having Rome set afire as a background to his lyre playing, would entail a loss of welfare for Nero (never mind that it would improve the welfare of thousands of Roman citizens) and therefore it would not be an improvement in efficiency over the historical state of affairs, in which Nero did enjoy performing his ode while Rome burned. Pretty much every person’s sense of fairness would find this repugnant, which points out one particular, often glaring, way that economic efficiency hides a strong value judgment, that says “don’t you dare hurt anyone, no matter privileged, to help any number of people, however non-privileged or deserving”.

Worse still, economists are blithely using “efficiency” to justify all sorts of policy suggestions, and as a benchmark in countless papers. I hope this post has helped at least one consumer of writings of economists become more critical of this practice.

For a bit more about this, please check out my writing on public economic on this page.

Incentives matter and monopolies are terrible

Monopoly (or near monopoly) is always very bad for consumers. Check out this article from OSnews.com about Intel’s compiler that goes to some lengths to handicap non-Intel processors. I got more and more thankful for the free software folks (think GNU compiler) and all open source contributors as I was reading this. Yes, I am writing this on an iMac that has an Intel processor. I wish I could fight monopolies effectively on my own…

Academic textbooks and healthcare incentives compared – Boing Boing

The always interesting Boing Boing blog has a long post on the market for academic textbooks and makes explicit comparisons of the incentives in this market and in the U.S. healthcare system. I won’t quote from the article, as it is good enough for me to recommend you to read it in whole, along with the comments, several of which are good also. I will say that I am making some progress in this area, having for the first time given students several weeks’ notice about the textbooks I am going to use in the upcoming spring semester. Next year, I will try to substitute some creative commons sources for textbooks, but it will be hard, and very hard for my graduate courses.

The pundits’ dilemma

Mark Liberman says this in the Language Log today, among other good points:

Overall, the promotion of interesting stories in preference to accurate ones is always in the immediate economic self-interest of the promoter. It’s interesting stories, not accurate ones, that pump up ratings for Beck and Limbaugh.  But it’s also interesting stories that bring readers to The Huffington Post and to Maureen Dowd’s column, and it’s interesting stories that sell copies of Freakonomics and Super Freakonomics.  In this respect, Levitt and Dubner are exactly like Beck and Limbaugh.

We might call this the Pundit’s Dilemma — a game, like the Prisoner’s Dilemma, in which the player’s best move always seems to be to take the low road, and in which the aggregate welfare of the community always seems fated to fall. And this isn’t just a game for pundits. Scientists face similar choices every day, in deciding whether to over-sell their results, or for that matter to manufacture results for optimal appeal.

In the end, scientists usually over-interpret only a little, and rarely cheat, because the penalties for being caught are extreme.  As a result, in an iterated version of the game, it’s generally better to play it fairly straight.  Pundits (and regular journalists) also play an iterated version of this game — but empirical observation suggests that the penalties for many forms of bad behavior are too small and uncertain to have much effect. Certainly, the reputational effects of mere sensationalism and exaggeration seem to be negligible.

Mark Thoma says, among other things, this, in the post that brought Liberman’s post to my attention:

I’m not sure I know the answer to that, but I suspect it has something to do with increased competition among media companies for eyeballs and ears combined with an agency problem that causes information organizations to maximize something other than the output of credible information (maximizing profit may not be the same as maximizing the output of factual, useful information).

Though this type of behavior was always present in the media, it seems to have gotten much worse with the proliferation of cable channels and other media as information technology developed beyond the old fashioned antennas on roofs receiving analog signals. I don’t want to go back to the days where we had an oligopolistic structure for the provision of news (especially on network TV), competitive markets are much better, but there seems to be a divergence between what is optimal for the firm and what is socially optimal due to the agency problem.

Some people have argued that there are big externalities to good and bad reporting, and therefore that “some kind of tax credit scheme for non-entertainment news reporting might enhance societal efficiency and welfare.” That might help to change incentives, but I’m not sure it solves the fundamental agency problem. There must be reputation effects that matter to the firm, some way of making the firms pay a cost for bad pundit behavior. But that is up to the public at large, people must reward good behavior and penalize bad, it is not something the government can control. I suppose we could try something like British libel laws to partially address this, but looking at the UK press does not convince me that this solves the problem.

So I don’t know what the answer is.

I would not want to jump in and say that I know what the answer is. However, it is clear that there is a mechanism design question here. The economist’s knee-jerk reaction to this would be “if the consumers of information are more interested in being entertained than informed, then it is efficient to provide them entertainment as long as the marginal cost of entertaining each one of them meets her/his marginal willingness to pay”. As Thoma notes, it is noted that reporting has external effects. These would seem to push us in the direction of amending the rule for social optimality and looking for ways to align pundits’ incentives to what efficiency would require.

But if the majority of the audience want to be entertained and not informed, shouldn’t we economists, as children of the Enlightenment, bow to the consumers’, our multitudinous Kings’, desires? To take the idea that bad reporting carries negative externalities seriously, one has to take seriously the possibility that people express preferences for the wrong things, things that will in the long term, collectively conspire to harm them. Is this only because of the word “collectively” and so only a question of externalities, one step removed? I think that there is more “irrationality” to consumers than that. We need to come to grips, as we consider mechanism design, with “irrational consumers”. The misnamed “behavioral economics” (all economics is behavioral) field has some valuable ideas here. It seems to me economic theorists of the mechanism-design bent, should adopt these ideas and do their formalizing magic with them to reach some results. After all, no lesser theorist than Leonid Hurwicz made a foray into “irrational” agents all the way back in the 1980s.

Remark: I always place “irrational” and “rational” within quotation marks. Given what I know of game theory, including Binmore’s work on the application of Goedel’s Theorem on games played by automata, and games such as the Prisoners’ Dilemma and the Centipede, I feel I have no way of even pretending that I know what “rational behavior” really ought to mean in the case of individuals interacting in a game. Worse, in the context of consumer not knowing “what’s good for them”, we have an additional level of “irrationality” which seems to resolve to time inconsistency in the behavior of a single person. This post being long enough, I have to leave further development on my thoughts on these points to another post.