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?
Answer
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];
Normal[nlm]
(* 1.42076 x Log[1.65558+0.534645 x]*)
nlm["ParameterTable"]
Grid[Transpose[{#, nlm[#]} &[{"AdjustedRSquared", "AIC", "BIC", "RSquared"}]], Alignment -> Left]
See: NonlinearModelFit >> Properties >> Goodness of fit measures
Comments
Post a Comment