effective_variance

nbi_stat.effective_variance(x, ex, f, p, ey, df=None, df_step=None)[source]

Calculates the effective variance

That is, the function calculates the square uncertainty on

d = y - f(x)

as

ed**2 = ey**2 + diff(f(x,p),x)**2 * ex**2

where diff is the derivative of f wrt to x. The derivate can be given as a callable, or be calculated numerically

Parameters:
  • x (array) – Independent variable

  • ex (array) – Uncertainty on x

  • f (callable) –

    A callable representing f, with the signature

    f(x,*p)

  • ey (array) – Uncertainty on y

  • df (callable) –

    The differential of f wrt x. A function of the form

    df(x,*p)

  • df_step (None, float, array) – The step size to use when evaluating the differential numerically

Returns:

ed2 – The squared effective variance

Return type:

array