2 Specification

3 Description

Let X and Y denote two sets of data, each with m variables and nx and ny observations respectively. Let μx denote the (optionally weighted) vector of m means for the first dataset and Cx denote either the sums of squares and cross-products of deviations from μx

Cx=X-e⁢μxTT⁢Dx⁢X-e⁢μxT

or the sums of squares and cross-products, in which case

Cx=XT⁢Dx⁢X

where e is a vector of n ones and Dx is a diagonal matrix of (optional) weights, with the sum of the diagonal elements of Dx equal to Wx. Similarly, let μy, Cy and Wy denote the same quantities for the second dataset.

Given μx,μy,Cx,Cy,Wx and Wy G02BZF calculates μz, Cz and Wz as if a dataset Z, with m variables and nx+ny observations were supplied to G02BUF, with Z constructed as

Z=XY.

G02BZF has been designed to combine the results from two calls to G02BUF allowing large datasets, or cases where all the data is not available at the same time, to be summarised.

On entry: Cy, the sums of squares and cross-products matrix for the second set of data, Y, as returned by G02BUF.

G02BUF, returns this matrix packed by columns, i.e., the cross-product between the jth and kth variable, k≥j, is stored in YCk×k-1/2+j.

No check is made that Cy is a valid cross-products matrix.

9: IFAIL – INTEGERInput/Output

On entry: IFAIL must be set to 0, -1​ 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​ 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 -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:

IFAIL=11

On entry, MEAN=value. Constraint: MEAN='M' or 'Z'.

IFAIL=21

On entry, M=value. Constraint: M≥1.

IFAIL=31

On entry, XSW=value. Constraint: XSW≥0.0.

IFAIL=61

On entry, YSW=value. Constraint: YSW≥0.0.

7 Accuracy

Not applicable.

8 Further Comments

None.

9 Example

This example illustrates the use of G02BZF by dividing a dataset into three blocks of 4, 5 and 3 observations respectively. Each block of data is summarised using G02BUF and then the three summaries combined using G02BZF.

The resulting sums of squares and cross-products matrix is then scaled to obtain the covariance matrix for the whole dataset.