Least-Squares Fitting with asymetric errors

Stewart V. Wright svwright+lists@amtp.liv.ac.uk
Wed May 5 15:55:00 GMT 2004


Hi,

I was wondering if there was any advice on how to do least-squares
fitting using GSL with asymmetric errors on my data.

In the example for nonlinear least-squares fitting
  http://www.gnu.org/software/gsl/manual/gsl-ref_36.html#SEC475
the following snippet calculates the Jacobian of the function to be
fitted...

  /* Jacobian matrix J(i,j) = dfi / dxj, */
  /* where fi = (Yi - yi)/sigma[i],      */
  /*       Yi = A * exp(-lambda * i) + b  */
  /* and the xj are the parameters (A,lambda,b) */
  double t = i;
  double s = sigma[i];
  double e = exp(-lambda * t);
  gsl_matrix_set (J, i, 0, e/s); 
  gsl_matrix_set (J, i, 1, -t * A * e/s);
  gsl_matrix_set (J, i, 2, 1/s);

However, this assumes that the errors (AKA standard deviation 
== sigma) is symmetric.

What is the best way of allowing for asymmetric errors?  Is the way to
do it redefine my "fi" function in both the function (to fit) and the
calculation of its derivative to be a step function?
i.e.   if ( yi <= Yi ) use the ErrorBar+ for sigma
       if ( yi >  Yi ) use the ErrorBar- for sigma


Thanks for any comments,

S.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 274 bytes
Desc: Digital signature
URL: <http://sourceware.org/pipermail/gsl-discuss/attachments/20040505/bd7c5091/attachment.sig>


More information about the Gsl-discuss mailing list