![]() |
VOOZH | about |
Orthogonal Distance Regression (ODR) is a powerful statistical technique used to fit a model to data when both independent (X) and dependent (Y) variables are subject to error. Unlike traditional Ordinary Least Squares (OLS), which assumes that only the dependent variable has measurement errors, ODR accounts for errors in both directions, making it ideal for scientific and engineering data where all measurements can be noisy.
👁 ImageIn many real-world scenarios, both the independent variable (X) and the dependent variable (Y) may be affected by measurement errors. In such cases, ODR becomes more suitable because it:
The objective function minimized in ODR is:
Where:
And the weighting factor is defined as:
Where:
SciPy provides the scipy.odr module to implement ODR using the ODRPACK library, a well-established FORTRAN-77 based package. SciPy wraps this functionality in an object-oriented interface for ease of use.
Output
Beta: [ 0.11545417 -0.48999795]
Beta Std Error: [0.07475684 0.46382517]
Beta Covariance: [[ 0.01228991 -0.06759452]
[-0.06759452 0.4731028 ]]
Residual Variance: 0.45472947791705537
Inverse Condition #: 0.06923218954368635
Reason(s) for Halting:
Sum of squares convergence