NAG FL Interface
g01auf (summary_​onevar_​combine)

Settings help

FL Name Style:

FL Specification Language:

1 Purpose

g01auf combines sets of summaries produced by g01atf.

2 Specification

Fortran Interface
Subroutine g01auf ( b, mrcomm, pn, xmean, xsd, xskew, xkurt, xmin, xmax, rcomm, ifail)
Integer, Intent (In) :: b
Integer, Intent (Inout) :: ifail
Integer, Intent (Out) :: pn
Real (Kind=nag_wp), Intent (In) :: mrcomm(20,b)
Real (Kind=nag_wp), Intent (Out) :: xmean, xsd, xskew, xkurt, xmin, xmax, rcomm(*)
C Header Interface
#include <nag.h>
void  g01auf_ (const Integer *b, const double mrcomm[], Integer *pn, double *xmean, double *xsd, double *xskew, double *xkurt, double *xmin, double *xmax, double rcomm[], Integer *ifail)
The routine may be called by the names g01auf or nagf_stat_summary_onevar_combine.

3 Description

Assume a dataset containing n observations, denoted by x = {xi:i=1,2,,n} and a set of weights, w = {wi:i=1,2,,n} , has been split into b blocks, and each block summarised via a call to g01atf. Then g01auf takes the b communication arrays returned by g01atf and returns the mean (x¯), standard deviation (s2), coefficients of skewness (s3) and kurtosis (s4), and the maximum and minimum values for the whole dataset.
For a definition of x¯,s2,s3 and s4 see Section 3 in g01atf.

4 References

West D H D (1979) Updating mean and variance estimates: An improved method Comm. ACM 22 532–555

5 Arguments

1: b Integer Input
On entry: b, the number of blocks the full dataset was split into.
Constraint: b1.
2: mrcomm(20,b) Real (Kind=nag_wp) array Communication Array
On entry: the jth column of mrcomm must contain the information returned in rcomm from one of the runs of g01atf.
3: pn Integer Output
On exit: the number of valid observations, that is the number of observations with wi>0, for i=1,2,,n.
4: xmean Real (Kind=nag_wp) Output
On exit: x¯, the mean.
5: xsd Real (Kind=nag_wp) Output
On exit: s2, the standard deviation.
6: xskew Real (Kind=nag_wp) Output
On exit: s3, the coefficient of skewness.
7: xkurt Real (Kind=nag_wp) Output
On exit: s4, the coefficient of kurtosis.
8: xmin Real (Kind=nag_wp) Output
On exit: the smallest value.
9: xmax Real (Kind=nag_wp) Output
On exit: the largest value.
10: rcomm(*) Real (Kind=nag_wp) array Communication Array
Note: the dimension of the array rcomm must be at least 20.
On exit: an amalgamation of the information held in mrcomm. This is in the same format as rcomm from g01atf.
11: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
On entry, b=value.
Constraint: b1.
On entry, mrcomm is not in the expected format.
On entry, the number of valid observations is zero.
On exit we were unable to calculate xskew or xkurt. A value of 0 has been returned.
On exit we were unable to calculate xsd, xskew or xkurt. A value of 0 has been returned.
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.

7 Accuracy

Not applicable.

8 Parallelism and Performance

g01auf is not threaded in any implementation.

9 Further Comments

The order that the b communication arrays are stored in mrcomm is arbitrary. Different orders can lead to slightly different results due to numerical accuracy of floating-point calculations.
Both g01auf and g01atf consolidate results from multiple summaries. Whereas the former can only be used to combine summaries calculated sequentially, the latter combines summaries calculated in an arbitrary order allowing, for example, summaries calculated on different processing units to be combined.

10 Example

This example summarises some simulated data. The data is supplied in three blocks, the first consisting of 21 observations, the second 51 observations and the last 28 observations. Summaries are produced for each block of data separately and then an overall summary is produced.

10.1 Program Text

Program Text (g01aufe.f90)

10.2 Program Data

Program Data (g01aufe.d)

10.3 Program Results

Program Results (g01aufe.r)