# naginterfaces.library.stat.summary_​2var¶

naginterfaces.library.stat.summary_2var(x1, x2, wt=None)[source]

summary_2var computes the means, standard deviations, corrected sums of squares and products, maximum and minimum values, and the product-moment correlation coefficient for two variables. Unequal weighting may be given.

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

https://www.nag.com/numeric/nl/nagdoc_28.4/flhtml/g01/g01abf.html

Parameters
x1float, array-like, shape

The observations from the first sample, , for .

x2float, array-like, shape

The observations from the second sample, , for .

wtNone or float, array-like, shape , optional

If weights are being supplied then the elements of must contain the weights associated with the observations, , for .

If weights are not supplied then may be None.

Returns
nvalint

Is used to indicate the number of valid observations, ; see Notes (g).

resfloat, ndarray, shape

The elements of contain the following results:

 res mean of the first sample, ¯x; res mean of the second sample, ¯y; res standard deviation of the first sample, s1; res standard deviation of the second sample, s2; res corrected sum of squares of the first sample, c11; res corrected sum of products of the two samples, c12; res corrected sum of squares of the second sample, c22; res product-moment correlation coefficient, R; res minimum of the first sample; res maximum of the first sample; res minimum of the second sample; res maximum of the second sample; res sum of weights, ∑ni=1wi (=n, if iwt=0, on entry).
Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

The number of valid cases, , is .

(errno )

On entry, .

Constraint: , for

Warns
NagAlgorithmicWarning
(errno )

The number of valid cases, , is . In this case standard deviation and product-moment correlation coefficient cannot be calculated.

Notes

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

The data consist of two samples of observations, denoted by , and , for , with corresponding weights , for .

If no specific weighting is given, then each is set to in summary_2var.

The quantities calculated are:

1. The sum of weights,

2. The means,

3. The corrected sums of squares and products

4. The standard deviations

5. The product-moment correlation coefficient

6. The minimum and maximum elements in each of the two samples.

7. The number of pairs of observations, , for which , i.e., the number of valid observations. The quantities in (d) and (e) above will only be computed if . All other items are computed if .