The OpenD Programming Language

pearsonMatrix

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.

  1. SymmetricMatrix!double pearsonMatrix(RoR mat, TaskPool pool)
    version(scid)
    SymmetricMatrix!double
    pearsonMatrix
    (
    RoR
    )
    (
    RoR mat
    ,
    TaskPool pool = null
    )
    if (
    is(ElementType!(ElementType!RoR) : double)
    &&
    )
  2. void pearsonMatrix(RoR mat, Ret ans, TaskPool pool)

Parameters

mat RoR

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.

Examples

auto input = [[8.0, 6, 7, 5],
              [3.0, 0, 9, 3],
              [1.0, 4, 1, 5]];
auto pearson = pearsonMatrix(input);
assert(approxEqual(pearson[0, 0], 1));

Meta