Skip to main content

module analysis::statistics::Correlation

rascal-0.34.0

Correlation between data values.

Usage

import analysis::statistics::Correlation;

Compute the correlation between pairs of data values. Correlation measures the statistical relationship between two sets of data.

The following functions are provided:

function PearsonsCorrelation

Pearson product-moment correlation coefficient.

num PearsonsCorrelation(lrel[num x,num y] values)

Compute the Pearson product-moment correlation coefficient. It is a measure of the strength of the linear dependence between two variables.

Pitfalls

Use Spearmans Correlation when there is a monotonous dependence between the two variables.

function PearsonsCorrelationStandardErrors

Standard errors associated with Pearson correlation.

list[real] PearsonsCorrelationStandardErrors(lrel[num x,num y] values)

function PearsonsCorrelationPValues

P-values (significance) associated with Pearson correlation.

list[real] PearsonsCorrelationPValues(lrel[num x,num y] values)

function SpearmansCorrelation

Spearman's rank correlation coefficient.

num SpearmansCorrelation(lrel[num x,num y] values)

Compute Spearman's rank correlation coefficient. The correlation between the data values is computed by first performing a rank transformation on the data values using a natural ranking and then computing Pearsons Correlation.

Pitfalls

Use Pearsons Correlation when there is a linear dependence between the variables.

function covariance

Covariance of data values.

num covariance(lrel[num x,num y] values)

Computes the covariance between the x and y values.

Examples

rascal>import analysis::statistics::Correlation;
ok
rascal>covariance([<1,12>,<3,12>,<3,11>,<5,7>]);
num: -2.5