Page 1 of 1

Time To Build Ramsey model

PostPosted: Sun Dec 20, 2015 10:34 am
by lzs52t
Hello, everyone.
Someone please help me.
I'm newbe of dynare and have questions.

I want to simulate time-to-build ramsey model.
In this model, Law of motion of capital is follow;
k(t+1)-k(t)=f(k(t-1))-δk(t-1)
I know this model require two initial value of capital(k(-1)and k(0)), but I don't know how I express in dynare.

I write a dynare cord of this model,but I have a syntax error in line19 (K = Kstar)
I don't know why error occured. Please tell me why this cord is wrong.
Code: Select all
var C K;
parameters alpha delta beta rho;

alpha = 0.3;
beta = 0.99;
delta = 0.025;
rho = 0.9;

Cstar = ((1 - beta)/(alpha * beta^2)^(alpha/(alpha - 1)) - delta * ((1 - beta)/(alpha * beta^2)^(1/(alpha - 1));
Kstar = ((1 - beta)/(alpha * beta^2)^(1/(alpha - 1));

model;
C^(-1 * rho) = beta * C(+1)^(-1 * rho) + beta^2 * (alpha * K(+1)^(alpha - 1) - delta) * C(+2)^(-1 * rho);
K(+1) - K = K(-1)^(alpha) - delta * K(-1) - C;
end;

inival;
C = Cstar
K = Kstar
end;

steady;

[Cstar; Kstar]


Thank you for your reading.

Re: Time To Build Ramsey model

PostPosted: Sun Dec 20, 2015 2:29 pm
by jpfeifer
1. There are several brackets missing.
2. It should be initval not inival.
3. Every line needs to end with a semicolon.

Re: Time To Build Ramsey model

PostPosted: Sun Dec 20, 2015 4:41 pm
by lzs52t
Thank you for your great help, Mr.jpfeifer.
Thanks to your perfect comment,I was able to simulate this model.

Re: Time To Build Ramsey model

PostPosted: Wed Dec 23, 2015 9:15 am
by lzs52t
someone please help me. I have another problem.

I want to simulate comparative dynamics in this model, but not work.

I want to move the beta and draw a picture which it affects on dynamic path.
So, I redefined beta from "parameters" to "varexo".
Code is here.

Code: Select all
var C K;
varexo beta;
parameters alpha delta rho;

alpha = 0.3;
delta = 0.025;
rho = 0.9;


model;
C^(-1 * rho) = beta * C(+1)^(-1 * rho) + beta^3 * (alpha * K(+1)^(alpha - 1) - delta) * C(+3)^(-1 * rho);
K(+1) - K = K(-2)^(alpha) - delta * K(-2) - C;
end;

Cstar = ((1 - beta)/(alpha * beta^3)+(delta / alpha))^(alpha/(alpha - 1)) - delta * ((1 - beta)/(alpha * beta^3)+(delta / alpha))^(1/(alpha - 1));
Kstar = ((1 - beta)/(alpha * beta^3)+(delta / alpha))^(1/(alpha - 1));

initval;
C = 10;
K = 100;
beta = 0.99;
end;

endval;
C = Cstar;
K = Kstar;
beta = 0.99;
end;

steady;

shocks;
var beta;
periods 5:45;
values 0.95;
end;

simul(periods=50);

rplot C;
rplot K;

Re: Time To Build Ramsey model

PostPosted: Wed Dec 23, 2015 9:32 am
by jpfeifer
Always provide the error message you are experiencing. I can run your model with the current Dynare unstable.

Re: Time To Build Ramsey model

PostPosted: Wed Dec 23, 2015 10:18 am
by lzs52t
Thank you for your comment.
I'll be careful.
The problem is resolved in my own.
Thank you.

Re: Time To Build Ramsey model

PostPosted: Thu Dec 24, 2015 6:58 am
by lzs52t
I simulate another model of time to build.
Simulation doesn't work well.

please help me.

Code: Select all
var C K M pi;
parameters alpha delta beta g gamma;

alpha = 0.3;
beta = 0.99;
delta = 0.025;
g=1.01;
gamma = 0.8;

model;
C^(-1) = beta * C(+1)^(-1) + (beta^3) * (alpha * K(+1)^(alpha - 1) - delta) * C(+3)^(-1);
beta * gamma * M^(-1) = pi(-1)*C(-1)^(-1) - beta * C^(-1);
K(+1) - K = K(-2)^(alpha) - delta * K(-2) - C;
M(+1) = (g/pi(+1)) * M;
end;

Cstar =  ((1 - beta)/(alpha * beta^3) + (delta / alpha))^(alpha/(alpha - 1)) - delta * ((1 - beta)/(alpha * beta^3) + (delta / alpha))^(1/(alpha - 1));
Kstar =  ((1 - beta)/(alpha * beta^3) + (delta / alpha))^(1/(alpha - 1));
pistar = g;
Mstar =  gamma * beta/(g - beta)*((1 - beta)/(alpha * beta^3) + (delta / alpha))^(alpha/(alpha - 1)) - delta * ((1 - beta)/(alpha * beta^3) + (delta / alpha))^(1/(alpha - 1));

initval;
C = 1;
K = 1;
M = 1;
pi = 1.01;
end;

endval;
C = 1.97038;
K = 21.2584;
M = 78.0252;
pi = 1.01;
end;

steady;

simul(periods = 5);

rplot C;
rplot K;
rplot M;
rplot pi;



Error message is follow;

error: SIMUL: error in model specification : variable pi doesn't appear as current variable.

If you need additional information to solve this problem, please reply here.

Thank you.

Re: Time To Build Ramsey model

PostPosted: Sat Dec 26, 2015 10:19 am
by jpfeifer
You need to check your model. If inflation does not appear within the current period, there must be something wrong.

Re: Time To Build Ramsey model

PostPosted: Sat Jan 16, 2016 3:16 pm
by lzs52t
Thanks for your comment.
I could able to simulate this model, but another problem occur.

I simulate time to build ramsey model.
But,I have another question.
I used check command and I verify the linearized model has some complex number of eigenvalues.
So optimal path should be oscillate.
I could able to simulate this model without error, but optimal path isn't oscillate.
My scenario is following;
going to steady state from initial value of C and K are 1.

I check my dynare code over ten times, but I was not able to why it occurs.


dynare code is here
Code: Select all
var C K;
parameters alpha beta delta rho;

alpha = 0.3;
beta = 0.99;
delta = 0.025;
rho = 0.9;


model;
C^(-1 * rho) = beta * C(+1)^(-1 * rho) + beta^7 * (alpha * K(+1)^(alpha - 1) - delta) * C(+7)^(-1 * rho);
K = K(-1) + K(-6)^(alpha) - delta * K(-6) - C(-1);
end;

initval;
C = 1;
K = 1;
end;

endval;
C = 1.96661;
K = 20.9;
end;

steady;

check;

simul(periods = 30);

rplot C;
rplot K;

dynatype(ram);

and result file is attachment.
X2 means if X(t+1)>X(t), return 1
X(t+1)<X(t), return -1
X(t+1)=X(t), return 0
GOX is growth rate of X.
(X is a variable name)

Thank you for your reading.

Re: Time To Build Ramsey model

PostPosted: Tue Jan 19, 2016 9:44 am
by jpfeifer
Complex eigenvalues do not automatically mean oscillations. Actually, some complex generalized eigenvalues are common in DSGE models.

Re: Time To Build Ramsey model

PostPosted: Tue Jan 19, 2016 10:19 am
by lzs52t
Thank you.
I found some mistake in my model, and some problems are resolved.