|
NAG[g02bwc] NAG[nag_cov_to_corr] - Computes a correlation matrix from a sum of squares matrix
|
|
Calling Sequence
g02bwc(m, r, 'fail'=fail)
nag_cov_to_corr(. . .)
Parameters
|
m - integer;
|
|
|
On entry: , the number of variables.
|
|
Constraint: . .
|
|
|
r - Vector(1.., datatype=float[8]);
|
|
|
Note: the dimension, dim, of the array r must be at least .
|
|
On exit: Pearson product-moment correlation coefficients.
|
|
These are stored packed by column corresponding to the input cross-products.
|
|
|
'fail'=fail - table; (optional)
|
|
|
The NAG error argument, see the documentation for NagError.
|
|
|
|
Description
|
|
|
Purpose
|
|
nag_cov_to_corr (g02bwc) calculates a matrix of Pearson product-moment correlation coefficients from sums of squares and cross-products of deviations about the mean.
|
|
Description
|
|
nag_cov_to_corr (g02bwc) 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 g02buc (nag_sum_sqs) or a series of calls to g02btc (nag_sum_sqs_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 variables ; , then the product-moment correlation coefficient, is given by
|
|
Error Indicators and Warnings
|
|
"NE_BAD_PARAM"
On entry, argument had an illegal value.
"NE_INT"
On entry, . Constraint: .
"NE_INTERNAL_ERROR"
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please consult NAG for assistance.
"NE_ZERO_VARIANCE"
On entry, a variable has zero variance.
|
|
Accuracy
|
|
The accuracy of nag_cov_to_corr (g02bwc) is entirely dependent upon the accuracy of the elements of array r.
|
|
Further Comments
|
|
nag_cov_to_corr (g02bwc) may also be used to calculate the correlations between argument estimates from the variance-covariance matrix of the argument estimates as is given by several functions in this chapter.
|
|
|
Examples
|
|
>
|
m := 3:
r := Vector([8.75689620235916, 3.697844992253459, 1.59053509294466, 4.070728079123907, 1.686058157917487, 1.929668337915273], datatype=float[8]):
NAG:-g02bwc(m, r):
|
|
|
Download Help Document
Was this information helpful?