residuals

nbi_stat.residuals(x, y, f, p, ey=None)[source]

Calculate the residuals with respect to some function

This will calculate the residuals of the data sample

{x_,y_,delta_i | i=1,…N}

with respect to the function f(x,p), where p are the parameters of the function

Note, points with delta_i=0 are explicitly ignored

Parameters:
  • x (array-like) – Independent variable

  • y (array-like) – Dependent variable

  • ey (array-like) – Uncertainty on y

  • f (callable) – function

  • p (array-like) – function parameters

Returns:

  • x (array-like) – Places where the residuls have been evaluated

  • r (array-like) – Residuals

See also

plot_residuals, lsq_fit, fit