Skip to content

Minor bugfix release

Pre-release
Pre-release

Choose a tag to compare

@nul0m nul0m released this 03 Jul 17:23

This release applies a temporary fix allowing for a simple custom optimizer when estimating model parameters.

The default use of the model/estimate() routine depends on the function fminunc (or fmincon) from the Matlab® Optimization Toolbox, but one may supply its own solver instead, by means of 'optimizer' option.

The example of such a custom optimizer function could be:

optimizer = @(F,P0,PLow,PHigh,OptimSet) ...
                   fminsearch(@(X) F(X)+chkbnd(X,PLow,PHigh),P0,opts);

where chkbnd.m looks like this:

function res = chkbnd(x,low,high)

if any(x < low) || any(x > high)
  res = inf;
else
  res = 0;
end

and opts is a standard "optimization settings" variable, e.g.:

opts = optimset('MaxIter',8000,'MaxFunEvals',8000,'tolFun',1e-1,...
    'display','iter');

In that case model/estimate() will work when called the following way:

[Pstar,obj,grad] = estimate(m,dd,sdate:edate,E,'initVal=','model',...
    'noSolution=','penalty','tolx=',1e-12,'optimiser',optimizer);