I fitted data belonging to a MSD (mean squared displacement of a vibrating micrometer sized particle) by using a linear function:
data = {{0.0166667, 0.0000119831}, {0.0333333, 0.0000361185}, {0.05, 0.0000672071},
{0.0666667, 0.00010521}, {0.0833333, 0.000142751}};
datalog = Log10[data];
model = a*x + b;
fit = FindFit[datalog, model, {a, b}, x];
modelf = Function[{x}, Evaluate[model /. fit]];
Plot[modelf[t], {t, -2, -1}, Epilog -> {Red, PointSize[0.02], Point[datalog]},
PlotStyle -> AbsolutePointSize[10], Frame -> True, AspectRatio -> 1,
FrameLabel -> {{"Log10 [y]", ""}, {"Log10 [x]", ""}}]
The result is:
fit
yields the fittings parameters. From the slope one can calculate the diffusion coefficient.
To get the standard deviation of the fitting parameters I used:
lm = LinearModelFit[datalog, x, x];
lm["ParameterTable"]
which gives:
My question: Is there another possibility to obtain the errors of the fit parameters (from FindFit
) without calling LinearModelFit
and ParameterTable
?
FindFit[data, a x^b, {a, b}, x]
$\endgroup$LinearModelFit
/NonlinearModelFit
in favour ofFindFit
? What's wrong withNonlinearModelFit
? It also callsFindFit
internally, but it also does additional calculations to get the errors. You'll need to do these manually if you don't wantNonlinearModelFit
. $\endgroup$LinearModelFit
orNonlinearModelFit
, but I take it you want the formula used to calculate these for academic purposes. I'd look at this page and this page $\endgroup$NonlinearModelFit[]
, you can use the"ParameterErrors"
property of the resultingFittedModel[]
object. $\endgroup$