Preprocessing failed error

Dear all,
Thank you for help in advance! I really appreciate it. I run the attached dynare code with matlab but it shows that,

[code]This application has requested the Runtime to terminate it in an unusual way.
Please contact the application’s support team for more information.

Error using dynare (line 168)
DYNARE: preprocessing failed[/code]

Could anyone please tell me if there’s something wrong with my dynare code, or with the matlab software?

Thanks!
benchmark.mod (1.9 KB)

This is a bug in the Dynare preprocessor related to the external function you are using in the initval-block. We will get back to you. Thanks for reporting this.

Thank you. I also attached the external functions used in my dynare code for your reference. Looking forward to your reply!

find_para.m (1.84 KB)
fun_ss.m (4.69 KB)
calibration.m (1.76 KB)

The problem is that the preprocessor thinks that par is the name of a MATLAB function, because of the par(1) call. Then it crashes because using a function as an argument of fun_ss is not authorized. In the future, Dynare will provide a more explicit error message of the type

You could avoid this by putting the whole par-part into a verbatim-block:

verbatim; [par1 target]=calibration; par2=fsolve(@(x) find_para([par1 x(1) x(2)],target),[0.1,5]);//compute calibrated parameters to target steady state values par=[par1 par2];//par=[delta, eta, alpha, psi, A,z,r_star,tau_f_star,tau_star,tau,theta,phi,sigma,Psi] delta=par(1); eta=par(2); alpha=par(3); psi=par(4); A=par(5); z=par(6); r_star=par(7); tau_f_star=par(8); tau_star=par(9); tau=par(10); theta=par(11); phi=par(12); sigma=par(13); Psi=par(14); end;
That way, par is hidden from Dynare and does not create confusion.

But this brings us to the next issue. You cannot use arbitrary auxiliary variables (F here) in the initval-block. Given that you want to use a function call in every interation to set an auxiliary variable, I am afraid you must use an explicit steady state-file.

Thank you for your reply. I now used the verbatim-block and used the steady-state-model block. However, when I run the dynare file, it says that

[quote]Warning: Some of the parameters have no value (delta, eta, alpha, psi, A, z, r_star,
tau_f_star, tau_star, tau, theta, phi, sigma, Psi) when using steady. If these
parameters are not initialized in a steadystate file, Dynare may not be able to solve
the model… [/quote]

It seems the parameter values specified in the verbatim-block is not identified in the stead-state-model block. How can I solve this problem? please see attached as the updated dynare codes and functions.

Thanks a lot.

[quote=“jpfeifer”]The problem is that the preprocessor thinks that par is the name of a MATLAB function, because of the par(1) call. Then it crashes because using a function as an argument of fun_ss is not authorized. In the future, Dynare will provide a more explicit error message of the type

You could avoid this by putting the whole par-part into a verbatim-block:

verbatim; [par1 target]=calibration; par2=fsolve(@(x) find_para([par1 x(1) x(2)],target),[0.1,5]);//compute calibrated parameters to target steady state values par=[par1 par2];//par=[delta, eta, alpha, psi, A,z,r_star,tau_f_star,tau_star,tau,theta,phi,sigma,Psi] delta=par(1); eta=par(2); alpha=par(3); psi=par(4); A=par(5); z=par(6); r_star=par(7); tau_f_star=par(8); tau_star=par(9); tau=par(10); theta=par(11); phi=par(12); sigma=par(13); Psi=par(14); end;
That way, par is hidden from Dynare and does not create confusion.

But this brings us to the next issue. You cannot use arbitrary auxiliary variables (F here) in the initval-block. Given that you want to use a function call in every interation to set an auxiliary variable, I am afraid you must use an explicit steady state-file.[/quote]

fun_ss_dynare.m (4.64 KB)
find_para.m (1.84 KB)
calibration.m (1.76 KB)
benchmark.mod (1.83 KB)

Try working with the attached file
benchmark.mod (1.81 KB)