nag_summary_stats_onevar_combine (g01auc) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_summary_stats_onevar_combine (g01auc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_summary_stats_onevar_combine (g01auc) combines sets of summaries produced by nag_summary_stats_onevar (g01atc).

2  Specification

#include <nag.h>
#include <nagg01.h>
void  nag_summary_stats_onevar_combine (Integer b, const double mrcomm[], Integer *pn, double *xmean, double *xsd, double *xskew, double *xkurt, double *xmin, double *xmax, double rcomm[], NagError *fail)

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 nag_summary_stats_onevar (g01atc). Then nag_summary_stats_onevar_combine (g01auc) takes the b communication arrays returned by nag_summary_stats_onevar (g01atc) 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 nag_summary_stats_onevar (g01atc).

4  References

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

5  Arguments

1:     bIntegerInput
On entry: b, the number of blocks the full dataset was split into.
Constraint: b1.
2:     mrcomm[20×b]const doubleCommunication Array
Note: where MRCOMMi,j appears in this document, it refers to the array element mrcomm[j-1×20+i-1].
On entry: the jth column of MRCOMM must contain the information returned in rcomm from one of the runs of nag_summary_stats_onevar (g01atc).
3:     pnInteger *Output
On exit: the number of valid observations, that is the number of observations with wi>0, for i=1,2,,n.
4:     xmeandouble *Output
On exit: x-, the mean.
5:     xsddouble *Output
On exit: s2, the standard deviation.
6:     xskewdouble *Output
On exit: s3, the coefficient of skewness.
7:     xkurtdouble *Output
On exit: s4, the coefficient of kurtosis.
8:     xmindouble *Output
On exit: the smallest value.
9:     xmaxdouble *Output
On exit: the largest value.
10:   rcomm[20]doubleCommunication Array
On exit: an amalgamation of the information held in mrcomm. This is in the same format as rcomm from nag_summary_stats_onevar (g01atc).
If rcomm is NULL, rcomm is not referenced.
11:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

On entry, argument value had an illegal value.
On exit we were unable to calculate xsd, xskew or xkurt. A value of 0 has been returned.
On entry, the number of valid observations is zero.
On entry, mrcomm is not in the expected format.
On entry, b=value.
Constraint: b1.
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
On exit we were unable to calculate xskew or xkurt. A value of 0 has been returned.

7  Accuracy

Not applicable.

8  Parallelism and Performance

Not applicable.

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 nag_summary_stats_onevar_combine (g01auc) and nag_summary_stats_onevar (g01atc) 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 (g01auce.c)

10.2  Program Data

Program Data (g01auce.d)

10.3  Program Results

Program Results (g01auce.r)

nag_summary_stats_onevar_combine (g01auc) (PDF version)
g01 Chapter Contents
g01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014