[ANN] LinearFitXYerrors.jl : least squares fitting of straight lines with errors in both X and Y

LinearFitXYerrors.jl is a small Julia package, based on York et al. (2004) with a few additions, to perform 1D linear fitting of experimental data with errors in both X and Y variables.

The README.md file provides details and all the examples shown can be copied from the examples folder.

While care was taken to try making sure the code produces results consistent with a number of published material, in particular with LsqFit.jl (when applicable), some advanced statistics topics involved are beyond my expertise, this is also the case with git and Julia…

The objective was to learn how to publish a package via Github while implementing York’s technique in Julia.
Consider it to be work in progress.

Feedback is welcome.
Thank you.

Example 0: Altman and Gardner (1988)

Example 1: York (1966) and Cantrell (2008)

Example 2: Amen (2012)

Example 3: Mahon (1996)

Quick update (after 5 years!): LinearFitXYerrors.jl v0.2.0 is now registered.

Main changes (minor breaking):

  • Plots.jl is now an optional weak dependency (package extension, Julia ≥ 1.9). The package loads fast without it, plot(st) still works when you load Plots. Makie support is on the roadmap;

  • new σab field (intercept–slope covariance), and the figure now shows the exact pointwise 95% confidence band of the fitted line for all X-Y error scenarios (the band bounds the fitted line’s uncertainty, not the data’s spread);

  • robustness fixes (integer inputs, zero error vectors), console summary now opt-in (verbose=true);

  • experience from testing the simpler and faster York approach adopted in this package against more general Bayesian approaches is now summarized in the README (when the stated errors underestimate the real dispersion of the data, explicitly modeling that extra scatter moves the slope, e.g. from 1.18 to 1.06 on the Example-2 dataset).

Full details, NEWS.md and updated examples on the GitHub release page: Release v0.2.0 · rafael-guerra-www/LinearFitXYerrors.jl · GitHub

Grateful for the assistance of Mistral AI throughout this refactoring.