Dear all,

I am struggling with implementing loop over parameters in the new version of Dynare (I’m running 5.1).

I have written a plain vanilla RBC .mod file, which by hand runs for a range of a certain parameter.

When I try to write an .m file looping over this same range, I cannot get any results.

I hope there is an easy fix for an issue that I’m overlooking as I’m still getting used to the new syntax.

Thank you!

RBC266.mod (2.5 KB)

RBCParameterLoop.m (781 Bytes)

I am getting an error about steady state computations. You may need to analytically compute the steady state.

Of course. Here are the two updated files. By itself, the RBC266Analytical.mod file runs for the lower and upper ranges of betta (0.8 and 0.98) over which I am trying to loop, but I cannot get the loop file to run.

Thank you!

RBC266Analytical.mod (2.9 KB)

RBCParameterLoop.m (791 Bytes)

Thank you so much, the loop runs now!

For future reference, is it true that the only way to be able to run a loop over parameters is to have an analytical model solution in a _steadystate.m file? The reason I’m asking is that I am working on a much larger model where the only way to get a solution is to use fsolve on a subsystem of the model equations, which I cannot possibly solve by hand. It seems that I cannot call on fsolve from within _steadystate.m file.

- No, loops do not require analytical steady states, but loops often requires updating the initial values, which you did not do. Hence the problem.
- You can use
`fsolve`

in a`_steadystate.m`

-file. That’s the main purpose of those files.

Got it, thank you for taking time to clarify the issue. For the sake of conversation completeness, and for anyone else reading it, here’s the other option (without _steadystate.m). In my .mod file, after the model and shocks blocks, I used

steady_state_model

analytical expressions for each endogenous variable

end

Then I was able to use an external .m file with a loop over parameters as attached above.

P.S. the reason for the hassle is that I am trying to teach a basic RBC model and its solution in Dynare in an undergraduate course, and the fewer files I need to explain, the better (I think).