Index exceeds matrix dimensions for discretion

Hi everyone,
I’m doing a discretionary policy for simple small open economy model by Galli and Monacelli (2005). As I do this policy I only let productivity shock to happen out of several other shocks.

But as I run the mod file, it shows this error.

Index exceeds matrix dimensions.

Error in resid (line 101)
        if abs(z(i)) < options_.dynatol.f/100

Error in discretion (line 251)

Error in dynare (line 235)
evalin('base',fname) ;

What can I do to erase it? And also can I let all the other shocks simultaneously to happen or not while doing discretion? Here is also the mod file.
Thank you so much.

discretion.mod (3.4 KB)

With discretionary_policy, you cannot call resid and steady before solving the model. The reason is that the model is underdetermined when not yet knowing the value of the instrument.

1 Like

Thank you so much, Professor Pfeifer, it worked.