NAG Library Routine Document
G02CFF
1 Purpose
G02CFF reorders the elements in two vectors (typically vectors of means and standard deviations), and the rows and columns in two matrices (typically either matrices of sums of squares and cross-products of deviations from means and Pearson product-moment correlation coefficients, or matrices of sums of squares and cross-products about zero and correlation-like coefficients).
2 Specification
INTEGER |
N, KORDER(N), LDSSP, LDR, KWORK(N), IFAIL |
REAL (KIND=nag_wp) |
XBAR(N), STD(N), SSP(LDSSP,N), R(LDR,N) |
|
3 Description
Input to the routine consists of:
(a) |
A list of the order in which the variables are to be arranged on exit:
|
(b) |
A vector of means:
|
(c) |
A vector of standard deviations:
|
(d) |
A matrix of sums of squares and cross-products of deviations from means:
|
(e) |
A matrix of correlation coefficients:
|
On exit from the routine, these same vectors and matrices are reordered, in the manner specified, and contain the following information:
(i) |
The vector of means:
|
(ii) |
The vector of standard deviations:
|
(iii) |
The matrix of sums of squares and cross-products of deviations from means:
|
(iv) |
The matrix of correlation coefficients:
|
Note: for sums of squares of cross-products of deviations about zero and correlation-like coefficients
and
should be replaced by
and
in the description of the input and output above.
4 References
None.
5 Parameters
- 1: – INTEGERInput
-
On entry: , the number of variables in the input data.
Constraint:
.
- 2: – INTEGER arrayInput
-
On entry: must be set to the number of the original variable which is to be the th variable in the re-arranged data, for .
Constraint:
, for .
- 3: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: must be set to the mean of variable , for .
On exit: contains the mean of variable where , for .
- 4: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: must be set to the standard deviation of variable , for .
On exit: contains the standard deviation of variable where , for .
- 5: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: must be set to the sum of cross-products of deviations from means (or about zero ) for variables and , for and .
On exit: contains the sum of cross-products of deviations from means (or about zero ) for variables and , where , and , .
- 6: – INTEGERInput
-
On entry: the first dimension of the array
SSP as declared in the (sub)program from which G02CFF is called.
Constraint:
.
- 7: – REAL (KIND=nag_wp) arrayInput/Output
-
On entry: must be set to the Pearson product-moment correlation coefficient (or the correlation-like coefficient ) for variables and , for and .
On exit: contains the Pearson product-moment correlation coefficient (or the correlation-like coefficient ) for variables and , where and , for and .
- 8: – INTEGERInput
-
On entry: the first dimension of the array
R as declared in the (sub)program from which G02CFF is called.
Constraint:
.
- 9: – INTEGER arrayWorkspace
-
- 10: – INTEGERInput/Output
-
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is
.
When the value 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).
6 Error 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:
-
-
On entry, | , |
or | . |
-
On entry, | , |
or | for some . |
-
On entry, there is not a one-to-one correspondence between the old variables and the new variables; at least one of the original variables is not included in the new set, and consequently at least one other variable has been included more than once.
An unexpected error has been triggered by this routine. Please
contact
NAG.
See
Section 3.8 in the Essential Introduction for further information.
Your licence key may have expired or may not have been installed correctly.
See
Section 3.7 in the Essential Introduction for further information.
Dynamic memory allocation failed.
See
Section 3.6 in the Essential Introduction for further information.
7 Accuracy
Not applicable.
8 Parallelism and Performance
Not applicable.
The time taken by G02CFF depends on and the amount of re-arrangement involved.
The routine is intended primarily for use when a set of variables is to be reordered for use in a regression, and is described accordingly. There is however no reason why the routine should not also be used to reorder vectors and matrices which contain any other non-statistical information; the matrices need not be symmetric.
The routine may be used either with sums of squares and cross-products of deviations from means and Pearson product-moment correlation coefficients in connection with a regression involving a constant, or with sums of squares and cross-products about zero and correlation-like coefficients in connection with a regression with no constant.
10 Example
This example reads in the means, standard deviations, sums of squares and cross-products, and correlation coefficients for three variables. The vectors and matrices are reordered so that they contain the means, standard deviations, sums of squares and cross-products, and correlation coefficients for the first, third and second variables (in that order). Finally the reordered vectors and matrices are printed.
10.1 Program Text
Program Text (g02cffe.f90)
10.2 Program Data
Program Data (g02cffe.d)
10.3 Program Results
Program Results (g02cffe.r)