division by Zero

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.

division by Zero

Postby INTLMACRO » Tue Oct 27, 2015 12:51 pm

Dear all,
I am trying to solve a two-country model using Deverux and Sutherland method of portfolio choice.
However, I am having problems with the steady-state. I have solved the SS by hand and introduced the analytical solution with steady_state_model command and it yields:ERROR: Division by zero!
Also, I have used MatLab to solve it, and I`ve use the numerical solution using initval command, yielding the very same error.
Any help would be appreciated,
Thanks in advance,

EDIT: FILES WERE REMOVED SINCE PROBLEM HAS BEEN SOLVED.( 03/11/2015)
Last edited by INTLMACRO on Tue Nov 03, 2015 12:41 pm, edited 1 time in total.
INTLMACRO
 
Posts: 5
Joined: Tue Oct 20, 2015 3:17 pm

Re: division by Zero

Postby jpfeifer » Tue Oct 27, 2015 3:33 pm

First of all, your numbering is wrong. When you get
Code: Select all
ERROR: Division by zero!
...division by zero error encountred when converting equation 29 to static

equation 29 is actually the equation you number 30. This one reads
Code: Select all
exp(rb1)=i1/(CPI(+1)-CPI);                                                               

Here, it is obivous that in steady state the denominator evaluates to 0, which is the source of the error message. It seems you are confusing logs and levels.
------------
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: division by Zero

Postby INTLMACRO » Tue Oct 27, 2015 4:59 pm

Thanks for your quick response.
Yes, there was a mistake, now I have changed the equation 29 with the following one
Code: Select all
i1=(1/exp(Z3))-1; 

so that there is no zero in the denominator.
However, I find that the Jacobian contains Inf or NaN. It says that the problem arises when doing the derivatives w.r.t. the different variables. It says that the initial value of each var is= 0, BUT I have written an initval with non-zero values ( calculated with MatLab), as you can see in the attached code. Is not taken into account the initial values I already gave?
Also, what command do you use to see how dynare numbers the equations?

Thanks again,
Last edited by INTLMACRO on Tue Nov 03, 2015 12:41 pm, edited 1 time in total.
INTLMACRO
 
Posts: 5
Joined: Tue Oct 20, 2015 3:17 pm

Re: division by Zero

Postby jpfeifer » Tue Oct 27, 2015 6:21 pm

That is because you have the model_diagnostics command (which tries to compute the steady state) before your initial values.
------------
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: Google [Bot] and 12 guests