Fitting starts with starting parameter values taken randomly from 'Monte-Carlo ranges' specified for each parameter. The X and Y data are also perturbed with random noise (see below). If fitting run finishes with one of the parameters hitting its bound (absolute limit) the user has a choice to ignore such results and not include them in determination of confidence intervals. Set exclide_results_at_limits=1 to use only the runs with best-fit parameter values not at the limits. It is recommended to first run your fitting procedure with exclide_results_at_limits=0 so to see the general outcome of fitting. Your data may not be able to support a defined value of some paqrameter and you will see it that this parameter ends up at the absolute limits (bounds) too many times. The solution to this problem is to fix this parameter at some value and not to fit it. Setting exclide_results_at_limits to 1 is intermediate solution, when fitting of randomized datasets is barely stable, and therefore this is a potentially dangerous setting because it may bias your fitting results if exclide_results_at_limits=0 run has not been performed for comparison. In other words, exclide_results_at_limits=1 is a cosmetic measure to help determination of confidence intervals of main distribution of fitting results in presence of some number of outliers at the limits.

The ignore_nonconvergence_flag option also helps to filter fitting results by looking at the exitflag of a fitting routine. See description of exitflags in MATLAB documentation for fminsearch (simplex algorithm), fmincon (Newton-active-set and Newton-interior-point algorithm).

All parameters from converged fitting runs regardless of the exclide_results_at_limits switch described above are stored in all_raw_starting_parameters, all_raw_final_parameters, all_raw_SS (sum of squares/N) and all_raw_exitflags. Accordingly, parameters that were selected for determination of confidence intervals are stored in all_filtered_starting_parameters, all_filtered_final_parameters, all_filtered_SS and all_filtered_exitflags. They will be both shown on correlation plots for user to appreciate real outcome of the fitting session.

Additional filtering of fitting results is performed by looking at the sum of squares from the fits. Generally, the SS from best fits of the simulated datasets should be comparable to the SS from fitting of experimental data (indicating that the noise sources are accurately accounted for). If SS from simulated runs is much higher - it means that the fitting procedure is trapped in some local minimum far from real solution (the case for 'heely' functions such as NMR line shapes). One directs the fitting routine to disregard results of such runs by setting a not_exceed_SS_times values, which is a multiplier for a best-fit SS from experimental data fitting. Say, if we set not_exceed_SS_times=2 then all fitting runs with SS(simulated) > 2*SS(experimental) will not be used in calculation of confidence intervals. To turn off this type of filtering you simply set not_exceed_SS_times=0.

Confidence intervals for fitting parameters may be recalculated at any time after the Monte-Carlo runs are finished using commpute_confidence_intervals() method. To control its operation you will set the flags described above.

For a specific usage see TotalFit.m