Weighting x values

X Weighting

Most fits assume all the uncertainty is in Y. When the X values carry meaningful error too, CFTool can weight them and switch to an orthogonal-distance fit.

In most experiments the dependent variable (Y) carries the main uncertainty, while the independent variable (X) is set or controlled directly and is therefore much more precise. Accordingly, most fitting algorithms assume no uncertainty in X, minimising only the residual deviations in Y.

01When to consider X errors

Usually, ignoring X uncertainty makes little practical difference — particularly when the X uncertainties are small or uniform. But there are cases where including X weighting matters.

A typical example is peak fitting, where uncertainty in the peak position affects the accuracy of the result. Enabling X errors there lets the algorithm account for both vertical and horizontal deviations.

02Enabling X errors in CFTool

  1. Just below the Control Ribbon, click the Enable X Errors button. This automatically switches the fitting algorithm to Orthogonal Distance (OD) mode, and the Apply Weights (X) checkbox becomes active.
  2. Tick Apply Weights (X) to include X uncertainties in the fit.
  3. The Edit Window appears, letting you enter σX values — the estimated uncertainty in each X point.

You can then choose how these values are used:

  • X-weighting ON — X uncertainties affect both the fit and the reported coefficient errors.
  • X-weighting OFF — X uncertainties are plotted as X-error bars only; they are not used in weighting or uncertainty calculations.

Once entered, σX values can be modified through the Edit Window and are stored in the project file whenever X-errors remain enabled.

Disabling X-errors discards σX. If you turn X-errors off, CFTool warns that the X-Sigma values will be lost and offers to save the project first.

03Using orthogonal-distance fitting

When X errors are enabled, CFTool automatically switches to the Orthogonal Distance (OD) algorithm. This minimises the shortest (orthogonal) distance between each data point and the fitted curve, accounting for uncertainties in both X and Y.

An extra degree of freedom. OD fitting gives each point room to move along X. Over-estimated X uncertainties can let the function shift laterally — especially when Y-weights are also applied — leading to unrealistic fits. Use X weighting only when the X uncertainties are meaningful and well estimated.

04Residuals display

Even when X weighting is applied, the residuals plot still shows only the Y-component of the residuals (the deviation in Y). This keeps results easy to compare with ordinary Y-only fits.

05Best practice

When to enable X errors

  • Use X errors only when the uncertainty in the X values is significant and physically justified.
  • Avoid X weighting when the X values are set precisely (e.g. voltage, time or temperature steps).
  • Take care using both X and Y weighting — overestimated uncertainties can make the fit unstable.
  • Save first: always save the project before disabling X errors, to avoid losing the σX values.