with certain option montages, the calculated value for the alphas is ending up NaN. this in turn is causing strange optimization behavior. most of the time the optimizer does not crash, however the warnings are continuously presented. on occasion the calibration routine halts completely. i have attempted a numerical analysis on the data but have had no luck so far.
the following code + workspace zip file will replicate the warning:
xoptP = lsqnonlin(@(x) Heston1993KahlJaeckelLordRev3(PC+1, S,K,T,t,r,q,x(1),x(2),x(3),x(4),x(5)) - MarketPrice(:,2),...
startparameters, ... %start values
... % v0,theta,rho,kappa,sigma
[ eps eps -1+eps eps eps ], ... % lower bound for parameter vector
[ 100 100 +1-eps 100 100 ], ... % upper bound for parameter vector
options);
optimizer status:
Iteration Func-count f(x) step optimality
0 6 836.793 1.1e+05
1 12 183.198 0.0511948 3.27e+04
2 18 19.5157 0.0481355 3.69e+03
3 24 13.8879 0.218201 2.43e+03
4 30 13.8879 0.418154 2.43e+03
5 36 8.22993 0.104539 434
6 42 4.2232 0.209077 124
7 48 1.37073 0.311223 53.4
8 54 0.827855 0.3201 41
9 60 0.53483 0.268784 27
10 66 0.278322 0.255432 10.2
Exiting fzero: aborting search for an interval containing a sign change
because NaN or Inf function value encountered during search.
(Function value at 1.71 is -Inf.)
Check function or try again with a different starting value.
349 warning(message('MATLAB:integral:NonFiniteValue'));
alpha_warnings.zip