nlcpy.corrcoef
- nlcpy.corrcoef(a, y=None, rowvar=True, bias=nlcpy._NoValue, ddof=nlcpy._NoValue)
 Returns Pearson product-moment correlation coefficients.
Please refer to the documentation for cov for more detail. The relationship between the correlation coefficient matrix, R, and the covariance matrix, C, is
The values of R are between -1 and 1, inclusive.
- Parameters
 - xarray_like
 A 1-D or 2-D array containing multiple variables and observations. Each row of x represents a variable, and each column a single observation of all those variables. Also see rowvar below.
- yarray_like, optional
 An additional set of variables and observations. y has the same shape as x.
- rowvarbool, optional
 If rowvar is True (default), then each row represents a variable, with observations in the columns. Otherwise, the relationship is transposed: each column represents a variable, while the rows contain observations.
- bias_NoValue, optional
 Has no effect, do not use.
- ddof_NoValue, optional
 Has no effect, do not use.
- Returns
 - Rndarray
 The correlation coefficient matrix of the variables.
See also
covCovariance matrix
Note
Due to floating point rounding the resulting array may not be Hermitian, the diagonal elements may not be 1, and the elements may not satisfy the inequality abs(a) <= 1. This function accepts but discards arguments bias and ddof.
Restriction
For complex numbers : NotImplementedError occurs.
Examples
>>> import nlcpy as vp >>> x = vp.array([[1,2,1,9,10,3,2,6,7],[2,1,8,3,7,5,10,7,2]]) >>> vp.corrcoef(x) array([[ 1. , -0.05640533], [-0.05640533, 1. ]]) >>> y = vp.array([2,1,1,8,9,4,3,5,7]) >>> vp.corrcoef(x,y) array([[ 1. , -0.05640533, 0.97094584], [-0.05640533, 1. , -0.01315587], [ 0.97094584, -0.01315587, 1. ]])