orthogonalDistanceRegression
Return to directory of Todd's CASA extensions
Performs a linear fit accounting for measurement uncertainties in both axes, using scipy.odr.ODR. See also
linfit, which
accounts for uncertainties only in the y axis.
Usage:
au.linfit().orthogonalDistanceRegression(x, y, xerror, yerror, loglog=False)
Inputs:
- x: array of values
- y: list or array of values
- xerror: list or array of standard deviations in x
- yerror: list or array of standard deviations in y
- loglog: if True, then take the log10 of x and y, and set xerror=xerror/x and yerror=yerror/y, prior to fitting. Also, converts the intercept to the scaling coefficient.
Returns:
- two arrays:
- first array: [slope, intercept]
- second array: [slope_standard_deviation, intercept_standard_deviation]
Example:
CASA <4>: au.linfit().orthogonalDistanceRegression([1,2,3,4,5],[1.1,2.0,2.9,4.05,5.03],[.1,.1,.1,.1,.1],[.2,.2,.2,.2,.2])
Out[4]: (array([ 0.99142431, 0.0417269 ]), array([ 0.02665459, 0.08840205]))
--
ToddHunter - 2014-09-02