naginterfaces.library.stat.summary_​onevar

naginterfaces.library.stat.summary_onevar(x, wt=None, pn=0, rcomm=None)[source]

summary_onevar calculates the mean, standard deviation, coefficients of skewness and kurtosis, and the maximum and minimum values for a set of (optionally weighted) data. The input data can be split into arbitrary sized blocks, allowing large datasets to be summarised.

For full information please refer to the NAG Library document for g01at

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/g01/g01atf.html

Parameters
xfloat, array-like, shape

The current block of observations, corresponding to , for , where is the number of observations processed so far and is the size of the current block of data.

wtNone or float, array-like, shape , optional

Note: the required length for this argument is determined as follows: if : ; otherwise: .

If is not None, must contain the user-supplied weights corresponding to the block of data supplied in , that is , for .

If is None, for all .

pnint, optional

The number of valid observations processed so far, that is the number of observations with , for . On the first call to summary_onevar, or when starting to summarise a new dataset, must be set to .

If , it must be the same value as returned by the last call to summary_onevar.

rcommNone or float, ndarray, shape , optional, modified in place

Note: the required length for this argument is determined as follows: if : ; otherwise: .

Optionally, on entry: communication array, used to store information between calls to summary_onevar. If , need not be initialized, otherwise it must be unchanged since the last call to this function.

If is None, is not referenced and all the data must be supplied in one go.

On exit, if not None on entry: the updated communication array. The first five elements of hold information that may be of interest with

the remaining elements of are used for workspace and so are undefined.

Returns
pnint

The updated number of valid observations processed, that is the number of observations with , for .

xmeanfloat

, the mean of the first observations.

xsdfloat

, the standard deviation of the first observations.

xskewfloat

, the coefficient of skewness for the first observations.

xkurtfloat

, the coefficient of kurtosis for the first observations.

xminfloat

The smallest value in the first observations.

xmaxfloat

The largest value in the first observations.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: if then , for .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

On exit from previous call, .

Constraint: if , must be unchanged since previous call.

(errno )

On entry, .

Constraint: if then .

(errno )

has been corrupted between calls.

Warns
NagAlgorithmicWarning
(errno )

On entry, the number of valid observations is zero.

(errno )

On exit we were unable to calculate or . A value of has been returned.

(errno )

On exit we were unable to calculate , or . A value of has been returned.

Notes

Given a sample of observations, denoted by and a set of non-negative weights, , summary_onevar calculates a number of quantities:

  1. Mean

  2. Standard deviation

  3. Coefficient of skewness

  4. Coefficient of kurtosis

  5. Maximum and minimum elements, with .

These quantities are calculated using the one pass algorithm of West (1979).

For large datasets, or where all the data is not available at the same time, and can be split into arbitrary sized blocks and summary_onevar called multiple times.

References

West, D H D, 1979, Updating mean and variance estimates: An improved method, Comm. ACM (22), 532–555