renamed csminwel() to csminwel1() to avoid name clash with a different version used in SWZ

time-shift
Michel Juillard 2010-07-28 15:26:56 +02:00
parent abd558930e
commit 61aca0c915
5 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
function [fh,xh,gh,H,itct,fcount,retcodeh] = csminwel(fcn,x0,H0,grad,crit,nit,method,epsilon,varargin)
%[fhat,xhat,ghat,Hhat,itct,fcount,retcodehat] = csminwel(fcn,x0,H0,grad,crit,nit,method,varargin)
function [fh,xh,gh,H,itct,fcount,retcodeh] = csminwel1(fcn,x0,H0,grad,crit,nit,method,epsilon,varargin)
%[fhat,xhat,ghat,Hhat,itct,fcount,retcodehat] = csminwel1(fcn,x0,H0,grad,crit,nit,method,epsilon,varargin)
% fcn: string naming the objective function to be minimized
% x0: initial value of the parameter vector
% H0: initial value for the inverse Hessian. Must be positive definite.
@ -10,7 +10,7 @@ function [fh,xh,gh,H,itct,fcount,retcodeh] = csminwel(fcn,x0,H0,grad,crit,nit,me
% function value by more than crit.
% nit: Maximum number of iterations.
% method: integer scalar, 2, 3 or 5 points formula.
% penalty: scalar double, size of the penality.
% epsilon: scalar double, numerical differentiation increment
% varargin: A list of optional length of additional parameters that get handed off to fcn each
% time it is called.
% Note that if the program ends abnormally, it is possible to retrieve the current x,

View File

@ -429,12 +429,12 @@ if options_.mode_compute > 0 & options_.posterior_mode_estimation
verbose = 2;
if ~options_.dsge_var
[fval,xparam1,grad,hessian_csminwel,itct,fcount,retcodehat] = ...
csminwel('DsgeLikelihood',xparam1,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,gend,data,data_index,number_of_observations,no_more_missing_observations);
csminwel1('DsgeLikelihood',xparam1,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,gend,data,data_index,number_of_observations,no_more_missing_observations);
disp(sprintf('Objective function at mode: %f',fval))
disp(sprintf('Objective function at mode: %f',DsgeLikelihood(xparam1,gend,data,data_index,number_of_observations,no_more_missing_observations)))
else
[fval,xparam1,grad,hessian_csminwel,itct,fcount,retcodehat] = ...
csminwel('DsgeVarLikelihood',xparam1,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,gend);
csminwel1('DsgeVarLikelihood',xparam1,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,gend);
disp(sprintf('Objective function at mode: %f',fval))
disp(sprintf('Objective function at mode: %f',DsgeVarLikelihood(xparam1,gend)))
end

View File

@ -40,7 +40,7 @@ verbose = 2;
gradient_method = 2;
[lpd,xparams,grad,hessian,itct,fcount,retcodehat] = ...
csminwel('minus_logged_prior_density',iparams,H0,[],crit,nit,gradient_method, options_.gradient_epsilon, ...
csminwel1('minus_logged_prior_density',iparams,H0,[],crit,nit,gradient_method, options_.gradient_epsilon, ...
prior_shape, prior_hyperparameter_1, prior_hyperparameter_2, prior_inf_bound, prior_sup_bound);
lpd = -lpd;

View File

@ -95,7 +95,7 @@ crit = 1e-7;
nit = 1000;
verbose = 2;
[f,p]=csminwel('osr_obj',t0,H0,[],crit,nit,options_.gradient_method,options_.gradient_epsilon,i_params,...
[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));
% options = optimset('fminunc');

View File

@ -209,10 +209,10 @@ if options.optimization_routine==1
% Minimization of the objective function.
if nargin==2
[fval,param,grad,hessian_csminwel,itct,fcount,retcodehat] = ...
csminwel('smm_objective',xparam,H0,[],ct,it,2,options_.gradient_epsilon,sample_moments,weighting_matrix,options);
csminwel1('smm_objective',xparam,H0,[],ct,it,2,options_.gradient_epsilon,sample_moments,weighting_matrix,options);
elseif nargin>2
[fval,param,grad,hessian_csminwel,itct,fcount,retcodehat] = ...
csminwel('smm_objective',xparam,H0,[],ct,it,2,options_.gradient_epsilon,sample_moments,weighting_matrix,options,parallel);
csminwel1('smm_objective',xparam,H0,[],ct,it,2,options_.gradient_epsilon,sample_moments,weighting_matrix,options,parallel);
end
elseif options.optimization_routine==2
optim_options = optimset('display','iter','MaxFunEvals',1000000,'MaxIter',6000,'TolFun',1e-4,'TolX',1e-4);