Hi,

I am running Dynare in Julia. Can I use a helper function (written in Julia) in the `steady_state_model`

block to calculate the value of some model parameters?

More context: I have a model that runs perfectly in Dynare-MATLAB. However, even though I am using the exact same `.mod`

file and `.inc`

files in my Dynare-Julia setup, I get the error ``During the resolution of the non-linear system, the evaluation of the following equation(s) resulted in a non-finite number". The pre-processing ends without error.

In the `.inc`

file, I used a MATLAB helper function to calculate some parameters. I have re-written the functions in Julia for my Dynare-Julia setup, since I thought that would be the right thing to do. But when I see the documentation for Dynare-Julia here, it still says `// You can use MATLAB functions which return several arguments`

.

Since I changed nothing else in the `.mod`

or `.inc`

files, I assume the issue lies here.

So, to restate my question: while using Dynare-Julia, can I use helper functions written in Julia in the `steady_state_block`

to set model parameters just as I could use helper function written in MATLAB while using Dynare-MATLAB?

Thanks in advance!

Could you share the code, please

Hi Prof. Juillard - thank you for your response. I have shared the files with you on a direct message here.

To add some context to the files I shared, I suspect the problem lies with how the return values in the Julia version versus MATLAB version are unpacked. `[param1, param2, param3] = param_finder(arg1, arg2)`

works in the MATLAB world since my MATLAB function there returns 3 separate values.

My Julia function however returns a tuple of 3 values. The unpacking syntax would need to be `param1, param2, param3 = param_finder(arg1, arg2)`

. But that syntax is illegal in the `.inc`

file; it ends up throwing an error.

When I re-write the function to return one value at a time, that still doesn’t work, but a different error is thrown. `param1 = param1only_finder(arg1, arg2)`

throws an UndefVarError - it does not recognize the function. Separately, this is very inefficient for my estimation purposes; the three parameters are determined simultaneously, and this re-writing of the function essentially runs the same code 3 times to return the each of those values separately.

Please let me know if anything in the files needs clarification!

Thanks

DynareJulia can´t handle yet such complicated *.mod files

1 Like