# naginterfaces.library.correg.ssqmat_​to_​corrmat¶

naginterfaces.library.correg.ssqmat_to_corrmat(m, r)[source]

ssqmat_to_corrmat calculates a matrix of Pearson product-moment correlation coefficients from sums of squares and cross-products of deviations about the mean.

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

https://www.nag.com/numeric/nl/nagdoc_28.7/flhtml/g02/g02bwf.html

Parameters
mint

, the number of variables.

rfloat, array-like, shape

Contains the upper triangular part of the sums of squares and cross-products matrix of deviations from the mean. These are stored packed by column, i.e., the cross-product between variable and , , is stored in .

Returns
rfloat, ndarray, shape

The Pearson product-moment correlation coefficients.

These are stored packed by column corresponding to the input cross-products.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

A variable has a zero variance. All correlations involving the variable with zero variance will be returned as zero.

Notes

ssqmat_to_corrmat calculates a matrix of Pearson product-moment correlation coefficients from sums of squares and cross-products about the mean for observations on variables which can be computed by a single call to ssqmat() or a series of calls to ssqmat_update(). The sums of squares and cross-products are stored in an array packed by column and are overwritten by the correlation coefficients.

Let be the cross-product of deviations from the mean, for , for , then the product-moment correlation coefficient, is given by