Maxima Function
list_correlations (matrix)
list_correlations(matrix,logical_value)
Function list_correlations
returns a list of correlation measures:
precision matrix: the inverse of the covariance matrix S_1,
-1 ij S = (s ) 1 i,j = 1,2,...,p
multiple correlation vector: (R_1^2, R_2^2, ..., R_p^2), with
2 1 R = 1 - ------- i ii s s ii
an indicator of the goodness of fit of the linear multivariate regression model on X_i when the rest of variables are used as regressors.
partial correlation matrix: with element (i, j) being
ij s r = - ------------ ij.rest / ii jj\ 1/2 |s s | \ /
Example:
(%i1) load (descriptive)$ (%i2) load (numericalio)$ (%i3) s2 : read_matrix (file_search ("wind.data"))$ (%i4) z : list_correlations (s2)$ (%i5) fpprintprec : 5$ /* for pretty output */ (%i6) z[1]; /* precision matrix */ [ .38486 - .13856 - .15626 - .10239 .031179 ] [ ] [ - .13856 .34107 - .15233 .038447 - .052842 ] [ ] (%o6) [ - .15626 - .15233 .47296 - .024816 - .10054 ] [ ] [ - .10239 .038447 - .024816 .10937 - .034033 ] [ ] [ .031179 - .052842 - .10054 - .034033 .14834 ] (%i7) z[2]; /* multiple correlation vector */ (%o7) [.85063, .80634, .86474, .71867, .72675] (%i8) z[3]; /* partial correlation matrix */ [ - 1.0 .38244 .36627 .49908 - .13049 ] [ ] [ .38244 - 1.0 .37927 - .19907 .23492 ] [ ] (%o8) [ .36627 .37927 - 1.0 .10911 .37956 ] [ ] [ .49908 - .19907 .10911 - 1.0 .26719 ] [ ] [ - .13049 .23492 .37956 .26719 - 1.0 ]
Function list_correlations
also has an optional logical argument: list_correlations(x,true)
tells Maxima that x
is the data matrix, making the same as list_correlations(x)
. On the other hand, list_correlations(x,false)
means that x
is not the data matrix, but the covariance matrix, avoiding its recalculation.