Hello professor, if you can give me some advice or tips on the problems

While i am adding a couple of variables and shocks to
Professor Iacoviello and Neri(2009 codes from their homepage)
running codes using dynare/Matlab, i ran into error messages below.

I attach my codes and data and codes in a word file where red letters are what i am trying to add to
the original Professor Iacoviello and Neri(2009) codes.

if you could spare me time to look in to the codes and give me some guidelines it will be much appreciated.

Thank you.

Cho young tak (s. Korea)

Residuals of the static equations:

Equation number 1 : NaN
Equation number 2 : NaN
Equation number 3 : NaN
Equation number 4 : NaN
Equation number 5 : NaN
Equation number 6 : NaN
Equation number 7 : NaN
Equation number 8 : NaN
Equation number 9 : NaN
Equation number 10 : NaN
Equation number 11 : NaN
Equation number 12 : NaN
Equation number 13 : NaN
Equation number 14 : NaN
Equation number 15 : NaN
Equation number 16 : NaN
Equation number 17 : NaN
Equation number 18 : NaN
Equation number 19 : NaN
Equation number 20 : NaN
Equation number 21 : NaN
Equation number 22 : NaN
Equation number 23 : NaN
Equation number 24 : NaN
Equation number 25 : NaN
Equation number 26 : NaN
Equation number 27 : NaN
Equation number 28 : NaN
Equation number 29 : NaN
Equation number 30 : NaN
Equation number 31 : NaN
Equation number 32 : NaN
Equation number 33 : NaN
Equation number 34 : NaN
Equation number 35 : NaN
Equation number 36 : NaN
Equation number 37 : NaN
Equation number 38 : NaN
Equation number 39 : NaN
Equation number 40 : NaN
Equation number 41 : NaN
Equation number 42 : NaN
Equation number 43 : NaN
Equation number 44 : NaN
Equation number 45 : NaN
Equation number 46 : NaN
Equation number 47 : NaN
Equation number 48 : NaN
Equation number 49 : NaN
Equation number 50 : NaN
Equation number 51 : NaN
Equation number 52 : NaN
Equation number 53 : NaN
Equation number 54 : NaN
Equation number 55 : NaN
Equation number 56 : NaN
Equation number 57 : NaN

다음 사용 중 오류가 발생함: print_info (line 90)
The steady state contains NaN or Inf
오류 발생: steady (line 104)
print_info(info,options_.noprint, options_);
오류 발생: jules2 (line 577)
오류 발생: dynare (line 223)
evalin(‘base’,fname) ;
code1.zip (9.7 KB)
code_cho youngtak.zip (31.5 KB)

I do not have time to open a word file (you could put comments in a mod file instead of using colours)… But a possible explanation for this error message is that you forgot to calibrate some of the parameters (default value for parameters is NaN).


If you put resid before steady, you will see that

Equation number 49 : -Inf

This suggests that there is a problem with that equation and its initial value,

Thank you professor Stephane and professor jpfeifer

I am posting my latest mod and data file so that you could take a look quick.

and here are my questions

  1. regarding the messsage of

“Equation number 49 : -Inf”,

Is there ant way to find the variable or data to which the equation number 49 is referring ?

In that way i can look at the specific equation or variable causing the problem so i could try to

I have 57 equations front part of the file, and many others in the back, now I have no idea which equation
is #49.

  1. If I can locate the equation or the part of the problem, do I nee to look at the structure of the equation?

    or parameters not calibrated or not given initial value?

basically, since Nan suggests that the steady state value is not a number, Iam trying to find out a general

  1. I added only education data consisting of

4 variables: ed ed1, ued, ued1
1 data series : data_EP
1 shock : a_ee

to the original Iacoviello and Neri(2009)
and it doesn’t work out.

Thank you again for your quick response
and without this wonderful forum, I would have changed the subject already.

Thank you very muchjules3.mod (18.3 KB)
ROK_data_96Q116Q4.m (12.2 KB)

You have to count the equations in the model block… Starting from the end will be faster, since you only have 57 equations. The easiest way to count the equations is to count the semicolons, since each equations must be ended with a semicolon. Generally to avoid this I attach tags to the equations. Something like:


[name = 'Budget constraint']
c + k = k^theta*A;

[name = 'Euler condition']
beta*(c(1)/c)^(-sigma)*theta*k^(theta-1)*A(1) = 1;

[name = 'Specification of shocks']
log(A) = rho*log(A(-1))  + epsilon;


