Is there any way to get an estimate of the goodness of fit from FindFit, for instance getting the final error? The documentation doesn't provide any hints, and a quick Google search didn't return any useful link either. Am I missing something obvious?

  • 2
    $\begingroup$ A discussion of quantifying the quality of fits, including the error residuals, appears here: tutorial/StatisticalModelAnalysis. $\endgroup$ Dec 9, 2014 at 17:15

1 Answer 1


You can use NonlinearModelFit instead of FindFit.

dt = Table[Prime[x], {x, 20}];
FindFit[dt, a x Log[b + c x], {a, b, c}, x]
(* {a -> 1.42076, b -> 1.65558, c -> 0.534645} *)

nlm = NonlinearModelFit[dt, a x Log[b + c x], {a, b, c}, x];
(* 1.42076 x Log[1.65558+0.534645 x]*)


enter image description here

Grid[Transpose[{#, nlm[#]} &[{"AdjustedRSquared", "AIC", "BIC", "RSquared"}]], Alignment -> Left]

enter image description here

See: NonlinearModelFit >> Properties >> Goodness of fit measures

  • $\begingroup$ Two tiny questions if I may: -1- I am using nlm["ParameterTable"] as well after a nonlinearModelFit, but I get a warning that `"The property values {"ParameterTable"} assume an unconstrained model..." probably because I added a constraint while fitting, has this happened to you as well? -2- Is there a built-in way of also estimating the chi-squared per degree of freedom for the fit? Many thanks in advance. $\endgroup$
    – user52181
    Jun 17, 2019 at 10:53
  • $\begingroup$ You can use NMinimize function for fitting. Just minimize chi-square_nu over the parameter space to find your parameters. $\endgroup$ Aug 29, 2019 at 4:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.