# FindFit: getting confidence intervals for the returned parameters

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.

-
You can likely use NonlinearModelFit which is basically FindFit with additional properties and diagnostics including parameter confidence intervals. –  Andy Ross Mar 16 '13 at 23:07
–  kguler Mar 16 '13 at 23:12

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}}

-