neutronpy.kmpfit.Fitter.confidence_band

Fitter.confidence_band(self, x, dfdp, confprob, f, abswei=False)

After the method fit has been called, this method calculates the upper and lower value of the confidence interval for all elements of the NumPy array x. The model values and the arrays with confidence limits are returned and can be used to plot confidence bands.

Parameters:

x : ndarray

NumPy array with the independent values for which the confidence interval is to be found.

dfdp : list

a list with derivatives. There must be as many elements in this list as there are parameters in the model. Each element must be a NumPy array with the same length as x.

confprob : float

confidence probability, e.g. 0.95 (=95%). From this number the confidence level is derived, e.g. 0.05. The Confidence Band is a (1-alpha)*100% band. This implies that for a given value of x the probability that the ‘true’ value of f falls within these limits is (1-alpha)*100%.

f : func

the model function returning the value y = f(p,x). p are the best-fit parameters as found by the method fit and x is the given NumPy array with independent values.

abswei : bool

True if weights are absolute. For absolute weights the unscaled covariance matrix elements are used in the calculations. For unit weighting (i.e. unweighted) and relative weighting, the covariance matrix elements are scaled with the value of the reduced chi squared.

Returns:

confidence : tuple

A tuple with the following elements, each one is a Numpy array:

  • y: the model values at x: y = f(p,x);
  • upperband: the upper confidence limits;
  • lowerband: the lower confidence limits.

Notes

If parameters were fixed in the fit, the corresponding error is 0 and there is no contribution to the confidence interval.