Hi Prof. Jpfeifer,
Given your code, I write my code to do grid search as:
dynare housing.mod
rho_pi_grid = 1.001:0.1:3;
rho_y_grid = 0:0.1:1;
welfare_pos=strmatch(‘v’,var_list_,‘exact’);
results_cell = zeros(length(rho_pi_grid),length(rho_y_grid));
for i = 1:length(rho_pi_grid)
for j = 1:length(rho_y_grid)
set_param_value('rho_pi',rho_pi_grid(i));
set_param_value('rho_y',rho_y_grid(j));
info = stoch_simul(var_list_);
if info ==0
results_cell(i,j) = oo_.mean(welfare_pos);
else
fprintf('Here is an error!\n');
end
end
end
I think the difference is that I have two parameters which need to be optimized. However, I have the error message:
Assignment has more non-singleton rhs dimensions than non-singleton subscripts
Could you please help me check where the problem is? Thank you !