I am fitting some data with a linear fit. I want to weight the error bars. Up to this point, I have been using bulldogs fitting.py. Their linear_fit makes weighted linear regressions very easy. Unfortunately, the data I’m working with has error in both the X and Y directions.
I was wondering how, both practically (in Python) and theoretically (in statistical terms), this would be done.
There’s a couple of choices:
scipy.optimize.leastsq(for the total least squares)scipy.odr(for Deming regression).Both of these solutions will account for independent error in X and Y directions (the scld array in odr).