A range of ranges to be treated as a set of vectors. This must be a finite range, and must be rectangular, i.e. all elements must be the same length. For Pearson correlation and covariance, the ranges must also have elements implicitly convertible to double. SciD matrices can be treated as ranges of ranges and can be used with these functions.
1 auto input = [[8.0, 6, 7, 5], 2 [3.0, 0, 9, 3], 3 [1.0, 4, 1, 5]]; 4 auto pearson = pearsonMatrix(input); 5 assert(approxEqual(pearson[0, 0], 1));
These functions allow efficient calculation of the Pearson, Spearman and Kendall correlation matrices and the covariance matrix respectively. They are optimized to avoid computing certain values multiple times when computing correlations of one vector to several others.
Note: These functions are only available when SciD is installed and dstats is compiled with version=scid.