Click or drag to resize

BivariatePearsonRTest Method

Performs a Pearson correlation test for association.

Namespace:  Meta.Numerics.Statistics
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax
public static TestResult PearsonRTest(
	IReadOnlyList<double> x,
	IReadOnlyList<double> y
)

Parameters

x
Type: System.Collections.GenericIReadOnlyListDouble
The values of the first variable.
y
Type: System.Collections.GenericIReadOnlyListDouble
The values of the second variable.

Return Value

Type: TestResult
The result of the test.
Exceptions
ExceptionCondition
ArgumentNullExceptionx or y is .
DimensionMismatchExceptionx and y do not contain the same number of entries.
InsufficientDataExceptionThere are fewer than 3 entries in the sample.
Remarks

This test measures the strength of the linear correlation between two variables. The test statistic r is simply the covariance of the two variables, scaled by their respective standard deviations so as to obtain a number between -1 (perfect linear anti-correlation) and +1 (perfect linear correlation).

The Pearson test cannot reliably detect or rule out non-linear associations. For example, variables with a perfect quadratic association may have only a weak linear correlation. If you wish to test for associations that may not be linear, consider using the Spearman or Kendall tests instead.

The Pearson correlation test requires O(N) operations.

The Pearson test requires at least three bivariate values.

See Also