Simulation error message


#1

Dear Prof.,

I am getting an error message when trying to generate the second moments of model variables. The error originates from the file ‘second_moments.m’. The model which is run to generate the second moments is in ‘cycle_moments.mod’. There are four shocks in the model however, only one of the shocks is active in the attached model as you will see.

The error message is: “Subscript indices must either be real positive integers or logicals.”

Could you please advice me on what the problem is and how to overcome this issue? Please run the ‘run.m’ file in the attached folder to generate the error message. Running this file as it currently is will run cycle_moments.mod and second_moments mentioned above.

Many thanks in advance.

Fiscal_shocks_2nd_moments.zip (1.1 MB)


#2

You are using the line

    stdyy(:,s_index)   = std(hplogYt);

But std was used as a variable name, while you are now trying to call Matlab’s function for the computing the standard deviation. That cannot work. Rename your variable.


#3

Many thanks Prof. Pfeifer.