g02bzf combines two sets of sample means and sums of squares and cross-products matrices. It is designed to be used in conjunction with
g02buf to allow large datasets to be summarised.
Let
and
denote two sets of data, each with
variables and
and
observations respectively. Let
denote the (optionally weighted) vector of
means for the first dataset and
denote either the sums of squares and cross-products of deviations from
or the sums of squares and cross-products, in which case
where
is a vector of
ones and
is a diagonal matrix of (optional) weights and
is defined as the sum of the diagonal elements of
. Similarly, let
,
and
denote the same quantities for the second dataset.
Given
and
g02bzf calculates
,
and
as if a dataset
, with
variables and
observations were supplied to
g02buf, with
constructed as
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.
Bennett J, Pebay P, Roe D and Thompson D (2009) Numerically stable, single-pass, parallel statistics algorithms Proceedings of IEEE International Conference on Cluster Computing
-
1:
– Character(1)
Input
-
On entry: indicates whether the matrices supplied in
xc and
yc are sums of squares and cross-products, or sums of squares and cross-products of deviations about the mean.
- Sums of squares and cross-products of deviations about the mean have been supplied.
- Sums of squares and cross-products have been supplied.
Constraint:
or .
-
2:
– Integer
Input
-
On entry: , the number of variables.
Constraint:
.
-
3:
– Real (Kind=nag_wp)
Input/Output
-
On entry: , the sum of weights, from the first set of data, . If the data is unweighted then this will be the number of observations in the first dataset.
On exit: , the sum of weights, from the combined dataset, . If both datasets are unweighted then this will be the number of observations in the combined dataset.
Constraint:
.
-
4:
– Real (Kind=nag_wp) array
Input/Output
-
On entry: , the sample means for the first set of data, .
On exit: , the sample means for the combined data, .
-
5:
– Real (Kind=nag_wp) array
Input/Output
Note: the dimension of the array
xc
must be at least
.
On entry:
, the sums of squares and cross-products matrix for the first set of data,
, as returned by
g02buf.
g02buf, returns this matrix packed by columns, i.e., the cross-product between the
th and
th variable,
, is stored in
.
No check is made that is a valid cross-products matrix.
On exit:
, the sums of squares and cross-products matrix for the combined dataset,
.
This matrix is again stored packed by columns.
-
6:
– Real (Kind=nag_wp)
Input
-
On entry: , the sum of weights, from the second set of data, . If the data is unweighted then this will be the number of observations in the second dataset.
Constraint:
.
-
7:
– Real (Kind=nag_wp) array
Input
-
On entry: , the sample means for the second set of data, .
-
8:
– Real (Kind=nag_wp) array
Input
Note: the dimension of the array
yc
must be at least
.
On entry:
, the sums of squares and cross-products matrix for the second set of data,
, as returned by
g02buf.
g02buf, returns this matrix packed by columns, i.e., the cross-product between the
th and
th variable,
, is stored in
.
No check is made that is a valid cross-products matrix.
-
9:
– Integer
Input/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).
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Not applicable.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the
Users' Note for your implementation for any additional implementation-specific information.
None.
This example illustrates the use of
g02bzf by dividing a dataset into three blocks of
,
and
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.