g02ba computes means and standard deviations of variables, sums of squares and cross-products of deviations from means, and Pearson product-moment correlation coefficients for a set of data.
Syntax
C# |
---|
public static void g02ba( int n, int m, double[,] x, double[] xbar, double[] std, double[,] ssp, double[,] r, out int ifail ) |
Visual Basic |
---|
Public Shared Sub g02ba ( _ n As Integer, _ m As Integer, _ x As Double(,), _ xbar As Double(), _ std As Double(), _ ssp As Double(,), _ r As Double(,), _ <OutAttribute> ByRef ifail As Integer _ ) |
Visual C++ |
---|
public: static void g02ba( int n, int m, array<double,2>^ x, array<double>^ xbar, array<double>^ std, array<double,2>^ ssp, array<double,2>^ r, [OutAttribute] int% ifail ) |
F# |
---|
static member g02ba : n : int * m : int * x : float[,] * xbar : float[] * std : float[] * ssp : float[,] * r : float[,] * ifail : int byref -> unit |
Parameters
- n
- Type: System..::..Int32On entry: , the number of observations or cases.Constraint: .
- m
- Type: System..::..Int32On entry: , the number of variables.Constraint: .
- x
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, m]Note: dim1 must satisfy the constraint:On entry: must be set to , the th observation on the th variable, for and .
- xbar
- Type: array<System..::..Double>[]()[][]An array of size [m]On exit: the mean value, , of the th variable, for .
- std
- Type: array<System..::..Double>[]()[][]An array of size [m]On exit: the standard deviation, , of the th variable, for .
- ssp
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, m]Note: dim1 must satisfy the constraint:On exit: is the cross-product of deviations , for and .
- r
- Type: array<System..::..Double,2>[,](,)[,][,]An array of size [dim1, m]Note: dim1 must satisfy the constraint:On exit: is the product-moment correlation coefficient between the th and th variables, for and .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Description
The input data consist of observations for each of variables, given as an array
where is the th observation on the th variable.
The quantities calculated are:
(a) | Means:
|
||
(b) | Standard deviations:
|
||
(c) | Sums of squares and cross-products of deviations from means:
|
||
(d) | Pearson product-moment correlation coefficients:
|
References
None.
Error Indicators and Warnings
Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface
(LDX, LDSSP, LDR) In these
cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry, .
On entry, .
Accuracy
g02ba does not use additional precision arithmetic for the accumulation of scalar products, so there may be a loss of significant figures for large .
Parallelism and Performance
None.
Further Comments
The time taken by g02ba depends on and .
The method uses a two-pass algorithm.
Example
This example reads in a set of data consisting of five observations on each of three variables. The means, standard deviations, sums of squares and cross-products of deviations from means, and Pearson product-moment correlation coefficients for all three variables are then calculated and printed.
Example program (C#): g02bae.cs