g01abf computes the means, standard deviations, corrected sums of squares and products, maximum and minimum values, and the product-moment correlation coefficient for two variables. Unequal weighting may be given.
The routine may be called by the names g01abf or nagf_stat_summary_2var.
3Description
The data consist of two samples of observations, denoted by , and , for , with corresponding weights , for .
If no specific weighting is given, then each is set to in g01abf.
The quantities calculated are:
(a)The sum of weights,
(b)The means,
(c)The corrected sums of squares and products
(d)The standard deviations
(e)The product-moment correlation coefficient
(f)The minimum and maximum elements in each of the two samples.
(g)The number of pairs of observations, , for which , i.e., the number of valid observations. The quantities in (d) and (e) above will only be computed if . All other items are computed if .
4References
None.
5Arguments
1: – IntegerInput
On entry: , the number of pairs of observations.
Constraint:
.
2: – Real (Kind=nag_wp) arrayInput
On entry: the observations from the first sample,
, for .
3: – Real (Kind=nag_wp) arrayInput
On entry: the observations from the second sample,
, for .
4: – IntegerInput/Output
On entry: indicates whether user-supplied weights are provided by you:
Indicates that user-supplied weights are given in the array wt.
Indicates that user-supplied weights are not given. In this case the routine assigns the value to each element of the weight array, wt.
On exit: is used to indicate the number of valid observations, ; see Section 3(g), above.
5: – Real (Kind=nag_wp) arrayInput/Output
On entry: if weights are being supplied then the elements of wt must contain the weights associated with the observations,
, for .
Constraint:
if ,
, for .
On exit: if , the elements of wt are unchanged, otherwise each element of wt will be assigned the value .
6: – Real (Kind=nag_wp) arrayOutput
On exit: the elements of res contain the following results:
mean of the first sample, ;
mean of the second sample, ;
standard deviation of the first sample, ;
standard deviation of the second sample, ;
corrected sum of squares of the first sample, ;
corrected sum of products of the two samples, ;
corrected sum of squares of the second sample, ;
product-moment correlation coefficient, ;
minimum of the first sample;
maximum of the first sample;
minimum of the second sample;
maximum of the second sample;
sum of weights, (, if , on entry).
7: – 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. 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:
On entry, .
Constraint: .
The number of valid cases, , is . In this case standard deviation and product-moment correlation coefficient cannot be calculated.
On entry, .
Constraint:
, for
The number of valid cases, , is .
An unexpected error has been triggered by this routine. Please
contact NAG.
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.
7Accuracy
The method used is believed to be stable.
8Parallelism and Performance
g01abf is not threaded in any implementation.
9Further Comments
The time taken by g01abf increases linearly with .
10Example
In the program below, NPROB determines the number of datasets to be analysed. For each analysis, a set of observations and, optionally, weights, is read and printed. After calling g01abf, all the calculated quantities are printed. In the example, there is one set of data, with (unweighted) pairs of observations.