- naginterfaces.library.correg.coeffs_pearson_miss_pair(n, x, miss, xmiss)¶
coeffs_pearson_miss_paircomputes means and standard deviations of variables, sums of squares and cross-products of deviations from means, and Pearson product-moment correlation 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 g02bc
, the number of observations or cases.
- 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).
- xbarfloat, ndarray, shape
The mean value, , of the th variable, for .
- stdfloat, ndarray, shape
The standard deviation, , of the th variable, for .
- sspfloat, ndarray, shape
is the cross-product of deviations , for , for .
- rfloat, ndarray, shape
is the product-moment correlation coefficient between the th and th variables, for , for .
The minimum number of cases used in the calculation of any of the sums of squares and cross-products and correlation 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 coefficient for the th and th variables, for , for .
- (errno )
On entry, .
- (errno )
On entry, .
- (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 coefficients based on two or more cases are returned by the function even if = 4.
No equivalent traditional C interface for this routine exists in the NAG Library.
The input data consist 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:
Sums of squares and cross-products of deviations from means:
(i.e., the means used in the calculation of the sums of squares and cross-products of deviations are based on the same set of observations as are the cross-products.)
Pearson product-moment correlation coefficients:
where and and and are as defined in (c) above
(i.e., the sums of squares of deviations used in the denominator 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 coefficients:
(The diagonal terms, , for , also give the number of cases used in the calculation of the means, , and the standard deviations, .)