The routine may be called by the names g02bwf or nagf_correg_ssqmat_to_corrmat.
g02bwf 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 g02buf or a series of calls to g02btf. 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 and , then the product-moment correlation coefficient, is given by
1: – IntegerInput
On entry: , the number of variables.
2: – Real (Kind=nag_wp) arrayInput/Output
On entry: 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 .
On exit: the Pearson product-moment correlation coefficients.
These are stored packed by column corresponding to the input cross-products.
3: – IntegerInput/Output
On entry: ifail must be set to , or to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value or is recommended. If message printing is undesirable, then the value is recommended. Otherwise, the value is recommended since useful values can be provided in some output arguments even when on exit. When the value or is used it is essential to test the value of ifail on exit.
On exit: unless the routine detects an error or a warning has been flagged (see Section 6).
6Error Indicators and Warnings
If on entry or , explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases g02bwf may return useful information.
On entry, .
A variable has a zero variance. All correlations involving the variable with zero variance will be returned as zero.
An unexpected error has been triggered by this routine. Please
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.
The accuracy of g02bwf is entirely dependent upon the accuracy of the elements of array r.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
g02bwf is not threaded in any implementation.
g02bwf may also be used to calculate the correlations between parameter estimates from the variance-covariance matrix of the parameter estimates as is given by several routines in this chapter.
A program to calculate the correlation matrix from raw data. The sum of squares and cross-products about the mean are calculated from the raw data by a call to g02buf. The correlation matrix is then calculated from these values.