I am using NonlinearModelFit for fitting a dataset to some complex numerical model function that depends on a few parameters. The final required precision of these parameters is very low, like 3 digits. The precision of data points is float, meaning 7-8 digits. The same is true for model function and it specifically returns the real number with precision set to 7 digits.

I try to tell this all to Mathematica with the call:

NonlinearModelFit[SetPrecision[points, 7], model[M, x, A, B], {M, A, B}, x, AccuracyGoal -> 3, PrecisionGoal -> 3, WorkingPrecision -> 7];

Nevertheless, NonlinearModelFit is trying a lot of different candidates for values of parameters, with very small step size, e.g. ~10^-10, which is lower than 10^-7. Since the model function is slow, I would like to avoid these unnecessary calls.

Is there any additional setting that would limit the minimum step size of NonlinearModelFit during a search for Best Fit Parameter values?

  • $\begingroup$ Have you solved this problem? I've got the same question. $\endgroup$
    – K.J.
    Sep 13, 2018 at 11:34
  • $\begingroup$ Yes I did, but I do not remember well now 😕 The model should be unconstrained, the starting values should be numbers with SetPrecision same as WorkingPrecision. Then this should make Mathematica to use ~sqrt(WorkingPrecision) as the step size in fitting the parameters. $\endgroup$
    – Vladimir
    Dec 1, 2018 at 2:12


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.