Economics programs written in Mathematica

Thomas Cool, July 22 1996, Report no 96-07
Replacement of Report 95-03

Consultancy & Econometrics, email Cool@CAN.NL

Summary

The program Mathematica is being discovered by economists. This paper introduces a number of programs that help to provide a working and teaching environment. Keywords are: Chi2, CrossTable, Decision, Dbase, DifData, Finance, Graphics, Inference, Logic, Minimax, Modeling, Sampling, Statistics, Calculus, CES, Economic`Common, Economic`Optimise, IADS, Lagrange, LevelCES, Applied General Equilibrium Analysis, Neural Networks, Nonlinear Estimate, Leontief, List, Manager, Matrices, Tool, Chain Indices, Declare, Genetic Programming.

Introduction

It seems to me that Mathematica may be one of the revolutions of mankind. It lists with the invention of the wheel, the alphabet, hygiene, the steam engine, women's lib, ... What penicilline is to an infected person, what Adam Smith's Wealth of Nations means for civilisation, is what Mathematica will likely be to human inquiry ... Well, perhaps put too dramatically, but, it may get the message across.

Generations of mathematical geniusses have been designing an elegant and compact language to state their theorems and proofs: mathematics. This language is now being implemented on the computer. By consequence, there is a much easier and faster interface between mind and machine. The best way to see what this actually means, is to use Mathematica.

These present notebooks and packages have been developed for economics. I'm econometrician involved in decision support, and these tools have served and still serve their purpose. Also, I like to have my software neat and well documented. My conjecture is that others could use it too.

These applications may help others:

Keywords on ...

Applied General Equilibrium Analysis

Extend on Asahi Noguchi's packages, see Varian (1993).

Solve systems of production and utility functions and plot 2D diagrams for arbitrary sectors and factors. Plot their time trajectories.

Have easy access to the (Dynamic) Leontief Model.

Calculus

Substitute y = f[x] back into D[y, x] to get a simpler expression.

A general routine to use Lagrange multipliers.

Decision Making

Logic and inference.

Statistical decision theory including game theory (e.g. minimax).

Crosstables, and ChiSquare tests (in higher dimensions).

Data

Database, datafiles, using packages as datafiles, data contexts, data dictionary

Econometrics

Use NonlinearFit for estimation of equations and systems of equations, with an estimated variance for the estimated parameters.

Errors in variables for one equation.

Lags, Arima and some tests of the WRI Time Series Pack.

Economics

Some general efficiency, minimal cost, maximal profit, and factor demand routines. Applications on the CES, LevelCES and IADS functions, while providing the proper limits for Leontief, Cobb-Douglas and Line functions.

Standard representation of factors, price, coefficients and key parameters. Write your own function using the standard, and call the general routines.

Economics Papers

A solution approach to problems of unemployment and inflation, using Mathematica as a word processor, while including many graphs created with it.

Using Dutch data of 1950-1995 for a further explanation of the analysis on unemployment. Provide your own data and test the analysis for your own country.

See how you might apply Chi2 tests to Frauds in the European Community.

Let the gasoline price at the center of a metropolitan area be higher than in the surrounding rural area.

Finance

Flat rates & basics.

Try the WRI Finance Package and use some additional features.

Genetic Programming

Define a population, a fitness criterion, and evolve.

Graphics

Plans, events, bond durations, calendar dates.

Use arrow diagrams to clarify relations between variables.

Linear Algebra

Create block diagonal matrices (used in estimation, of course).

Modeling

Make a model with various lags, and simulate it for a period. Store the various runs, and compare the outcomes.

Neural Networks

Use a "master" packages for Freeman's packages, see Freeman (1994).

Statistics

See Decision Making.

Chain indices. Using approximate US data as an example.

System Enhancement

Speed up the loading of common routines, and use separate contexts: Common, Declare, Graphics, List, Manager and Tool.

Have various packages share common keywords with AddedUsage, store and reset definitions without saving, inspect and show levels and dimensions.

Notebooks and Packages

The Cool Economics Pack consists of "notebooks" and "packages". Notebooks are the user-friendly interface of Mathematica with the user. The packages contain the routines.

The following lists the available packages (though with the "Cool`" prefix deleted):

{AGE`, Arima`, Arrowise`, Calculus`, CES`, Chaindex`, Chi2`, Common`, Context`, CrossTable`, Dbase`, Decision`, Declare`, Dictionary`, DifData`, Economic`Common`, Economic`Optimise`, Estimate`, Finance`, FlatRate`, GenePro`, GP`Estimation`, Graphics`, IADS`, Inference`, Lagrange`, Lags`, Leontief`, LevelCES`, List`, Logic`, Lseqlist`, Manager`, Matrices`, Minimax`, MissingData`, Model`, Neural`, PackLine`, ReadData`, Sampling`, ShowPlan`, Statistics`Common`, Time`, Tool`}

Technical Notes & Availability

The "Cool Eonomics Pack" contains about 200 files and takes 6.5 MB on hard disk. Binary files ("*.mb") that control the lay-out have been deleted.

Loading all packages - and the Mathematica packages that are relied on - takes about 2700 KB internal memory.

The Mathematica packages that are relied on and which are supplied by others, are:

  1. the standard packages supplied from WRI
  2. for resetting: CleanSlate`
  3. for Finance: the Finance Package of WRI
  4. for applied general equilibrium analysis: Asahi Noguchi & Silvio Levy's MyFindRoot` (Varian (1993))
  5. for math: Varian's SymbOpt` (see Varian)
  6. for neural networks: Freeman (1994)

Documentation is provided in & by the notebooks only.

The software has a semi-commercial status. I've decided to give it a licensed status, and to ask a small price for it. My hope is that there will be sufficient revenue to provide for the expense of a manual and that sort of thing. For that reason, the actual pack has been split in two parts. The first part is the largest, can be freely downloaded from the internet, and contains the notebooks and documentation. The second part contains the working packages. This part is small and can be emailed upon receipt of your contribution.


Thomas Cool
P.O. Box 84399
NL 2508 AJ Scheveningen
The Netherlands

E-mail Cool@Can.nl
http://www.can.nl/~cool

References

J.A. Freeman, "Simulating neural networks with Mathematica", Addison Wesley, 1994

J. Kleid, "Genetic Programming with Mathematica", Son Of a Bit Software 1994, available from MathSource

H.R. Varian (ed), "Economic and financial modeling with Mathematica", Telos 1993

http://www.can.nl/SystemsOverview/General/mathematica.html

http://www.can.nl/~cool

http://www.wri.com

Note

This is an update of the report of 1995 with the same titel, Report-no: Thomas Cool 95-03. Programs have been added, others improved and integrated. This paper now is in Word for Windows, to allow for a wider distribution.