# Multiple agent model

Hi all,

I’m trying to simulate a model with multiple types of agents and am having trouble. I’ve reduced it to a simple deterministic ramsey model with two agents differentiated by their distaste for labor. Dynare is able to compute steady states for any sets of parameters, but when the agents are different, simulations don’t work. That is, I’ll simulate changing the utility function of one of the agents and capital for the two agents go off to +/- infinity. Does anybody have any suggestions? My code is below.

var k1, l1, c1, k2, c2, l2;
varexo a1, a2; ** utility is defined as u(c,l) = log© + a*log(1-l)
parameters alpha, beta; ** capital share and discount rate

** capital fully depreciates

alpha=.33;
beta=.97;

model;

c1 + k1 = k1(-1)alpha((k1(-1)+k2(-1))^(alpha-1))((l1+l2)^(1-alpha)) + l1(1-alpha)((k1(-1)+k2(-1))^(alpha))((l1+l2)^(-alpha));

c2 + k2 = k2(-1)alpha((k1(-1)+k2(-1))^(alpha-1))((l1+l2)^(1-alpha)) + l2(1-alpha)((k1(-1)+k2(-1))^(alpha))((l1+l2)^(-alpha));

c1(+1)/c1 = beta* (alpha*((k1+k2)^(alpha-1))*((l1(+1)+l2(+1))^(1-alpha)));

c2(+1)/c2 = beta* (alpha*((k1+k2)^(alpha-1))*((l1(+1)+l2(+1))^(1-alpha)));

a1/(1-l1) - ((1-alpha)((k1(-1)+k2(-1))^(alpha))((l1+l2)^(-alpha)))/c1 = 0;
a2/(1-l2) - ((1-alpha)((k1(-1)+k2(-1))^(alpha))((l1+l2)^(-alpha)))/c2 = 0;

end;

initval;
a1=2;
a2=.5;
c1=.35;
k1=.3;
l1=.7;
c2=.35;
k2=.3;
l2=.7;
end;

check;

endval;
a1=2;
a2=2;
c1=.35;
k1=.3;
l1=.7;
c2=.35;
k2=.3;
l2=.7;
end;

check;
simul(periods=250);

There are two different problems with this model.

1. as it is, steady can’t compute the terminal equilibrium specified by ENDVAL. Most likely because the guess value for the endogenous variables are too far from the solution. This could be fixed by trial an error, starting by solving steady state problems closer to the one specified in INITVAL (set a2 closer to 0.5) and working from there

2. more serious the model contains a unit root and can’t be solved even when the terminal steady state is the same as the initial one (for a2 constant). This has to do with the structure of the model itself.

Kind regards

Michel

Michel,

Thanks so much for your quick help.

When I copy the code that I posted and take out the comments, it runs fine. Dynare calculates the steady state for both the starting and ending values and runs a simulation (the simulation just has the problem I described before). I’m not sure why there would be a unit root – Dynare isn’t telling me there is one. this is simply the ramsey model with two agents; there shouldn’t be a unit root anywhere.

What makes you say there’s a unit root?

If it helps, these are approximately the steady state values for the endpoints:
a1=2;
a2=2;
c1=.13;
k1=.06;
l1=.33;
c2=.13;
k2=.06;
l2=.33;

Thanks again,
Ian

Would you obtain isn’t a solution. See the WARNING about the maximum of iterations being reached

There is a 1 in the report of check that displays EIGENVALUES

Equations 3 and 4 are identical at the steady state:
c1(+1)/c1 = c2(+1)/c2 = 1

Best

Michel

I’m not getting a warning about the maximum number of iterations. It just runs straight through, saying all 5 iterations of the simulation ran and convergency was obtained.

As to the steady state, what’s the intuition behind why this shouldn’t work. Why shouldn’t I be able to write down a model with multiple agents who behave exactly as in the ramsey framework? The fact that some of the equations are redundant shouldn’t matter since the solution involves all the agents behaving identically, no?

Best,
Ian

For some reason, we don’t seem to obtain the same results. Can you attach the file that you are actually using rather than copy it in the message?

Two identical equations don’t mean that there are two identical solutions but that the system is singular. Consider

There are an infinity of solutions for x and y.

Best

Michel

see attached.

As to the singularity problem, I’m not sure I see how your example corresponds to my model. You write

xy = 1
y
x = 1

I, on the other hand, would interpret the two intertemporal euler equations – c1(+1)/c1=c2(+1)/c2=1 as being similar to

ab=1
c
d=1

In that case There’s no problem. The intuition here is that there is no reason we shouldn’t be able to solve a representative agent model with an arbitrarily large number of agents. They will all have identical first order conditions defining the equilibria, and they will all displsy identical behavior.
test1.mod (940 Bytes)

As I think about it a bit more, it seems like Dynare is solving for an equilibrium path – i.e. all the constraints are satisfied – but the no ponzi game and transversality conditions are being violated.

and the 2 Euler equations are identically

In the NeoClassical growth model, equilibrium capital stock doesn’t depends on preferences, so the respective capital holdings of agents 1 and 2 are undetermined at the steady state.

In Dynare the transversality condition is imposed in the following manners:

1. for deterministic models (simul) by setting the terminal steady state
2. for stochastic models (stoch_simul) by selecting the unique stable trajectory in the linear rational expectation problem (see Blanchard and Kahn)

Best

Michel

Ah, you’re right. Sorry for being so dense. And thanks again for being so quick with your replies. Creating Dynare was an unbelievable gift in itself. Running this board is above and beyond the call of duty.

Best,
Ian

Hi Michel,

In thinking about it and talking to some other people, I’m actually no longer sure you’re right. Have you tried running my code? Dynare runs it without reporting any errors. There should be no reason you can’t have a representative agent model with two identical agents – the total capital stock is pinned down only by preferences, but the budget constraints and steady state consumption levels determine the amount of capital held by each agent.

god, just ignore me. nevermind. thanks again, Michel.