stat_values¶
-
hep_spt.
stat_values
(arr, axis=None, weights=None)[source]¶ Calculate mean and variance and standard deviations of the sample and the mean from the given array. Weights are allowed. The definition of the aforementioned quantities are:
Mean:
\[\bar{x} = \sum_{i=0}^{n - 1}{\frac{x_i}{n}}\]Weighted mean:
\[\bar{x}^w = \frac{\sum_{i=0}^{n - 1}{\omega_i x_i}}{\sum_{i=0}^{n - 1}{\omega_i}}\]Variance of the sample:
\[\sigma_s = \sum_{i=0}^{n - 1}{\frac{(x_i - \bar{x})^2}{n - 1}}\]Weighted variance of the sample:
\[\sigma^w_s = \frac{N'}{(N' - 1)}\frac{\sum_{i=0}^{n - 1}{\omega_i(x_i - \bar{x}^w)^2}}{\sum_{i=0}^{n - 1}{\omega_i}}\]where \(\omega_i\) refers to the weights associated with the value \(x_i\), and in the last equation N’ refers to the number of non-zero weights. The variance and standard deviations of the mean are then given by:
Standard deviation of the mean:
\[s_\bar{x} = \sqrt{\frac{\sigma_s}{n}}\]Weighted standard deviation of the mean:
\[s^w_\bar{x} = \sqrt{\frac{\sigma^w_s}{N'}}\]- Parameters
arr (numpy.ndarray) – input array of data.
axis (None or int or tuple(int)) – axis or axes along which to calculate the values for “arr”.
weights (None or numpy.ndarray) – array of weights associated to the values in “arr”.
- Returns
Mean, variance, standard deviation, variance of the mean and standard deviation of the mean.
- Return type
numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray