- qspec.analyze.york_fit ( x , y , sigma_x = None , sigma_y = None , corr = None , iter_max = 200 , report = False , show = False , ** kwargs )[source]
A linear regression algorithm to find the best straight line, given normally distributed errors for x and y and correlation coefficients between errors in x and y. The algorithm is described in ['Unified equations for the slope, intercept, and standard errors of the best straight line', York et al., American Journal of Physics 72, 367 (2004)]. See the comments to compare the individual steps.
- Parameters:
-
- xndarray | Iterable
The x data.
- yndarray | Iterable
The y data.
- sigma_xndarray | Iterable
The 1-sigma uncertainties of the x data.
- sigma_yndarray | Iterable
The 1-sigma uncertainties of the y data.
- corrndarray | Iterable
The correlation coefficients between the x and y data.
- iter_maxint
The maximum number of iterations to find the best slope.
- reportbool
Whether to print the result of the fit.
- showbool
Whether to plot the fit result.
- kwargsNone
regression algorithm to find the best straight line, given normally distributed errors for x and y and correlation coefficients between errors in x and y. The algorithm is described in ['Unified equations for the slope, intercept, and standard errors of the best straight line', York et al., American Journal of Physics 72, 367 (2004)]. See the comments to compare the individual steps.
- Returns:
-
- outNone
popt, pcov. The best y-intercept and slope, their covariance matrix and the used alpha.