G01 Chapter Contents
G01 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentG01AUF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

G01AUF combines sets of summaries produced by G01ATF.

## 2  Specification

 SUBROUTINE G01AUF ( B, MRCOMM, PN, XMEAN, XSD, XSKEW, XKURT, XMIN, XMAX, RCOMM, IFAIL)
 INTEGER B, PN, IFAIL REAL (KIND=nag_wp) MRCOMM(20,B), XMEAN, XSD, XSKEW, XKURT, XMIN, XMAX, RCOMM(20)

## 3  Description

Assume a dataset containing $n$ observations, denoted by $x=\left\{{x}_{i}:i=1,2,\dots ,n\right\}$ and a set of weights, $w=\left\{{w}_{i}:i=1,2,\dots ,n\right\}$, 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 ($\stackrel{-}{x}$), standard deviation (${s}_{2}$), coefficients of skewness (${s}_{3}$) and kurtosis (${s}_{4}$), and the maximum and minimum values for the whole dataset.
For a definition of $\stackrel{-}{x},{s}_{2},{s}_{3}$ and ${s}_{4}$ 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  Parameters

1:     B – INTEGERInput
On entry: $b$, the number of blocks the full dataset was split into.
Constraint: ${\mathbf{B}}\ge 1$.
2:     MRCOMM($20$,${\mathbf{B}}$) – REAL (KIND=nag_wp) arrayCommunication Array
On entry: each column of MRCOMM must contain the information returned in RCOMM from one of the runs of G01ATF.
3:     PN – INTEGEROutput
On exit: the number of valid observations, that is the number of observations with ${w}_{i}>0$, for $\mathit{i}=1,2,\dots ,n$.
4:     XMEAN – REAL (KIND=nag_wp)Output
On exit: $\stackrel{-}{x}$, the mean.
5:     XSD – REAL (KIND=nag_wp)Output
On exit: ${s}_{2}$, the standard deviation.
6:     XSKEW – REAL (KIND=nag_wp)Output
On exit: ${s}_{3}$, the coefficient of skewness.
7:     XKURT – REAL (KIND=nag_wp)Output
On exit: ${s}_{4}$, 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($20$) – REAL (KIND=nag_wp) arrayCommunication Array
On exit: an amalgamation of the information held in MRCOMM. This is in the same format as RCOMM from G01ATF.
11:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. 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 $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=11$
On entry, ${\mathbf{B}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{B}}\ge 1$.
${\mathbf{IFAIL}}=21$
On entry, MRCOMM is not in the expected format.
${\mathbf{IFAIL}}=31$
On entry, the number of valid observations is zero.
${\mathbf{IFAIL}}=51$
On exit we were unable to calculate XSKEW or XKURT. A value of $0$ has been returned.
${\mathbf{IFAIL}}=52$
On exit we were unable to calculate XSD, XSKEW or XKURT. A value of $0$ has been returned.

Not applicable.

## 8  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.

## 9  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.

### 9.1  Program Text

Program Text (g01aufe.f90)

### 9.2  Program Data

Program Data (g01aufe.d)

### 9.3  Program Results

Program Results (g01aufe.r)