Hi I would like to ask my fellow python users how they perform their linear fitting.
I have been searching for the last two weeks on methods/libraries to perform this task and I would like to share my experience:
If you want to perform a linear fitting based on the least-squares method you have many options. For example you can find classes in both numpy and scipy. Myself I have opted by the one presented by linfit (which follows the design of the linfit function in IDL):
http://nbviewer.ipython.org/github/djpine/linfit/blob/master/linfit.ipynb
This method assumes you are introducing the sigmas in your y-axis coordinates to fit your data.
However, if you have quantified the uncertainty in both the x and y axes there aren't so many options. (There is not IDL "Fitexy" equivalent in the main python scientific libraries). So far I have found only the "kmpfit" library to perform this task. Fortunately, it has a very complete website describing all its functionality:
https://github.com/josephmeiring/kmpfit http://www.astro.rug.nl/software/kapteyn/kmpfittutorial.html#
If anyone knows additional approaches I would love to know them as well.
In any case I hope this helps.