naginterfaces.library.correg.coeffs_pearson_subset_miss_case¶
- naginterfaces.library.correg.coeffs_pearson_subset_miss_case(x, miss, xmiss, mistyp, kvar)[source]¶
coeffs_pearson_subset_miss_case
computes means and standard deviations, sums of squares and cross-products of deviations from means, and Pearson product-moment correlation coefficients for selected variables omitting completely any cases with a missing observation for any variable (either over all variables in the dataset or over only those variables in the selected subset).For full information please refer to the NAG Library document for g02bh
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/g02/g02bhf.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).
- mistypint
Indicates the manner in which missing observations are to be treated.
A case is excluded if it contains a missing value for any of the variables .
A case is excluded if it contains a missing value for any of the variables specified in the array .
- 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 , of the variable specified in , for .
- stdfloat, ndarray, shape
The standard deviation, , of the variable specified in , for .
- sspfloat, ndarray, shape
is the cross-product of deviations, , for the variables specified in and , for , for .
- rfloat, ndarray, shape
is the product-moment correlation coefficient, , between the variables specified in and , for , for .
- ncasesint
The number of cases actually used in the calculations (when cases involving missing values have been eliminated).
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, and .
Constraint: and .
- (errno )
On entry, , and .
Constraint: .
- (errno )
On entry, .
Constraint: or .
- (errno )
After observations with missing values were omitted, no cases remained.
- (errno )
After observations with missing values were omitted, only one case remained.
- 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. The missing values can be utilized in two slightly different ways; you can indicate which scheme is required.
Firstly, let if observation contains a missing value for any of those variables in the set for which missing values have been declared, i.e., if for any () for which an has been assigned (see also Accuracy); and otherwise, for .
Secondly, let if observation contains a missing value for any of those variables in the selected subset for which missing values have been declared, i.e., if for any () for which an has been assigned (see also Accuracy); and otherwise, for .
The quantities calculated are:
Means:
Standard deviations:
Sums of squares and cross-products of deviations from means:
Pearson product-moment correlation coefficients:
If or is zero, is set to zero.