Mathematica demonstration illustrating Melitz’ trade model

Melitz, again. I took a Mathematica class this semester where we had to build a demonstration that could be uploaded to Wolfram’s demonstration project site. I created an animated version of figure 2 from Melitz’ paper (based on the calculations done in one of the Mathematica notebooks presented below), which IMO is well suited to do a comparative statics analysis of autarky and the open economy.

The online demonstration is available here.

Melitz’ heterogeneous firm trade model with Pareto-distributed productivity

The Melitz (2003) trade model is one of the central models of my diploma thesis, so I’ve spent (wasted?) some time derived a closed-form solution for Pareto-distributed firm productivity levels (Melitz himself does not use a particular distribution).  I’ve been able to replicate most of paper’s results, while a few do not hold for the Pareto distribution (using other distributions, though, will generally not produce closed-form solutions). With the Mathematica notebook it is easy to manipulate model parameters and see the effects on equilibrium values.

Download links:  PDF, Mathematica Notebook (ZIP archive)

Update (Dec. 8, 2009): minor changes and error corrections in PDF and Mathematica notebook.

Update (Dec. 14, 2009): Helpman/Melitz/Yeaple (2004) present a similar model with heterogeneous firms and Pareto-distributed firm productivity. It is less complex than Melitz (2003) as it omits the stochastic firm entry and exit process. However, it allows to model firm decisions concerning production for the domestic market and export / FDI in foreign markets depending on firm productivity. The Mathematica notebook below derives this model in greater detail than the original paper.

Download links: PDF, Mathematica notebook/package


  • Helpman, Elhanan/ Melitz, Marc J. and Yeaple, Stephen R. (2004): Export versus FDI with Heterogeneous Firms . In: American Economic Review 94(1), 300 316.
  • Melitz, Marc J. (2003): “The Impact of Trade on Intra-Industry Reallocations and Aggregate Industry Productivity”. In: Econometrica 71(6), 1695.