Weird stoch_simul

I am trying to understand this code:
What is it exactly doing? it is similar to the github for gali chapter 4
Thanks in advance!

stoch_simul(order=1,irf=0,noprint) l y x pi de s;
l_pos=strmatch(‘l’,var_list_ ,‘exact’);
[info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list_)
;welf_PEG.mod (8.3 KB)

Hi Alisa,

l_pos=strmatch('l',var_list_ ,'exact');

would like to find the position of labor in the var_list_, after we run

stoch_simul(order=1,irf=0,noprint) l y x pi de s;

such that in line 202, dynare will return the variance of l :


In some cases, I manually find the position of l in oo_.var in the workspace/variable window, for example, here the 1st postion:


I think this command is also okay. BTW, the latest version of MATAB suggests using “string compare” find(strcmp()) to replace strmatch “string match”.



is about looping over parameters, one hot link is

Note line 182-183:

r_pi_vec=[1.5   1.5 5 1.5];
r_x_vec =[0.125 0   0 1  ];

They seem to be four alternative regimes. Each time, we assign new values to


r_pi is one-to-one to r_x. The whole loop will be executed 4 times in all.

    [info, oo_, options_] = stoch_simul(M_, options_, oo_, var_list_); %loop over stoch_simul
    if ~info(1)
        %read out current parameter values

If info number is not 1 (error), after running stoch_simul, oo_ and options_ will be updated.

My explanation may contain (many) errors. Please read it with caution.

1 Like