Stats.Correlation Method

Definition

Namespace: Extreme.Statistics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

Correlation(Double[], Double[]) Gets the Pearson correlation coefficient between two sets of values.
Correlation(Vector<Double>, Vector<Double>) Gets the Pearson correlation coefficient between two sets of values.

Correlation(Double[], Double[])

Gets the Pearson correlation coefficient between two sets of values.
C#
public static double Correlation(
	double[] data1,
	double[] data2
)

Parameters

data1  Double[]
A Double array.
data2  Double[]
A Double array.

Return Value

Double
The correlation between the two sets of values.

Remarks

If an observation in either array is NaN, the pair of observations is not included in the computation of the correlation. The means for each array are calculated based on the

Exceptions

ArgumentNullExceptiondata1 is null.

-or-

data2 is null.

DimensionMismatchException The length of data1 does not equal the length of data2.

Correlation(Vector<Double>, Vector<Double>)

Gets the Pearson correlation coefficient between two sets of values.
C#
public static double Correlation(
	this Vector<double> data1,
	Vector<double> data2
)

Parameters

data1  Vector<Double>
A Double array.
data2  Vector<Double>
A Double array.

Return Value

Double
The correlation between the two sets of values.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Vector<Double>. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

ArgumentNullExceptiondata1 is null.

-or-

data2 is null.

DimensionMismatchException The length of data1 does not equal the length of data2.

See Also