Hi Prof. Pfeifer,
I have a flexible price open economy DSGE model that I want to transform to include price stickness and monetary policy. After adjusting the model equations, I get the following error: Floating point error in bytecode: a/X with X=0.
Could you please help me understand the cause for the error and how to debug.
Here is the original code:
Equations_orig.mod (13.0 KB)
and here is the modified version with sticky price and monetary policy:
Equations_modified.mod (16.5 KB).
Thank you for your help
You did only provide the model equations, not a full code that can be run.
With that zip file, what do I need to do to generate the error message?
The full message was
Floating point error in bytecode: a/X with X=0
equation 3792
residual(3792) = (pi_ppi_1_a_t / pi_ppi_2_a_t) - ((PC_1_a_t / PC_2_a_t) * (PC_2_a_t / PC_1_a_t))
You can verify that the initial value for pi_ppi_2_a_t
is 0, resulting in the division by 0.
In Dynare with the attached files, you will not get a crash, but a message that the steady state could not be found:
NK Model_6.zip (2.1 MB)
- That message should not appear in Dynare 6. Are you sure you correctly switched the version?
- For a model that size, I can only recommend to either simplify or compute the steady state analytically. That would also provide an important cross-check between equations and steady state.
Which Dynare version are you using? I am getting
ERROR: Vars_params.mod: line 13, col 11: syntax error, unexpected '['
because it should be 1:sector
in the loops instead of [1:sector]
. Please try to use the most recent Dynare version as many issues in the bytcode implementation were fixed over time.
Please try Dynare 6.3. Dynare 5 is still too old.
Hi Professor, I was able to run it on dynare 6.1 which is the latest version that I can access from the server I’m using. I got the following error:
and the MODEL_DIAGNOSTICS indicate that The Jacobian of the static model is singular. Here is the message from model diagnostics:
Could you please help me identify the redundant/missing equations? thanks.
I cannot replicate the message. I always get a message that the steady state cannot be computed. For the last error message, that is a bug. You can use the fix at
Thanks Professor. I’m having difficulty finding the steady state. I saw at some point that a steady state was calculated and I used that at initval, thinking this would solve the issue. The issue is that The residuals for some variables like sectoral nfa and output is not close zero. Please check the SS.mod file, you will see that I just used a fix value for total trade balance (TB) because to calculate it using an equation results in circular reference. I have total C=Y-I-TB and total C is used to calculate sectoral C which is then used to determine sectoral TB and total TB is normally the sum of sectoral TB. Also total Y comes from the IO table while sectoral Y is calculated using the previously calculated sectoral C, I and TB. Could you please help me fix this ? Is there a better way to compute the steady state of these variables? Thanks
What you describe sounds like a simultaneous equation system. Often that requires a solver. You need to work on this. Given the size of your model, I am not confident that numerical root finding on the whole model will work.
Could please provide some guidance on how to address this? What solver can I use?
You can e.g. use fsolve
once you have found a good strategy for approaching the problem. That is the hard part: reducing the model to a few equations you can solve that way.