# Matlab Programs Used for Duopoly Dynamics with a Barrier to Entry

## by Jaap H. Abbring and Jeffrey R. Campbell

The links below lead to html versions of the programs.

## Building Blocks

These programs are the fundamental procedures for Abbring and Campbell's project Last-In First-Out Oligopoly Dynamics, initiated with their eponymous paper, of which this paper is part. Although typically such procedures would be encapsulated within a function, we have chosen to let each of them be a stand-alone program. Each of them looks for the existence of a variable designated to pass required arguments. (For example, `approximate.m` looks for the structure `approximateARG`.) If this variable does not exist, then it uses default values to carry out an example of its task. These programs also typically produce graphical or text output if their required variable does not exist. This allows us to check that they are performing properly before integrating them into a system.

`approximate.m`
  This program calculates a set of mixing coefficients over uniform distributions to approximate a given symmetric distribution.
`markov.m`
  This program creates the support and transition matrix of a Markov chain approximating an AR(1) reflected off of the boundaries of its support.
`bellman.m`
  This program is the heart of the enterprise. It uses Bellman-equation iteration as described in the text to calculate the LIFO equilibrium value functions.
`thresholds.m`
  This program calculates the equilibrium entry and exit thresholds.

## Quantity Calculations

With the equilibrium in hand, the code in these programs calculates the model's ergodic distribution and related observable quantities.

`equilibrium.m`
  This program calculates the LIFO equilibrium's ergodic distribution.
`statistics.m`
  This program calculates the statistics of interest reported in the paper.

## Output Utility Files

Matlab creates the tables and figures in the text, so no human hand can introduce an error. These files accomplish this.

`latextable.m`
  This program creates tables of ergodic distribution statistics (Tables 2 and 3).
`valueplot.m`
  This program creates the value-function plot for the leading example (Figure 3).

## Example Files

These programs calculate equilibria for the papers' examples.

`pencilB.m`
  This calculates the equilibrium for Section 2.2's pencil-and-paper example. Yes, it can really be done with pencil and paper, but we are lazy.
`lead.m`
  This calculates the equilibrium for Section 3.2.1's leading example.
`fifo.m`
  This calculates the equilibrium for Section 4's First-In First-Out model.

## Experiment Files

This is the program that runs the various experiments reported in the paper.

`experiment.m`
  This calculates the ergodic distribution statistics in Tables 2 and 3.

Last modified by JHA on November 24, 2008