naginterfaces.library.correg.coeffs_zero_subset_miss_pair¶
- naginterfaces.library.correg.coeffs_zero_subset_miss_pair(x, miss, xmiss, kvar)[source]¶
coeffs_zero_subset_miss_pair
computes means and standard deviations, sums of squares and cross-products about zero, and correlation-like coefficients for selected variables 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 g02bm
https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/g02/g02bmf.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).
- kvarint, array-like, shape
must be set to the column number in of the th variable for which information is required, for .
- Returns
- xbarfloat, ndarray, shape
The mean value, , of the variable specified in , for .
- stdfloat, ndarray, shape
The standard deviation, , of the variable specified in , for .
- sspzfloat, ndarray, shape
is the cross-product about zero, , for the variables specified in and , for , for .
- rzfloat, ndarray, shape
is the correlation-like coefficient, , between the variables specified in and , 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 the sum of cross-product and correlation-like coefficient for the variables specified in and , for , for .
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: and .
- (errno )
On entry, , and .
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 = 5.
- 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, together with the subset of these variables, , for which information is required.
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:
Means:
Standard deviations:
Sums of squares and cross-products about zero:
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.
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 .)