Standard Normalized Error in x-direction of /ODR fit result from CurveFit
Hello,
I would like to calculate the error in x-direction of a fit result after an /ODR fit.
The general approach would be to calculate the slope in x-direction and multiply it with the weights:
For example for fitting function exp, I calculate the x-slope for a specific x and use this to approximate the error:
variable arg = (x - coefs[2]) / coefs[3]
variable expTerm = exp(-arg^2)
variable slope = coefs[1] * expTerm * (-2 * arg / coefs[3])
variable sigmaX[i] = sqrt((weightX[i]^2) + (yResidual[i]^2 / (slope^2)))The derivative in x is specific for each fit function.
Is there a more general way for the Igor Pro integrated fit function to calculate sigmaX from the output of CurveFit?
(Such that I do not need to implement an own function for calculating the slope in x for each integrated fit function)
Best regards,
Michael Huth
Hi Michael,
I assume you are using
/ODR=2or/ODR=3? If so, then you can get the x-residuals as a result from the CurveFit command directly with/XR=wave:The x-residual wave output from ODR types Explicit Orthogonal Distance Regression (2) or Implicit (3) is the per-point x-shift. i.e. the x-component of the shift from each data point to the curve, obtained without coding a per-function derivative.
If your
sigmaXis meant to combine the input x-uncertainty (/XW) with the x-projection of the y-residual, note that with/ODR=2or3the x-residual (/XR) already gives you the second term directly and correctly: it is the weighting-aware x-shift of each point onto the curve, so it replaces youryResidual/slopeapproximation. Two caveats: (1) /R (the output y-residual) is evaluated at x + x-residual, not at the original x, soyResidual/slopeis only an approximation of the x-residual; and (2)/XRis a signed residual (a displacement), not an uncertainty — it is not itselfsigmaX. If you want your original quadrature form with the exact x-projection, combine it with the input x-uncertainty yourself:sigmaX = sqrt(xErr^2 + xResidual^2).The correct way to calculate the slope to use as a conversion factor to translate uncertainty between the two axes is to differentiate the fitted model. If you ran the CurveFit as I show above,
But I think what you want is the x-residual wave from CurveFit
/XR=wave.Thanks,
Kris
June 24, 2026 at 12:20 pm - Permalink
Thanks Kris, this is very helpful. 👍
June 25, 2026 at 04:59 am - Permalink