g02by computes a partial correlation/variance-covariance matrix from a correlation or variance-covariance matrix computed by g02bx.


public static void g02by(
	int m,
	int ny,
	int nx,
	int[] isz,
	double[,] r,
	double[,] p,
	out int ifail
Visual Basic
Public Shared Sub g02by ( _
	m As Integer, _
	ny As Integer, _
	nx As Integer, _
	isz As Integer(), _
	r As Double(,), _
	p As Double(,), _
	<OutAttribute> ByRef ifail As Integer _
Visual C++
static void g02by(
	int m, 
	int ny, 
	int nx, 
	array<int>^ isz, 
	array<double,2>^ r, 
	array<double,2>^ p, 
	[OutAttribute] int% ifail
static member g02by : 
        m : int * 
        ny : int * 
        nx : int * 
        isz : int[] * 
        r : float[,] * 
        p : float[,] * 
        ifail : int byref -> unit 


Type: System..::..Int32
On entry: the number of variables in the variance-covariance/correlation matrix given in r.
Constraint: m3.
Type: System..::..Int32
On entry: the number of Y variables, ny, for which partial correlation coefficients are to be computed.
Constraint: ny2.
Type: System..::..Int32
On entry: the number of X variables, nx, which are to be considered as fixed.
  • nx1;
  • ny+nxm.
Type: array<System..::..Int32>[]()[][]
An array of size [m]
On entry: indicates which variables belong to set X and Y.
The ith variable is a Y variable, for i=1,2,,m.
The ith variable is a X variable.
The ith variable is not included in the computations.
  • exactly ny elements of isz must be <0;
  • exactly nx elements of isz must be >0.
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, m]
Note: dim1 must satisfy the constraint: dim1m
On entry: the variance-covariance or correlation matrix for the m variables as given by g02bx. Only the upper triangle need be given.
Note:  the matrix must be a full rank variance-covariance or correlation matrix and so be positive definite. This condition is not directly checked by the method.
Type: array<System..::..Double,2>[,](,)[,][,]
An array of size [dim1, ny]
Note: dim1 must satisfy the constraint: dim1ny
On exit: the strict upper triangle of p contains the strict upper triangular part of the ny by ny partial correlation matrix. The lower triangle contains the lower triangle of the ny by ny partial variance-covariance matrix if the matrix given in r is a variance-covariance matrix. If the matrix given in r is a partial correlation matrix then the variance-covariance matrix is for standardized variables.
Type: System..::..Int32%
On exit: ifail=0 unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).


Partial correlation can be used to explore the association between pairs of random variables in the presence of other variables. For three variables, y1, y2 and x3, the partial correlation coefficient between y1 and y2 given x3 is computed as:
where rij is the product-moment correlation coefficient between variables with subscripts i and j. The partial correlation coefficient is a measure of the linear association between y1 and y2 having eliminated the effect due to both y1 and y2 being linearly associated with x3. That is, it is a measure of association between y1 and y2 conditional upon fixed values of x3. Like the full correlation coefficients the partial correlation coefficient takes a value in the range (-1,1) with the value 0 indicating no association.
In general, let a set of variables be partitioned into two groups Y and X with ny variables in Y and nx variables in X and let the variance-covariance matrix of all ny+nx variables be partitioned into,
The variance-covariance of Y conditional on fixed values of the X variables is given by:
The partial correlation matrix is then computed by standardizing Σyx,
To test the hypothesis that a partial correlation is zero under the assumption that the data has an approximately Normal distribution a test similar to the test for the full correlation coefficient can be used. If r is the computed partial correlation coefficient then the appropriate t statistic is
which has approximately a Student's t-distribution with n-nx-2 degrees of freedom, where n is the number of observations from which the full correlation coefficients were computed.


Krzanowski W J (1990) Principles of Multivariate Analysis Oxford University Press
Morrison D F (1967) Multivariate Statistical Methods McGraw–Hill
Osborn J F (1979) Statistical Exercises in Medical Research Blackwell
Snedecor G W and Cochran W G (1967) Statistical Methods Iowa State University Press

Error Indicators and Warnings

Errors or warnings detected by the method:
Some error messages may refer to parameters that are dropped from this interface (LDR, LDP) In these cases, an error in another parameter has usually caused an incorrect value to be inferred.
On entry,m<3,
On entry,there are not exactly ny elements of isz<0,
orthere are not exactly nx elements of isz>0.
On entry, the variance-covariance/correlation matrix of the X variables, Σxx, is not of full rank. Try removing some of the X variables by setting the appropriate element of isz=0.
Either a diagonal element of the partial variance-covariance matrix, Σyx, is zero and/or a computed partial correlation coefficient is greater than one. Both indicate that the matrix input in r was not positive definite.
An error occured, see message report.
Invalid Parameters value
Invalid dimension for array value
Negative dimension for array value
Invalid Parameters value


g02by computes the partial variance-covariance matrix, Σyx, by computing the Cholesky factorization of Σxx. If Σxx is not of full rank the computation will fail. For a statement on the accuracy of the Cholesky factorization see (F07GDF not in this release).

Parallelism and Performance


Further Comments

Models that represent the linear associations given by partial correlations can be fitted using the multiple regression method g02da.


See Also