User Tools

Site Tools


Weighing data points

In least-squares curve fitting, data points y(x) are approximated by function values f(x;p). Sometimes, one wants to assign data points a weight w(x). One then has to minimize the sum of squares of w*(y-f).

How to implement

This can be implemented easily by copying lmcurve.h and lmcurve.c, and modifying them in obvious ways, just introducing a new parameter w.

How to choose weights

Assuming that data points y(x) follow Gaussian distributions with standard deviations dy(x), the appropriate weight is w(x) = 1 / dy(x).

How to deal with Poisson-distributed data

Least-squares fitting is not justified for Poisson-distributed data – except if the data are large enough (say, on average y of the order of 10 or larger) so that the Poisson distribution is reasonably well approximated by a Gaussian with standard deviation dy=sqrt(y). When experimental data have on average too low values y per channel, they should be binned into fewer channels with better statistics before any least-squares fitting.