Correlations
To use the Correlations package, it is first necessary to instantiate
the SCI.Correlations package with a Float_Type used for the internal
computation. This floating point type must have enough digits and allow
enough value ranges for proper statistics calculations.
package Double_Correlations is new SCI.Correlations (Double);
Pearson
The SCI.Correlations.Pearson package provides operations to compute the
Pearson correlation. The package must be instantiated with a Value_Type
and it then provides several generic functions that must be instantiated
to better fit the data model layout.
For example:
type MyFloat is new Float range 0.0 .. 1_000.0;
package MyFloat_Pearson is
new Double_Correlations.Pearson (Value_Type => MyFloat);
Several generic function are provided and are ready to be instantiated
- the
Correlationgeneric function computes the correlation against two arrays ofValue_Type. - the
Matrix_Correlationgeneric function uses a two dimension array and computes the correlation between two columns on a row subset. - the
Model_Correlationgeneric function provides the most versatile data model and it is necessary to provide aGetfunction that retrieves one value at a time.