West

class nbi_stat.West(ndim, covar=None, frequency=True, component=False, ddof=0)[source]

Bases: Stat

An weighted sample statistics

Parameters:
  • ndim (int) – Number of variables (dimension of sample)

  • covar (bool) – If true, calculate covariance

  • frequency (bool) – If true, consider weights to be frequency weights

  • component (bool) – If true, consider weights to be per component

  • ddof (int) – Delta degrees of freedom (1 for unbiased sample estimators)

Attributes Summary

sem

Standard error on the mean(s)

sem_uncertainties

Standard error on the mean(s) if weights are the square inverse uncertainties of the the observations

sumw

Sum of weights of observations

sumw2

Sum of square weights of observations (non-frequency only)

Methods Summary

fill(x, w)

Update statistics with single observation x (and possible weight)

is_component()

True if component-specific weights

is_frequency()

True if frequency weights

update(x[, w])

Update statistics with observation x (and possible weight)

Attributes Documentation

sem

Standard error on the mean(s)

sem_uncertainties

Standard error on the mean(s) if weights are the square inverse uncertainties of the the observations

Returns:

delta – The uncertainty on the mean

Return type:

array

sumw

Sum of weights of observations

sumw2

Sum of square weights of observations (non-frequency only)

Methods Documentation

fill(x, w)[source]

Update statistics with single observation x (and possible weight)

Parameters:
  • x (array) – Observation. Must be scalar or 1D array

  • w (array) – Weights. If not specified assume 1

is_component()[source]

True if component-specific weights

is_frequency()[source]

True if frequency weights

update(x, w=None)[source]

Update statistics with observation x (and possible weight)

Parameters:
  • x (array) – Observation. If a 2D-array interpret each row as an observation. The last dimension must equal the number of dimensions of this object.

  • w (array.) – Weights. If not given, assume 1. If a 2D-array, interpret each rows as an observation weight. The last dimension must be 1 or equal to the number of dimensions of this object if declared to contain component weights.