double correlation(double* first1, double* last1, double* first2);
Returns the Pearson's product moment correlation coefficient of the corresponding elements in [first1, last1) and [first2, first2 + (last1 - first1) ).
Parameters:
first1 | Beginning iterator for the first container of elements. |
---|---|
last1 | Ending iterator for the first container of elements. |
first2 | Beginning iterator for the second container of elements. |
Returns:
Correlation of [first1, last1) and [first2, first2 + (last1 - first1) )
Usage:
double x[4] = {1, 2, 3, 4};
double y[4] = {2.0, 3.5, 2.25, 4.75};
double cor = correlation(x, s + 4, y);
Header:
#include "correlat.h"