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
Topic revision: r2 - 2014-09-02, ToddHunter
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NRAO Public Wiki? Send feedback