Dynare code errors that include two cases

Hello, dears.

I am a dynare beginner, replicating the iacoviello (2005) study. I want to include both cases of non-indexed debt and indexed debt in one mod file, but I am getting an error. Let me briefly explain the approach I took.

  1. added ‘indexed’ to parameters.
  2. added ‘indexed = 0’ to the last line of the set_param_value part. (The reason we didn’t specify it as set_param_value is because the file we loaded, ‘iaco_param_base_nonlin’, doesn’t have ‘indexed’).
  3. used @#if conditional in equation in model.
  4. specifying ‘indexed=0’ in initval
    iacoviello_2005_2case.mod (3.5 KB)

I’d like to know not only why I keep getting the error, but also how MATLAB is able to show these two cases simultaneously in one graph.

Thank you in advance for your help. Have a good day!

That is not the proper way to proceed. Use a command line macro switch for the two cases. An example would be line 28 in

Thank you for your response!

However, I didn’t quite understand where to start and how to apply it to the code I have, so if you don’t mind, could you give me a little more detail? I’ve removed all the conditional statements from the file I originally attached and reattached the code in its default state.
iacoviello_2005_base_nonlin.mod (3.2 KB)
Figure2_oo.m (1.9 KB)
What I want to do is to firstly write a conditional statement in dynare for when it is indexed debt and when it is not, for example, in equation (3) in dynare, the infl(+1) term should not be there when it is indexed debt and it should be there when it is not.
And in MATLAB, it’s about graphing both situations at the same time.

Thank you in advance for your kind guidance.

You would use something like
iacoviello_2005_2case.mod (3.5 KB)
and call it from Matlab with either

dynare iacoviello_2005_2case -Dindexed=false

or

dynare iacoviello_2005_2case -Dindexed=true
1 Like

Thanks to you, I have solved the problem.
Thank you for your kind response all the way.

Have a great day!