I am going to teach basic macroeconomics to undergrads in the fall and I want to show them the simplest way to solve an economy on the computer. So I discovered a technique used by Yale’s John Gaenakoplos in his fantastic Financial Theory course. He’s using it to solve a 2×2 pure exchange economy. I’m applying it to a miniature Keynesian model.
The model has one good, three agents – private consumers, firms, government – and two equations:
(1) C = MPC*(Y – T)
(2) Y = C + I + G
(1) is the Simple Keynesian Consumption function relating private consumption (C) to net national income (Y-T) with MPC being the marginal propensity to consume. (2) is the goods market equilibrium condition, where I is business investment and G is government expenditure.
Solving the economy involves three steps: (i) set the MPC parameter, (ii) set the exogenous variables (I,G,T), (iii) solve for the endogenous variables (C,Y). Of course, since this model is all nice and linear, it’s easy to derive closed-form solutions. But in more complicated models such as ISLM, finding closed-form solutions can quickly become quite tedious. So I want the computer to do it for me.
First I write down all parameters and variables, each in a separate cell. Then I write down equations (1) and (2) as “loss functions”:
(1*) F(C,Y) = C-MPC*(Y-T),
(2*) H(C,Y) = Y-(C+I+G).
After that I define a “total loss function” as the sum of squares of F and H:
(3) L(C,Y) = F(C,Y)^2 + H(C,Y)^2.
I want Excel to minimize L(C,Y) with respect to C and Y, which can easily be done with the Excel solver. (Restrict all endogenous variables to be non-negative and select GRG as the solution method.) Why does this work? Because the minimum value of L(C,Y) is zero, hence F(C,Y) and H(C,Y) must also be zero in the minimum implying that (1) and (2) are fulfilled.
If you want to know the multiplier effect of a tax cut or an investment boom, just change the relevant cell entries and re-run the solver. What a nice toy for rainy days such as this.
Here’s the file: macro simul