M_CORRELATE
The M_CORRELATE function computes the multiple correlation coefficient of a dependent variable and two or more independent variables.
This routine is written in the IDL language. Its source code can be found in the file m_correlate.pro
in the lib
subdirectory of the IDL distribution.
Example
First, define the independent (X) and dependent (Y) data.
X = [[0.477121, 2.0, 13.0], $
[0.477121, 5.0, 6.0], $
[0.301030, 5.0, 9.0], $
[0.000000, 7.0, 5.5], $
[0.602060, 3.0, 7.0], $
[0.698970, 2.0, 9.5], $
[0.301030, 2.0, 17.0], $
[0.477121, 5.0, 12.5], $
[0.698970, 2.0, 13.5], $
[0.000000, 3.0, 12.5], $
[0.602060, 4.0, 13.0], $
[0.301030, 6.0, 7.5], $
[0.301030, 2.0, 7.5], $
[0.698970, 3.0, 12.0], $
[0.000000, 4.0, 14.0], $
[0.698970, 6.0, 11.5], $
[0.301030, 2.0, 15.0], $
[0.602060, 6.0, 8.5], $
[0.477121, 7.0, 14.5], $
[0.000000, 5.0, 9.5]]
Y = [97.682, 98.424, 101.435, 102.266, 97.067, 97.397, $
99.481, 99.613, 96.901, 100.152, 98.797, 100.796, $
98.750, 97.991, 100.007, 98.615, 100.225, 98.388, $
98.937, 100.617]
Next, compute the multiple correlations of Y.
; Compute the multiple correlation of Y on the first column of
; X. The result should be 0.798816.
PRINT, 'Multiple correlation of Y on 1st column of X:'
PRINT, M_CORRELATE(X[0,*], Y)
; Compute the multiple correlation of Y on the first two columns
; of X. The result should be 0.875872.
PRINT, 'Multiple correlation of Y on 1st two columns of X:'
PRINT, M_CORRELATE(X[0:1,*], Y)
; Compute the multiple correlation of Y on all columns of X. The
; result should be 0.877197.
PRINT, 'Multiple correlation of Y on all columns of X:'
PRINT, M_CORRELATE(X, Y)
IDL prints:
Multiple correlation of Y on 1st column of X:
0.798816
Multiple correlation of Y on 1st two columns of X:
0.875872
Multiple correlation of Y on all columns of X:
0.877196
Syntax
Result = M_CORRELATE( X, Y [, /DOUBLE] )
Return Value
Returns the single or double-precision multiple correlation coefficient.
Arguments
X
An integer, single-, or double-precision floating-point array of m-columns and n-rows that specifies the independent variable data. The columns of this two dimensional array correspond to the n-element vectors of independent variable data.
Y
An n-element integer, single-, or double-precision floating-point vector that specifies the dependent variable data.
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, CORRELATE, C_CORRELATE, P_CORRELATE, R_CORRELATE, Correlation Analysis (Chapter 7, Using IDL) in the help/pdf
directory of the IDL installation