# Matlab Programs used for the papers in Last-In First-Out Oligopoly Dynamics

## 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 that underlie the entire effort. 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`
  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 Duopoly Dynamics with a Barrier to Entry.
`probit.m`
  This program calculates the population Probit estimates of static/long-run entry thresholds repored in Last-In First-Out Oligopoly Dynamics.

## Output Utility Files

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

`latextableA.m`
  Creates the table of entry and exit thresholds in Last-In First-Out Oligopoly Dynamics.
`latextableB.m`
  Creates the table of Probit estimates in Last-In First-Out Oligopoly Dynamics.
`latextable.m`
  Creates tables of ergodic distribution statistics in Duopoly Dynamics with a Barrier to Entry.
`valueplot.m`
  Creates the value-function plot for the leading example in Duopoly Dynamics with a Barrier to Entry.

## Example Files

These programs calculate equilibria for the papers' examples.

`pencil.m`
  This calculates the equilibrium for the pencil and paper example in both papers. Yes, it can really be done with pencil and paper, but we are lazy.
`nothreshold.m`
  This calculates the equilibrium for the counterexample to the assertion that stochastic dominance suffices for all firms to use threshold rules.
`nothresholdplot.m`
  This produces a plot of the equilibrium value functions. Currently, running this program produces a slew of warnings about Matlab's inability to interpret a TeX string. We have this error isolated to the code which produces the annotation beginning with "Enter if", but we have not yet solved it. In any case, the output is as desired.
`lead.m`
  This calculates the equilibrium for the leading example in Duopoly Dynamics with a Barrier to Entry.
`fifo.m`
  This calculates the equilibrium for the First-In First-Out model discussed in Duopoly Dynamics with a Barrier to Entry.

## Experiment Files

These are the programs that run the various experiments reported in the papers.

`experimentA.m`
  Calculates the entry and exit thresholds reported in Last-In First-Out Oligopoly Dynamics.
`experimentB.m`
  Calculates the ordered-Probit estimates reported in Last-In First-Out Oligopoly Dynamics.
`experiment.m`
  Calculates the ergodic distribution statistics in Duopoly Dynamics with a Barrier to Entry.

Last modified by JRC on December 27, 2007