Function corr #
Compute the correlation coefficient of a two list with values, For matrices, the matrix correlation coefficient is calculated.
Syntax #
math.corr(A, B)
Parameters #
Parameter | Type | Description |
---|---|---|
A |
Array | Matrix | The first array or matrix to compute correlation coefficient |
B |
Array | Matrix | The second array or matrix to compute correlation coefficient |
Returns #
Type | Description |
---|---|
* | The correlation coefficient |
Throws #
Type | Description —- | ———–
Examples #
math.corr([1, 2, 3, 4, 5], [4, 5, 6, 7, 8]) // returns 1
math.corr([1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]) //returns 0.9569941688503644
math.corr([[1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]],[[1, 2.2, 3, 4.8, 5], [4, 5.3, 6.6, 7, 8]]) // returns [1,1]