naginterfaces.library.correg.coeffs_​pearson_​subset

naginterfaces.library.correg.coeffs_pearson_subset(x, kvar)[source]

coeffs_pearson_subset computes means and standard deviations, sums of squares and cross-products of deviations from means, and Pearson product-moment correlation coefficients for selected variables.

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

https://support.nag.com/numeric/nl/nagdoc_30.1/flhtml/g02/g02bgf.html

Parameters
xfloat, array-like, shape

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

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 .

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 .

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: and .

(errno )

On entry, , and .

Constraint: .

Notes

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, together with the subset of these variables, , for which information is required.

The quantities calculated are:

  1. Means:

  2. Standard deviations:

  3. Sums of squares and cross-products of deviations from zero:

  4. Pearson product-moment correlation coefficients:

    If or is zero, is set to zero.