This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Least-Squares Fitting with asymetric errors


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.

Attachment: signature.asc
Description: Digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]