Hi Alisa,
l_pos=strmatch('l',var_list_ ,'exact');
would like to find the pos
ition of l
abor 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
:
variance.l(ii)=oo_.var(l_pos,l_pos);
In some cases, I manually find the position of l
in oo_.var
in the workspace/variable window, for example, here the 1st postion:
variance.l(ii)=oo_.var(1,1);
I think this command is also okay. BTW, the latest version of MATAB suggests using “string compare” find(strcmp())
to replace strmatch
“string match”.
Then
variance.l=NaN(1,length(r_pi_vec))
is about looping over parameters, one hot link is
Hi,
I know that this problem was broached on this forum many times since I found some topics connected with it but I didn’t find any solution for my problem.
I want to look at some statistics of variables in the model when some parameters change. The steady state is calculated by hand and included in ‘initval’. For creating the loop over parameters, I used simple syntax like this:
rhos = 0.8:0.05:1.05;
for i=1:length(rhos);
rho = rhos(i);
stoch_simul(order=1);
if info;
disp('Computation fails…
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
set_param_value('r_pi',r_pi_vec(ii));
set_param_value('r_x',r_x_vec(ii));
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.