CorrCoef
Compute the Pearson correlation coefficient (linear correlation coefficient).
matrix matrix::CorrCoef(
|
Return Value
Pearson product-moment correlation coefficients.
Note
The correlation coefficient is in the range [-1, 1].
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. The real and imaginary parts are clipped to the interval [-1, 1] in an attempt to improve on that situation but is not much help in the complex case.
A simple algorithm for calculating the correlation coefficient of two vectors using MQL5:
double VectorCorrelation(const vector& vector_x,const vector& vector_y)
|
MQL5 example:
vectorf vector_a={1,2,3,4,5};
|
Python example:
import numpy as np
|