Monday 27 December 2010

Hotelling model: finding a Subgame-Perfect Nash Equilibrium

I find it only appropriate to kickstart this blog with a demo of how to handle the fundamentals of a model which nearly drove me to an assisted suicide over the course of my PhD.

The Basics

In the classic Hotelling setting, two shops-owners simultaneously choose locations x1 and x2 in a Main Street, modeled as an interval from 0 to 1. They then proceed to simultaneously set their prices p1 and p2, at which point the customers (uniformly distributed along the street) buy one unit of a good each from the shop they find cheaper. The latter comparison is based on the total cost of making a purchase, comprising not only the actual price, but also the (quadratic) cost of getting to the store from one's own location. Hence, we may write this as the following Function of the consumer's own location c, a firm's location xi and the price pi it sets:



Consequently, the consumer at buys from firm 1 if:

so that the total mass of consumers buying from firm 1 equals:


The function Boole yields 1 if the input condition is true (the consumer buys from firm 1) and 0 otherwise, so it remains to Integrate it with respect to the consumer location c over the entire Main Street. Assuming no production costs for simplicity, we may define the game's payoff function as:

Finding the Equilibrium

Suppose now the locations have already been fixed and that x1 is the one further to the left (x1 < x2). Let's identify the prices p1* and p2* which are best responses to one another, i.e. form a Nash Equilibrium. For p1to be a best-response to p2*, we need:

and we can Reduce this to a set of conditions on x1x2p1*, and p2for a complete best-response mapping of player 1 (note the use of the x1 < x2 assumption via the logical && operator), storing it under the name BR1 :

In a similar way, we obtain the set of conditions ensuring that p2is a best-response of firm 2 to p1*.



where the order of variables  is reversed, since the payoff function was defined to give the profit of the firm whose location and price are specified first in the input. It is now easy to characterize the set of Nash Equilibria as an intersection of BR1 and BR2 , and to Simplify the result using the x1 < x2 assumption.

Mathematica gives the result as two linear equations, which means there is a unique equilibrium. We may therefore obtain the exact equilibrium prices for a given locations-pair, by Solving the above equalities for p1* and p2*

Technically, this generates a list of replacement rules, which may be applied (substituted) to any expressions using the /. operator. For instance, the following function returns the second-stage equilibrium profit of firm 1 when it is located left of firm 2:

Note the use of the @@ operator to define the function - very useful when the function's body must be evaluated before being attached to the function name. Based on the so obtained reduced game payoff, we may find the subgame-perfect Nash Equilibrium locations x1* and x2*. For x1to be the best possible location left of x2*, we need:

i.e. when locating left of the counterpart, it is best to move as far away as possible. Naturally, the same applies when locating to the right of the rival, in which case it is optimal to locate at 1. Consequently, the only possible equilibrium is where the shops are located at the opposite ends of the market.

Thursday 23 December 2010

About this blog


Sixty-odd years ago, when von Neumann & Morgenstern’s ‘Theory of Games...’ was first published, it was dismissed by the academic community as ‘ unreadably mathematical (which, in truth, it was). Indeed, similar was the fate of even Keynes’ General Theory, which a certain Professor of Economics happened to open on one of the very few pages containing mathematical equations, and consequently threw it down in disgust, saying ‘This is the end of John Maynard Keynes’ (The History Of Game Theory, vol. 1). Six decades on, the wheel of fortune has turned and it is time for economic papers with little or no maths to find their way to the trash bin as pointless cheap talk.

One thing hasn’t changed, though – math is still hard. It takes plenty of time to express one’s ideas in its universal language and, if successful, for others to understand them. In fact, using a tool so imposing sometimes makes it easy to confuse the mathematical reality it’s based on with the economic one, which is supposed to be the actual subject of investigation. Time after time, a theorist finds herself pondering the choice between a more realistic model specification and one that is nicely tractable, leading to aesthetically pleasing solution formulae. Similarly, an economics student might let the technical details of a framework obscure the simple logic and economic intuition behind it.

The solution lies, in my view, in using the latest developments in computer science to introduce a meta-language that would allow focusing on the economics, not the mathematics of the problem at hand. I believe that the Wolfram Mathematica package makes it possible to do just that and this blog is dedicated to promoting its use in economics. Rather than to provide a tutorial on using this software, I will aim to give a flavour of how Mathematica can be used to set up and analyze a model, and to demonstrate it to both the academic peers and students. To keep things relatively simple, I will use well known economic problems, obtaining and visualizing the solutions in ways that will contrast the conventional textbook approach.