Fix bug in osr where moments were not based on optimal parameter draw

M_.params is global and was set by csminwel1 to the last value tested; this does not necessarily coincide with the optimal parameter vector, which may have occurred earlier. This commit explicitly sets the optimal parameter vector.
time-shift
Johannes Pfeifer 2014-11-03 18:01:04 +01:00
parent 7b1663281b
commit 669016167e
1 changed files with 1 additions and 0 deletions

View File

@ -97,6 +97,7 @@ end
[f,p]=csminwel1('osr_obj',t0,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,i_params,...
inv_order_var(i_var),weights(i_var,i_var));
osr_res.objective_function = f;
M_.params(i_params)=p; %make sure optimal parameters are set (and not the last draw used in csminwel)
for i=1:length(i_params)
osr_res.optim_params.(deblank(M_.param_names(i_params(i),:))) = p(i);
end