Page 1 of 1

m.file or external function to solve the following model

PostPosted: Sun May 05, 2013 4:43 am
by HouseC
Hi, I am trying to calibrate the model by Gertler and Kiyotaki(2010). the mod file is attached. I need to guess the initial value for this model. And i have try to use matlab code"broyden" to solve the non-linear system, but i failed. Anyone who are good at solving the steady state system by using matlab function? pls give me a hand. thx a lot

Re: m.file or external function to solve the following model

PostPosted: Wed May 08, 2013 8:40 am
by efi
I would try to get the steady state values as described in this article with dynare. You find a small description in Appendix 1 at the end of the text. You can then use the determined steady state values as initial values.

Re: m.file or external function to solve the following model

PostPosted: Thu May 09, 2013 3:02 pm
by HouseC
efi wrote:I would try to get the steady state values as described in this article with dynare. You find a small description in Appendix 1 at the end of the text. You can then use the determined steady state values as initial values.

i know what they discribe in the appendix, still ifailed to get the steady state, did you success in guessing the value?

Re: m.file or external function to solve the following model

PostPosted: Thu May 09, 2013 4:06 pm
by efi
Hello HouseC,

yes I tried it and I got Steady State Values. But with this initial values, the model does not work...I think I have false timing conventions on my variables. Have you already thought about the selection of predetermined variables?

Here my way to get the steady state values:
First I guess you have to write two .mod-files.
- First you determine the steady state values of the banks. But you have to eliminate the "K" -> then you have the variables DoverK;NioverK and NnoverK. Wenn you run this file you get Z.
- Then use Z as parameter in the second file. You use the second mod.file to determine the remaining variables.

After that you multiply DoverK;NioverK and NnoverK with K to get D, Ni and Nn.
Unfortunately my Lambda_n is negative. I set it to zero...

Then you get the following initial values (Which unfortunatly do not work in the full model):
initval;
%A=0;
PSI=0;
%A_eps=0;
Psi_eps=0;
Qi =1;
Qn = 1.058;
R=1/beta;
Rb=1.0101;
Y = 0.746634;
C =0.574446;
L = 0.249937;
I = 0.172188;
K =6.88751;
Z =0.0357733;
D = 6.2919539;
N_i =0.15078756;
N_n =0.736908;
S_i= 1.85605;
S_n=5.03649;
nu =1.09282;
nu_s =1.1328;
nu_b =1.09282;
lambda_i = 0.449051;
lambda_n =0;
u_C = 1.758216;
Omega = 1.193;
Omega_i = 1.5;
Omega_n = 1.09022104;

Re: m.file or external function to solve the following model

PostPosted: Thu May 09, 2013 6:43 pm
by jpfeifer
Regardless of whether the timing is correct or not, you should get a steady state. If you put steady in your model, Dynare will give you the actual steady state values in the command window (if the steady state has been found). Please post those values instead of your starting values.

Re: m.file or external function to solve the following model

PostPosted: Fri May 10, 2013 4:22 am
by HouseC
efi wrote:Hello HouseC,

yes I tried it and I got Steady State Values. But with this initial values, the model does not work...I think I have false timing conventions on my variables. Have you already thought about the selection of predetermined variables?

Here my way to get the steady state values:
First I guess you have to write two .mod-files.
- First you determine the steady state values of the banks. But you have to eliminate the "K" -> then you have the variables DoverK;NioverK and NnoverK. Wenn you run this file you get Z.
- Then use Z as parameter in the second file. You use the second mod.file to determine the remaining variables.

After that you multiply DoverK;NioverK and NnoverK with K to get D, Ni and Nn.
Unfortunately my Lambda_n is negative. I set it to zero...

Then you get the following initial values (Which unfortunatly do not work in the full model):
initval;
%A=0;
PSI=0;
%A_eps=0;
Psi_eps=0;
Qi =1;
Qn = 1.058;
R=1/beta;
Rb=1.0101;
Y = 0.746634;
C =0.574446;
L = 0.249937;
I = 0.172188;
K =6.88751;
Z =0.0357733;
D = 6.2919539;
N_i =0.15078756;
N_n =0.736908;
S_i= 1.85605;
S_n=5.03649;
nu =1.09282;
nu_s =1.1328;
nu_b =1.09282;
lambda_i = 0.449051;
lambda_n =0;
u_C = 1.758216;
Omega = 1.193;
Omega_i = 1.5;
Omega_n = 1.09022104;


i agree with jpfeifer's comment, do you have the steady state value, which is reported under the matlab command window?

Re: m.file or external function to solve the following model

PostPosted: Fri May 10, 2013 7:51 am
by efi
Here are my results, but I am not sure how to deal with the value of 'lambda_n':


STEADY-STATE RESULTS:

I 0.172188
C 0.574446
K 6.88753
L 0.249938
Z 0.0357732
Qn 1.058
Nn 0.736906
Ni 0.150788
D 6.29198
nu 1.09283
nu_s 1.1328
nu_b 1.09283
R_b 1.0101
lambda_i 0.449053
lambda_n -0.146422

Re: m.file or external function to solve the following model

PostPosted: Mon May 13, 2013 3:53 am
by HouseC
efi wrote:Here are my results, but I am not sure how to deal with the value of 'lambda_n':


STEADY-STATE RESULTS:

I 0.172188
C 0.574446
K 6.88753
L 0.249938
Z 0.0357732
Qn 1.058
Nn 0.736906
Ni 0.150788
D 6.29198
nu 1.09283
nu_s 1.1328
nu_b 1.09283
R_b 1.0101
lambda_i 0.449053
lambda_n -0.146422


hi, efi. Which case you try to calibrate? perfect interbank market or case with friction? I try to use your ss value, but I still failed.

Re: m.file or external function to solve the following model

PostPosted: Mon May 13, 2013 4:26 pm
by efi
This are my values for the case omega = 0. But I used the originial equations instead of the transformed with exp.

Re: m.file or external function to solve the following model

PostPosted: Fri May 17, 2013 11:18 am
by efi
Hello HouseC, did you solved your problem ? Or receive you the same steady state values?

Re: m.file or external function to solve the following model

PostPosted: Sat Jun 01, 2013 2:46 pm
by krust
Hello HouceC,

I also try to replicate GK in case of imperfect interbank market. Have you already solved your problem? I tried to solve it in the same way, but some equations differ from yours. I revieve IRFs they differ from the output in this paper. If you solved your problem could you give me a hint?

Or has someone else a replication file?
Thanks a lot!

Krust

Re: m.file or external function to solve the following model

PostPosted: Sat Aug 02, 2014 4:29 am
by J.Höffler
If you are interested in replication you may also want to take a look at this:
viewtopic.php?f=2&t=5926