Page 1 of 1

division by Zero

PostPosted: Tue Oct 27, 2015 12:51 pm
by INTLMACRO
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)

Re: division by Zero

PostPosted: Tue Oct 27, 2015 3:33 pm
by jpfeifer
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.

Re: division by Zero

PostPosted: Tue Oct 27, 2015 4:59 pm
by INTLMACRO
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,

Re: division by Zero

PostPosted: Tue Oct 27, 2015 6:21 pm
by jpfeifer
That is because you have the model_diagnostics command (which tries to compute the steady state) before your initial values.