[SciPy-User] How to fit data with errorbars
Charles R Harris
Wed Feb 17 12:33:09 CST 2010
On Tue, Feb 16, 2010 at 11:08 AM, Jeremy Conlin <email@example.com> wrote:
> I have some data with some errobars that I need to fit to a line. Is
> there anyway to use scipy.polyfit with the error associated with the
> data? If not, how can I make a fit routine work with my data?
Least squares is the best unbiased linear estimator when all the errors have
equal variance. If you have the Vandermonde matrix for the degree of fit you
want all you need to do is scale each row so the estimated error on the rhs
is 1. Then use least squares to solve the resulting equation Ax = y for x.
Weights should probably be added as an option in the polyfit routines. In
practice, weighting the data doesn't make much difference.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-User