naginterfaces.library.correg.ssqmat_combine¶

naginterfaces.library.correg.
ssqmat_combine
(xsw, xmean, xc, ysw, ymean, yc, mean='M')[source]¶ ssqmat_combine
combines two sets of sample means and sums of squares and crossproducts matrices. It is designed to be used in conjunction withssqmat()
to allow large datasets to be summarised.For full information please refer to the NAG Library document for g02bz
https://www.nag.com/numeric/nl/nagdoc_27.1/flhtml/g02/g02bzf.html
 Parameters
 xswfloat
, 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.
 xmeanfloat, arraylike, shape
, the sample means for the first set of data, .
 xcfloat, arraylike, shape
, the sums of squares and crossproducts matrix for the first set of data, , as returned by
ssqmat()
.ssqmat()
, returns this matrix packed by columns, i.e., the crossproduct between the th and th variable, , is stored in .No check is made that is a valid crossproducts matrix.
 yswfloat
, 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.
 ymeanfloat, arraylike, shape
, the sample means for the second set of data, .
 ycfloat, arraylike, shape
, the sums of squares and crossproducts matrix for the second set of data, , as returned by
ssqmat()
.ssqmat()
, returns this matrix packed by columns, i.e., the crossproduct between the th and th variable, , is stored in .No check is made that is a valid crossproducts matrix.
 meanstr, length 1, optional
Indicates whether the matrices supplied in and are sums of squares and crossproducts, or sums of squares and crossproducts of deviations about the mean.
Sums of squares and crossproducts of deviations about the mean have been supplied.
Sums of squares and crossproducts have been supplied.
 Returns
 xswfloat
, 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.
 xmeanfloat, ndarray, shape
, the sample means for the combined data, .
 xcfloat, ndarray, shape
, the sums of squares and crossproducts matrix for the combined dataset, .
This matrix is again stored packed by columns.
 Raises
 NagValueError
 (errno )
On entry, .
Constraint: .
 (errno )
On entry, .
Constraint: .
 (errno )
On entry, .
Constraint: .
 (errno )
On entry, .
Constraint: .
 Notes
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 crossproducts of deviations from
or the sums of squares and crossproducts, 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
ssqmat_combine
calculates , and as if a dataset , with variables and observations were supplied tossqmat()
, with constructed asssqmat_combine
has been designed to combine the results from two calls tossqmat()
allowing large datasets, or cases where all the data is not available at the same time, to be summarised.
 References
Bennett, J, Pebay, P, Roe, D and Thompson, D, 2009, Numerically stable, singlepass, parallel statistics algorithms, Proceedings of IEEE International Conference on Cluster Computing