g02cf 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).

Syntax

C#
public static void g02cf(
	int n,
	int[] korder,
	double[] xbar,
	double[] std,
	double[,] ssp,
	double[,] r,
	out int ifail
)
Visual Basic
Public Shared Sub g02cf ( _
	n As Integer, _
	korder As Integer(), _
	xbar As Double(), _
	std As Double(), _
	ssp As Double(,), _
	r As Double(,), _
	<OutAttribute> ByRef ifail As Integer _
)
Visual C++
public:
static void g02cf(
	int n, 
	array<int>^ korder, 
	array<double>^ xbar, 
	array<double>^ std, 
	array<double,2>^ ssp, 
	array<double,2>^ r, 
	[OutAttribute] int% ifail
)
F#
static member g02cf : 
        n : int * 
        korder : int[] * 
        xbar : float[] * 
        std : float[] * 
        ssp : float[,] * 
        r : float[,] * 
        ifail : int byref -> unit 

Parameters

n
Type: System..::..Int32
On entry: n, the number of variables in the input data.
Constraint: n2.
korder
Type: array<System..::..Int32>[]()[][]
An array of size [n]
On entry: korder[i-1] must be set to the number of the original variable which is to be the ith variable in the re-arranged data, for i=1,2,,n.
Constraint: 1korder[i]n, for i=0,1,,n-1.
xbar
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: xbar[i-1] must be set to the mean of variable i, for i=1,2,,n.
On exit: xbar[i-1] contains the mean of variable k where k=korder[i-1], for i=1,2,,n.
std
Type: array<System..::..Double>[]()[][]
An array of size [n]
On entry: std[i-1] must be set to the standard deviation of variable i, for i=1,2,,n.
On exit: std[i-1] contains the standard deviation of variable k where k=korder[i-1], for i=1,2,,n.
ssp
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, n]
Note: dim1 must satisfy the constraint: dim1n
On entry: ssp[i-1,j-1] must be set to the sum of cross-products of deviations from means Sij (or about zero S~ij) for variables i and j, for i=1,2,,n and j=1,2,,n.
On exit: ssp[i-1,j-1] contains the sum of cross-products of deviations from means Skl (or about zero S~kl) for variables k and l, where k=korder[i-1], and l=korder[j-1], i,j=1,2,,n.
r
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, n]
Note: dim1 must satisfy the constraint: dim1n
On entry: r[i-1,j-1] must be set to the Pearson product-moment correlation coefficient Rij (or the correlation-like coefficient R~ij) for variables i and j, for i=1,2,,n and j=1,2,,n.
On exit: r[i-1,j-1] contains the Pearson product-moment correlation coefficient Rkl (or the correlation-like coefficient R~kl) for variables k and l, where k=korder[i-1] and l=korder[j-1], for i=1,2,,n and j=1,2,,n.
ifail
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).

Description

Input to the method consists of:
(a) A list of the order in which the n variables are to be arranged on exit:
i1,i2,i3,,in.
(b) A vector of means:
x-1,x-2,x-3,,x-n.
(c) A vector of standard deviations:
s1,s2,s3,,sn.
(d) A matrix of sums of squares and cross-products of deviations from means:
S11S12S13...S1nS21S22.S31.......Sn1Sn2....Snn.
(e) A matrix of correlation coefficients:
R11R12R13...R1nR21R22.R31.......Rn1Rn2....Rnn.
On exit from the method, these same vectors and matrices are reordered, in the manner specified, and contain the following information:
(i) The vector of means:
x-i1,x-i2,x-i3,,x-in.
(ii) The vector of standard deviations:
si1,si2,si3,sin.
(iii) The matrix of sums of squares and cross-products of deviations from means:
Si1i1Si1i2Si1i3...Si1inSi2i1Si2i2.Si3i1.......Sini1Sini2....Sinin.
(iv) The matrix of correlation coefficients:
Ri1i1Ri1i2Ri1i3...Ri1inRi2i1Ri2i2.Ri3i1.......Rini1Rini2....Rinin.
Note:  for sums of squares of cross-products of deviations about zero and correlation-like coefficients Sij and Rij should be replaced by S~ij and R~ij in the description of the input and output above.

References

None.

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDSSP, LDR) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
ifail=1
On entry,n<2.
ifail=3
On entry,korder[i-1]<1,
orkorder[i-1]>n for some i=1,2,,n.
ifail=4
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.
ifail=-9000
An error occured, see message report.
ifail=-6000
Invalid Parameters value
ifail=-4000
Invalid dimension for array value
ifail=-8000
Negative dimension for array value
ifail=-6000
Invalid Parameters value

Accuracy

Not applicable.

Parallelism and Performance

None.

Further Comments

The time taken by g02cf depends on n and the amount of re-arrangement involved.
The method 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 method should not also be used to reorder vectors and matrices which contain any other non-statistical information; the matrices need not be symmetric.
The method 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.

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.

Example program (C#): g02cfe.cs

Example program data: g02cfe.d

Example program results: g02cfe.r

See Also