g02bx calculates the sample means, the standard deviations, the variance-covariance matrix, and the matrix of Pearson product-moment correlation coefficients for a set of data. Weights may be used.
- Type: System..::..StringOn entry: indicates whether weights are to be used.
Constraint: , or .
- Weights are not used and unit weights are assumed.
- Weights are used and must be supplied in wt. The only difference between or is in computing the variance. If the divisor for the variance is the sum of the weights minus one and if the divisor is the number of observations with nonzero weights minus one. The former is useful if the weights represent the frequency of the observed values.
- Type: System..::..Int32On entry: the number of data observations in the sample.Constraint: .
- Type: System..::..Int32On entry: the number of variables.Constraint: .
- Type: array<System..::..Double,2>[,](,)[,][,]Note: dim1 must satisfy the constraint:On entry: must contain the th observation for the th variable, for and .
- Type: array<System..::..Double>()An array of size [dim1]Note: the dimension of the array wt must be at least if or , and at least otherwise.On entry: , the optional frequency weighting for each observation, with . Usually will be an integral value corresponding to the number of observations associated with the th data value, or zero if the th data value is to be ignored. If , is set to for all and wt is not referenced.Constraint: if or , , , for .
- Type: array<System..::..Double>()An array of size [m]On exit: the sample means. contains the mean of the th variable.
- Type: array<System..::..Double>()An array of size [m]On exit: the standard deviations. contains the standard deviation for the th variable.
- Type: array<System..::..Double,2>[,](,)[,][,]Note: dim1 must satisfy the constraint:On exit: the variance-covariance matrix. contains the covariance between variables and , for and .
- Type: array<System..::..Double,2>[,](,)[,][,]Note: dim1 must satisfy the constraint:On exit: the matrix of Pearson product-moment correlation coefficients. contains the correlation coefficient between variables and .
For observations on variables the one-pass algorithm of West (1979) as implemented in g02bu is used to compute the means, the standard deviations, the variance-covariance matrix, and the Pearson product-moment correlation matrix for selected variables. Suitables weights may be used to indicate multiple observations and to remove missing values. The quantities are defined by:
(a) The means
(b) The variance-covariance matrix
(c) The standard deviations
(d) The Pearson product-moment correlation coefficients
where is the value of the th observation on the th variable and is the weight for the th observation which will be 1 in the unweighted case.
Note that the denominator for the variance-covariance is , so the weights should be scaled so that the sum of weights reflects the true sample size.
Chan T F, Golub G H and Leveque R J (1982) Updating Formulae and a Pairwise Algorithm for Computing Sample Variances Compstat, Physica-Verlag
West D H D (1979) Updating mean and variance estimates: An improved method Comm. ACM 22 532–555
Note: g02bx may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDX, LDV) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, , or , On entry, , or . On entry, or and a value of .
- and the sum of weights is not greater than , or and fewer than observations have nonzero weights.
The data are some of the results from 1988 Olympic Decathlon. They are the times (in seconds) for the 100m and 400m races and the distances (in metres) for the long jump, high jump and shot. Twenty observations are input and the correlation matrix is computed and printed.