fit_line_to_data_using_lls#

petpal.kinetic_modeling.graphical_analysis.fit_line_to_data_using_lls(xdata: numpy.ndarray, ydata: numpy.ndarray) numpy.ndarray#

Find the linear least squares solution given the x and y variables.

Performs a linear least squares fit to the provided data. Explicitly calls numpy’s linalg.lstsq method by constructing the matrix equations. We assume that xdata and ydata have the same number of elements.

Parameters:
  • xdata – Array of independent variable values

  • ydata – Array of dependent variable values

Returns:

Linear least squares solution. (m, b) values