Sorry for arising this old post again, but I would like to see how the standard deviations of two variables in my model change in response of different shock magnitudes.
I thought of adding a loop for the standard error of my credit shock (specified in line 129 of the code). I read this post, but I don’t understand how to do it (I do not know how to put your addendum at play)…
I should recover and save two values of oo_.var for every running of the loop.
Could you help me, please?
This is the mod file:
dyn_main.mod (8.1 KB)
You could try
% Declare model name.
% Call model.
% Shock of interest (make shock name as character type)
% Find position in declaration of exogenous variables.
% get variable positions in variable list.
SIGM_grid = 0.1:0.025:0.5; % Size of shock.
% Storage matrix.
% Start counter.
% Start loop.
for ii = 1:length(SIGM_grid)
% Assign variance to the correct diagonal element in the
% variance-covariance matrix.
M_.Sigma_e(eps_pos,eps_pos) = SIGM_grid(ii);
info=stoch_simul(var_list_); % loop over stoch_simul.
if info == 0
%read out variances.
% Next iteration.
When you invoke the solver, I suggest you set
irf=0 and specify
Thank you so much for your help.
I’m trying to apply it… So far, I get an error when I use the code you wrote: “shockloop.mod: line 52, col 3 - line 53, col 0: syntax error, unexpected $end”
I don’t see any missing “end”.
Please provide the mod-file
shock_loop.mod (1.7 KB)
Sorry, I did not receive a notification of your message and did not recheck until today…
Here you have the mod-file (based on cmarch help) and all the files of my code. The running file is “dyn_table.m” and “dyn_main.mod” is the main file with the model.
Thank you so much!
dyn_main.mod (8.3 KB) dyn_extract.m (1.3 KB) dyn_main_steadystate.m (955 Bytes) dyn_stats.m (2.1 KB) dyn_table.m (3.8 KB) findss.m (503 Bytes) stst.m (1.9 KB)
@asha1 But what is the problem? Your codes runs on my machine without error.
I wanted to get a grid of values for my shock variance, but I do not manage to make shock_loop.mod run. I get the error “syntax error, unexpected $end”.
Then please provide the file that creates this problem.
I did upload it in my previous message… it is called shock_loop.mod. If you run it, it gives the error I mentioned.
Thank you so much.
Your mod-file is not a proper mod-file. It contains only Matlab-code, but then does not use Matlab-conform comments.