P_CORRELATE

The P_CORRELATE function computes the partial correlation coefficient of a dependent variable and one particular independent variable when the effects of all other variables involved are removed.

To compute the partial correlation, the following method is used:

  1. Let Y and X be the variables of primary interest and let C1...Cp be the variables held fixed.
  2. Calculate the residuals after regressing Y on C1...Cp. (These are the parts of Y that cannot be predicted by C1...Cp.)
  3. Calculate the residuals after regressing X on C1...Cp. (These are the parts of X that cannot be predicted by C1...Cp.)
  4. The partial correlation coefficient between Y and X adjusted for C1...Cp is the correlation between these two sets of residuals.

This routine is written in the IDL language. Its source code can be found in the file p_correlate.pro in the lib subdirectory of the IDL distribution.

Examples

; Define three sample populations:

X0 = [64, 71, 53, 67, 55, 58, 77, 57, 56, 51, 76, 68]

X1 = [57, 59, 49, 62, 51, 50, 55, 48, 52, 42, 61, 57]

X2 = [ 8, 10, 6, 11, 8, 7, 10, 9, 10, 6, 12, 9]



; Compute the partial correlation of X0 and X1 with the effects

; of X2 removed.

result = P_CORRELATE(X0, X1, X2)



PRINT, result

IDL prints:

0.533469

Syntax

Result = P_CORRELATE( X, Y, C [, /DOUBLE] )

Return Value

Returns the correlation coefficient.

Arguments

X

An n-element integer, single-, or double-precision floating-point vector that specifies the independent variable data.

Y

An n-element integer, single-, or double-precision floating-point vector that specifies the dependent variable data.

C

An integer, single-, or double-precision floating-point array that specifies the independent variable data whose effects are to be removed. C may either be an n‑element vector containing the independent variable, or a p-by-n two-dimensional array in which each column corresponds to a separate independent variable.

Keywords

DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

Version History

4.0

Introduced

Resources and References

J. Neter, W. Wasserman, G.A. Whitmore, Applied Statistics (Third Edition), Allyn and Bacon (ISBN 0-205-10328-6).

See Also

A_CORRELATE, C_CORRELATE, CORRELATE, M_CORRELATE, R_CORRELATE