# The Jacobian or the dynamic model contains Inf?

I get the following the error message when I run my code:
“The Jacobian or the dynamic model contains Inf. For more information, use options_.debug” Then when I use 'options_.debug" I get ans=0. I am not sure what’s going on. Can anyone help?
I checked my equations for mistakes (many times) and I am pretty confident they are all correct. And the steady state is well defined.

I get

[quote]STOCHASTIC_SOLVER: The Jacobian of the dynamic model contains Inf. The problem is associated with:

Derivative of Equation 17 with respect to lag of Variable Ai (initial value of Ai: 0)
Derivative of Equation 23 with respect to lag of Variable Ai (initial value of Ai: 0) [/quote]

You are dividing by Ai, which has steady state 0, but it is not in exp in some equations, resulting in a division by 0.

Thank you! I rewrite my equations and still made those mistake.
One last quick question: I know that changes in variables have to be over a certain threshold for dynare to display their IRF, how and where can I change that? Thanks in advance.

Cheers,

See the manual on

``irf_plot_threshold``

Thank you very much.

Dear professor, I meet the same error. but I do not know the mistakes about my codes. Could you help me~
nk.mod (6.7 KB)
nkss.m (1.1 KB)

The process for your exogenous variables is wrong:

``````Derivative of Equation 31 with respect to lag of Variable Al  (initial value of Al: 0)
Derivative of Equation 34 with respect to lag of Variable upsilon  (initial value of upsilon: 0)
``````

For example, `Al` is already in logs, so

``````Al = Al_star^(1-rhoal) *Al(-1)^rhoal   *exp(sigmaal*eal);
``````

will not work, because it assumes it to be in levels.

Dear professor, I fixed it but now Monetary policy shocks account for 99% of variance decomposition, I did not change others, how can i do
nk.mod (7.0 KB)
nkss.m (1.1 KB)

Why have all your shocks variance 1?

Dear professor, I fixed it. But now I meet another problem. I am so sorry to trouble you again. Error: I got Log data density [Laplace approximation] is NaN.
When I deleted the Invest and consume ,I got Log data density [Laplace approximation] is NaN.how can i do~

data.xlsx (17.6 KB)
nk.mod (7.7 KB)
nkss.m (1.1 KB)

2. Your observation equations are wrong. Your are matching mean 0 data to level variables still containing the steady state.

Thank you Professor, So How should I set the observation equation to match my model? I did not found answer in ”A Guide to Specifying Observation Equations for the Estimation of DSGE Models" I am so sorry.

Most probably, you simply need to demean your data, but without more information on what you did in your data, it is impossible to tell.

I previously filtered the data by HP. So now I just need to log the original data and then remove the mean, without any other operations

1. The HP-filter should result in demeaned data. But it’s not in your case, which begs the question what went wrong.
2. Using two-sided HP filtered data for estimation is problematic.
3. You are supposed to log the data before filtering.

professor，It is still wrong. I took the logarithm of the raw data and then did one-side HP filtering。

Without the files it is impossible to tell.