naginterfaces.library.correg.coeffs_​zero_​miss_​pair

naginterfaces.library.correg.coeffs_zero_miss_pair(x, miss, xmiss)[source]

coeffs_zero_miss_pair computes means and standard deviations of variables, sums of squares and cross-products about zero and correlation-like coefficients for a set of data omitting cases with missing values from only those calculations involving the variables for which the values are missing.

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

https://www.nag.com/numeric/nl/nagdoc_29.3/flhtml/g02/g02bff.html

Parameters
xfloat, array-like, shape

must be set to , the value of the th observation on the th variable, for , for .

missint, array-like, shape

must be set equal to if a missing value, , is to be specified for the th variable in the array , or set equal to otherwise. Values of must be given for all variables in the array .

xmissfloat, array-like, shape

must be set to the missing value, , to be associated with the th variable in the array , for those variables for which missing values are specified by means of the array (see Accuracy).

Returns
xbarfloat, ndarray, shape

The mean value, , of the th variable, for .

stdfloat, ndarray, shape

The standard deviation, , of the th variable, for .

sspzfloat, ndarray, shape

is the cross-product about zero, , for , for .

rzfloat, ndarray, shape

is the correlation-like coefficient, , between the th and th variables, for , for .

ncasesint

The minimum number of cases used in the calculation of any of the sums of squares and cross-products and correlation-like coefficients (when cases involving missing values have been eliminated).

cntfloat, ndarray, shape

is the number of cases, , actually used in the calculation of , and , the sum of cross-products and correlation-like coefficient for the th and th variables, for , for .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

After observations with missing values were omitted, fewer than two cases remained for at least one pair of variables. (The pairs of variables involved can be determined by examination of the contents of the array ). All means, standard deviations, sums of squares and cross-products, and correlation-like coefficients based on two or more cases are returned by the function even if = 4.

Notes

No equivalent traditional C interface for this routine exists in the NAG Library.

The input data consists of observations for each of variables, given as an array

where is the th observation on the th variable. In addition, each of the variables may optionally have associated with it a value which is to be considered as representing a missing observation for that variable; the missing value for the th variable is denoted by . Missing values need not be specified for all variables.

Let if the th observation for the th variable is a missing value, i.e., if a missing value, , has been declared for the th variable, and (see also Accuracy); and otherwise, for , for .

The quantities calculated are:

  1. Means:

  2. Standard deviations:

  3. Sums of squares and cross-products about zero:

  4. Correlation-like coefficients:

    where and

    (i.e., the sums of squares about zero are based on the same set of observations as are used in the calculation of the numerator).

    If or is zero, is set to zero.

  5. The number of cases used in the calculation of each of the correlation-like coefficients:

    (The diagonal terms, , for , also give the number of cases used in the calculation of the means and the standard deviations .)