If you do that, the output of the resid command will use the tags to index the equations, so it’s easier to identify the culprits. Then you will have to check the initialization of the parameters in the equation and/or that the expressions in the equations are defined if the endogenous variables are 0 (which is the default initial guess of the Newton algorithm used to solve for the steady state).


thank you enormous professor Stéphane

Never expected to receive an answer less than 30 minutes.

I located equations they were mostly related with data equations.

and tried some trial and errors.

when i removed variables like CC_SS, …

Nan messages disappeared and Dynare got me IRFs and variance decomposition.

A huge step forward but still getting error messages


“very low acceptance rate” and the program does not stop,

still not getting posteriors.

So I am going to look more to find the reason why

CC_SS and other seemingly other steady state values were not numbers.

I think I need more time to get ready for questions,

Again I thank you for your time, thank you…

Cho, Young tak

Hello professor Stéphane and processor Pfeifer

With your great help, I managed to get IRFs but I get caught up with

with errors in estimation stage.

with mode_compute=9, I got error messages below

prior mean mode s.d. prior pstdev

ALPHA 0.650 0.7970 NaN beta 0.0500
EC 0.500 0.3117 NaN beta 0.0750

standard deviation of shocks
prior mean mode s.d. prior pstdev

eps_c 0.001 0.0100 NaN invg 0.0100
eps_e 0.001 0.0032 NaN invg 0.0100

Log data density [Laplace approximation] is NaN.

다음 사용 중 오류가 발생함: chol
…positive definite…
오류 발생: posterior_sampler_initialization (line 84)
d = chol(vv);
오류 발생: posterior_sampler (line 60)
posterior_sampler_initialization(TargetFun, xparam1, vv,
오류 발생: dynare_estimation_1 (line 447)
오류 발생: dynare_estimation (line 105)
오류 발생: jules3 (line 666)
오류 발생: dynare (line 223)
evalin(‘base’,fname) ;

also attached mode check plots with several red dotted severed ranges.

In order to have posteriors here are my questions

  1. Do I need to change mode compute?

    I tried 6,7,9 compute mode but it dint work out.

  2. Need to change priors??

for example, in Figure 7, ALPHA have several severed area and red dots.

Do I need to set prior mode smaller than 0.8 or move toward 1?

How can I check that the priors are inside the appropriate bounds? where do I need to look and

question 20170920.zip (304.4 KB)

what else need to be done?

  1. Other than 1,2 any other suggestions to find causes of the errors??

    For example, equation problems.

*attached: mod file, data file and mode check graphs.

Forgive me for taking your busy time and

again appreciate your kind help.

Thank you

Cho, Young Tak

You need to fix your data. Some of the variables have a strong seasonal pattern. Some of the variables have trends while others do not. Also, the mean of the data seems to be very different from the observed variables in the model. That is particularly true for data_EP

Thank you professor.

"The mean of the observed variables in the model "

Is it referred to the prior or calibrated parameter

or any other part of the model related with

Education purchase cost (EP)?

Which I need to compare it with the mean of EP

Sorry to ask you another basic question

Best regards

Cho, young tak

If you take your calibrated parameters together with the prior mean of the estimated parameters and compute the steady state, you will see that the steady state of data_EP in the model is very different from the one mean of the corresponding data.

I understand your explanation

I will try more options

Thank you

Cho youngtak

Hello Professor Pfeifer.

As for previous suggestions I tried to make some experiments.

  1. De seasonalized(hp filtered with EVIEWS) and de trended(1 lag diferrenced in EXCEL) data I used but still I have error messages.

    the data set was log and demean transformed from the very beginning.

Log data density [Laplace approximation] is NaN.

Error using chol
Matrix must be positive definite with real diagona
20170925 question.zip (181.5 KB)

  1. On " the mean of the data seems to be very different from the observed variables in the model(state of data_EP)"

After I averaged the “EP” data which was “0.00128”,

where do I have to look in order to find state of data_EP?

Since “EP_SS” means steady state of EP, I went from there backward.


(1) # EP_SS = log(llep) ;

(2) # llep = llEPIY*llY / llI ;

(3) # llEPIY = llZETA4llCY + llZETA5llCYPRIME ;

And so on. but it seems com[liicated and looks not possible to get it manually.

Could you explain specifically how to find “the steady state of data_EP” and “the mean of the corresponding data”

  1. If I found the gap between two data, what do I need to do?

I am so sorry again to come up with another basic question.

Lastly, here are my mod file and data file