multiple agent model

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

multiple agent model

Postby doo782 » Mon May 21, 2007 9:29 pm

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(c) + 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;

steady;
check;

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

steady;
check;
simul(periods=250);
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm

Postby MichelJuillard » Tue May 22, 2007 11:15 am

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
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Postby doo782 » Tue May 22, 2007 12:07 pm

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
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm

Postby MichelJuillard » Tue May 22, 2007 1:05 pm

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
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Postby doo782 » Tue May 22, 2007 2:34 pm

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
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm

Postby MichelJuillard » Tue May 22, 2007 7:09 pm

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
1 = x*y;
1 = y*x;

There are an infinity of solutions for x and y.

Best

Michel
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Postby doo782 » Tue May 22, 2007 8:40 pm

see attached.

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

x*y = 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

a*b=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.
Attachments
test1.mod
(940 Bytes) Downloaded 128 times
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm

Postby doo782 » Tue May 22, 2007 10:05 pm

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.
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm

Postby MichelJuillard » Wed May 23, 2007 7:38 am

At the steady state:
c1(+1) = c1
c2(+1) = c2

and the 2 Euler equations are identically
1=beta* (alpha*((k1+k2)^(alpha-1))*((l1(+1)+l2(+1))^(1-alpha)));

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
MichelJuillard
 
Posts: 680
Joined: Thu Nov 18, 2004 10:51 am

Postby doo782 » Wed May 23, 2007 12:06 pm

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
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm

Postby doo782 » Wed May 23, 2007 10:35 pm

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.
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm

Postby doo782 » Thu May 24, 2007 12:23 am

god, just ignore me. nevermind. thanks again, Michel.
doo782
 
Posts: 8
Joined: Mon May 21, 2007 9:17 pm


Return to Dynare help

Who is online

Users browsing this forum: Google [Bot] and 6 guests