The input data consist of
observations for each of
variables, given as an array
where
is the
th observation on the
th variable, together with the subset of these variables,
, for which information is required.
The quantities calculated are:
(a) |
Means:
|
(b) |
Standard deviations:
|
(c) |
Sums of squares and cross-products of deviations from zero:
|
(d) |
Pearson product-moment correlation coefficients:
If or is zero, is set to zero. |
None.
- 1: – IntegerInput
-
On entry: , the number of observations or cases.
Constraint:
.
- 2: – IntegerInput
-
On entry: , the number of variables.
Constraint:
.
- 3: – Real (Kind=nag_wp) arrayInput
-
On entry: must be set to , the value of the th observation on the th variable, for and .
- 4: – IntegerInput
-
On entry: the first dimension of the array
x as declared in the (sub)program from which
g02bgf is called.
Constraint:
.
- 5: – IntegerInput
-
On entry: , the number of variables for which information is required.
Constraint:
.
- 6: – Integer arrayInput
-
On entry:
must be set to the column number in
x of the
th variable for which information is required, for
.
Constraint:
, for .
- 7: – Real (Kind=nag_wp) arrayOutput
-
On exit: the mean value,
, of the variable specified in , for .
- 8: – Real (Kind=nag_wp) arrayOutput
-
On exit: the standard deviation,
, of the variable specified in , for .
- 9: – Real (Kind=nag_wp) arrayOutput
-
On exit: is the cross-product of deviations, , for the variables specified in and , for and .
- 10: – IntegerInput
-
On entry: the first dimension of the array
ssp as declared in the (sub)program from which
g02bgf is called.
Constraint:
.
- 11: – Real (Kind=nag_wp) arrayOutput
-
On exit: is the product-moment correlation coefficient, , between the variables specified in and , for and .
- 12: – IntegerInput
-
On entry: the first dimension of the array
r as declared in the (sub)program from which
g02bgf is called.
Constraint:
.
- 13: – IntegerInput/Output
-
On entry:
ifail must be set to
,
. If you are unfamiliar with this argument you should refer to
Section 3.4 in How to Use the NAG Library and its Documentation 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 argument, 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).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
The routine uses a two pass algorithm.
This example reads in a set of data consisting of five observations on each of four variables. The means, standard deviations, sums of squares and cross-products of deviations from means, and Pearson product-moment correlation coefficients for the fourth, first and second variables are then calculated and printed.