Matlab Programs for 
The Value of Life and the Rise in Health Spending
Robert E. Hall and Charles I. Jones
April 7, 2006 -- Version 5.0

*********************************************************
Update: 1/20/09 -- added mlstring.m (which was missing before)
*********************************************************

The main programs:
-----------------

MakeData.m -- Basic program for creating raw data in matlab.
Simulations.m -- Meta-Program for running multiple simulations
  -- Calls solvesetup.m, solvemodel.m, estimatetheta.m, estimateb.m
SimFigs.m -- Creates the figures.

-- These programs should be run in this order, i.e.

    >> MakeData
    >> Simulations
    >> SimFigs

Results will be saved in MakeData.log, Simulations.log and a bunch of
postscript figure files.


Various functions that are called:
---------------------------------

Over the years, I've created a bunch of functions that get called by
these programs.  These are also included in the .zip file so that the
main programs will run:

chadfig.m  replace.m        wait.m      mlstring.m
cshow.m    mult.m           say.m   
delta.m    interplin5.m     padspace.m  strmat.m
div.m      iv.m             plotlog.m   vec2str.m

The most interesting/useful of these in other contexts are probably

chadfig.m -- Create nice figures
cshow.m  -- my (fancy) version of the old Gauss command for displaying
            data.


Overview of our Solution Approach
---------------------------------

We solve the model numerically using the following procedure.

1. Begin with a guess for per capita consumption at each date.

2. Guess a terminal value for the value function at each age in the
   final year of the simulation, 2095; we calculate $v$ from the
   hypothesis that future variables have the same value as has been
   projected for 2095.

3. Iterate backwards in time using the first order condition to
   determine health spending at each age and each point in time.

4. Use this time series for health spending by age to get health status,
   $x$ and hence age-specific mortality. Iterate forward on the
   population equation to get the size of the population at each age and
   date.

5. Finally, for each period, the distribution of the population, the
   guess for per capita consumption, and the health spending level imply
   a total quantity of resources used, while the level of per capita
   income implies a total quantity of resources available. Let $d$ be
   the $T \times 1$ vector of discrepancies in the resource constraint.

6. Use a nonlinear equation solver (fsolve in Matlab) to find the time
   series for consumption that makes the discrepancy vector equal to
   zero.

A complete solution takes less than 5 seconds on standard computers.

Please send any errors you find to chad@econ.berkeley.edu.

