FindFit¶
Fits a parametric model to numeric data.
A model given as {model, constraints…} is fitted subject to those
constraints: the slope here wants to be 2, but is not allowed past 1, so
the intercept takes up the slack.
$ wo 'FindFit[{{0, 1.}, {1, 3.}, {2, 5.}, {3, 7.}}, {a x + b, 0 < a < 1}, {a, b}, x]'
\{a -> (1\.(0+\d*)?|0\.99999999\d*), b -> 2\.5(0+\d*)?\} (regex)
NormFunction changes the quantity that is minimized. With the 1-norm
the fit follows the median trend instead of being pulled by the outlier.