1
$\begingroup$

I'm using FindFit[] to fit a function to some experimental data. I'd like to know what error bars are on the fitted parameters.

Scipy's curve_fit() returns the optimised parameters along with their covariance matrix - is there anything equivalent for Mathematica? As far as I can tell, there's no mention of it in the documentation.

$\endgroup$
8
$\begingroup$

A fit performed using NonlinearModelFit has many properties including "CovarianceMatrix". For example, we can fit the function A 2^(B t) to the data data = {{1, 2.1}, {2, 4.1}, {3, 9.2}} with

nlm = NonlinearModelFit[data, A 2^(B t), {A, B}, t]

which estimates {A -> 0.902745, B -> 1.1148}. We can access the covariance matrix of the estimated parameters using

nlm["CovarianceMatrix"]

yielding {{0.00945806, -0.00530171}, {-0.00530171, 0.00307167}}

$\endgroup$

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.