Sunday 20 February 2011

Reaching an equilibrium via Cournot tatonnement

A nice way of demonstrating the motivation behind the Nash Equilibrium concept to students is via the good old Cournot tatonnement process, and where best to try it out than for the classic Cournot game itself. 
Suppose there are three firms and that we are given:
  1. a vector Q of the quantities they each currently produce
  2. a demand price function P of the total quantity produced by all firms
  3. a vector c of the firms' respective cost functions
For instance, for a reciprocal demand and constant marginal costs of 1, 2 and 3 respectively, this could be specified as follows:

Let us now define a function br which returns the firms' best response quantities (to a given Q), based on the simple myopic adjustment rule, i.e. each player naively assumes that others will not modify their output and adjusts her own quantity choice accordingly.


During the i-th iteration of Do, the function Drops the i-th quantity from the output vector and treats the Total of the remaining two quantities as fixed, finding the non-negative profit-maximizing quantity q of the i-th firm numerically using NArgMax.
Based on the initial Q, it is now simple to obtain a sequence of any number (here, eight) of subsequent adjustments of the output vector:

We will now set a few options for the Graphics3D function, which we will then use to visualize the adjustment process.

The following code defines a 3D graphic g showing the first i - 1 points of the dynamic adjustment, followed by an additional point pos, connected with red lines.

Note that I also included invisible (size 0) points for the complete list Qs, so that the graph always automatically spans the same space and a repeated evaluation of g (below) can be turned into an animation. Rasterizing the graphs will make the animation run more smoothly on slow computers, although it will take longer to generate (below).


The inner Do loop creates the animation frames responsible for smooth transition between steps i and i - 1 of the dynamic adjustment history Qs (i is controlled by the outer loop). The subsequent frames correspond to the end-point pos being a fraction j of the way between elements i and i - 1 of Qs. Once the transition is complete, the outer loop copies the last frame 20 times, so that the animation will pause for a moment upon reaching every subsequent step of Qs. The result looks as follows:

Naturally, one can easily change the demand, cost and starting point specifications to obtain different (often cyclical and unstable) patterns.