Problem with .mod file

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.

Problem with .mod file

Postby Nick2382 » Tue Sep 30, 2014 11:00 am

Hi all,

I am trying to solve for Ramsey optimal policy in a simplified version of Gerali et al. (2010) model, but when I run it I get the following two warnings:

Warning: Rank deficient, rank = 32, tol = 3.306251e-14.
> In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In dynare_solve at 64
In dyn_ramsey_static at 66
In evaluate_steady_state at 55
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In MyModel2 at 918
In dynare at 180
STEADY: numerical initial values or parameters incompatible with the following equations
1 5 47 48

Please check for example
i) if all parameters occurring in these equations are defined
ii) that no division by an endogenous variable initialized to 0 occurs
Warning: Rank deficient, rank = 0, tol = NaN.
> In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In dyn_ramsey_static at 67
In evaluate_steady_state at 55
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In MyModel2 at 918
In dynare at 180
Error using print_info (line 80)
The steady state contains NaN or Inf

Error in stoch_simul (line 98)
print_info(info, options_.noprint, options_);

Error in ramsey_policy (line 25)
info = stoch_simul(var_list);

Error in MyModel2 (line 918)
ramsey_policy(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;

I can't figure out what is wrong with equations 1, 5, 47 and 48 and can't really make sense out of the second warning.
Could anyone give me some meaningful input and help me understand what is going wrong?

I have added my .mod file which includes the initial values for the steady state.

Your help will be highly appreciated!

Kind regards,

Nick
Attachments
RamseyGerali.mod
(11.11 KiB) Downloaded 170 times
Nick2382
 
Posts: 5
Joined: Tue Sep 30, 2014 10:46 am

Re: Problem with .mod file

Postby jpfeifer » Tue Sep 30, 2014 1:02 pm

You need to fix your initval-block. You are currently defining variables using other variables that are not set. When you use
Code: Select all
initval;
q_h = mu_qp * (c_p / h_p) ;
end;

h_p is equal to 0 and q_h becomes NaN.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem with .mod file

Postby Nick2382 » Tue Sep 30, 2014 1:22 pm

Thanks Mr. Pfeifer, that helped! However, the following message still pops up:

STEADY: numerical initial values or parameters incompatible with the following equations
47 48

Please check for example
i) if all parameters occurring in these equations are defined
ii) that no division by an endogenous variable initialized to 0 occurs
Warning: Rank deficient, rank = 0, tol = NaN.
> In dyn_ramsey_static>dyn_ramsey_static_1 at 152
In dyn_ramsey_static>@(x)dyn_ramsey_static_1(x,M,options_,oo) at 40
In dyn_ramsey_static at 67
In evaluate_steady_state at 55
In resol at 104
In stoch_simul at 88
In ramsey_policy at 25
In MyModel2 at 918
In dynare at 180
Error using print_info (line 80)
The steady state contains NaN or Inf

Error in stoch_simul (line 98)
print_info(info, options_.noprint, options_);

Error in ramsey_policy (line 25)
info = stoch_simul(var_list);

Error in MyModel2 (line 918)
ramsey_policy(var_list_);

Error in dynare (line 180)
evalin('base',fname) ;

Is there anything else you see that I am not doing correctly?

Thanks a lot!

ps. the updated .mod file is again attached
Attachments
RamseyGerali.mod
(11.12 KiB) Downloaded 134 times
Nick2382
 
Posts: 5
Joined: Tue Sep 30, 2014 10:46 am

Re: Problem with .mod file

Postby jpfeifer » Tue Sep 30, 2014 3:07 pm

Use Matlab to execute the parameter definitions first and then the content of the initval-block. You will see that again you are using variables that have not been defined and are thus initialized to 0. While you try to initialize 11 variables, actually only 2 initial values are different from 0.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem with .mod file

Postby Nick2382 » Wed Oct 01, 2014 9:15 am

Thanks again Mr. Pfeifer. As you might have found out, I am really new to Dynare and Matlab. Could you give me little more hints on how to
get Matlab to execute the parameter definitions first and then the content of the initval-block?
Do you mean that I change the order?
Nick2382
 
Posts: 5
Joined: Tue Sep 30, 2014 10:46 am

Re: Problem with .mod file

Postby jpfeifer » Fri Oct 03, 2014 7:56 am

In Matlab, you can execute any Matlab code statement (the parameter definitions and the content within the initval-block are Matlab compatible code) by selecting it using your mouse and the either right-click and choose "Evaluate selection" or pressing the shortcut F9.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany

Re: Problem with .mod file

Postby Nick2382 » Fri Oct 31, 2014 4:04 pm

Dear all,

Unfortunately the above replies have not been able to help me solve all my problems.
When I evaluate the subsections as suggested, Matlab just gives the equations back to me.?

I have further found out that when the residuals of the static equations have too large values, that equation is not correct.
However, my model still does not run my do not see why unfortunately as the residuals are not unusually large.

Is there anyone who can explain why I am getting this output and how I can find out what is wrong with any of the equations I have specified
in the model block?
I would be forever grateful, really do not have a clue.
Thanks in advance!
Attachments
RamseyGeraliCB.mod
(12.37 KiB) Downloaded 139 times
Nick2382
 
Posts: 5
Joined: Tue Sep 30, 2014 10:46 am

Re: Problem with .mod file

Postby jpfeifer » Fri Oct 31, 2014 7:19 pm

Given the size of your model and the fact that you seem completely lost, there is only one way to proceed: Start from scratch with the easiest version that runs correctly. Then start adding features to the running model. I doubt that you will come up with a correct working mod-file base on the current one (see the problems that follow).

When I use the current UNSTABLE VERSION of Dynare with

Code: Select all
steady(solve_algo=4,maxit=1000) ;


I get:
STEADY-STATE RESULTS:

c_p 0.866073
h_p 0.785376
d_p 1.35341
l_p -0.831045
J_R -36821.1
c_i -1.10531
h_i -1.11244
b_i 3.04482
l_i 0.231078
I -4.74631
q_k 0
c_e -0.756295
k_e 0.0841254
l_pd 0.786642
l_id -0.273808
b_ee 2.23146
y_e 1.09554
d_b 0.470778
b_h 2.12783
b_e 0.606484
r_d -0.122365
r_bh -1.36387
r_be -0.64795
K_b 1.68924
pie 0.200856
x 0.115682
C 0.157377
Y -0.415795
D 0.437117
BE 0.607792
BH 2.12837
B 1.73829
w_p -0.439294
w_i -0.551494
J_B 0.432799
j_B 0.432799
q_h 1.39457
K -1.52744
A_e 0
ee_j 0
m_i 2.79
m_e 2.40985
eps_y 2.18605
Y1 0.106576
vi -0.104199
weight_BH -0.547162
weight_BE -0.805994
u 1.94833


You can use them as initial values, but I doubt that they are the correct steady state values you intended. Moreover, the Blanchard Kahn conditions show three unstable eigenvalues too much, suggesting there is wrong timing. Lastly, your model has a unit root that affects J_R and I am not sure it should be there.
------------
Johannes Pfeifer
University of Cologne
https://sites.google.com/site/pfeiferecon/
jpfeifer
 
Posts: 6940
Joined: Sun Feb 21, 2010 4:02 pm
Location: Cologne, Germany


Return to Dynare help

Who is online

Users browsing this forum: No registered users and 10 guests