PearsonCorrelationTest

PearsonCorrelationTest[v1,v2]

tests whether the vectors v1 and v2 are linearly independent.

PearsonCorrelationTest[,"property"]

returns the value of "property".

Details and Options

  • PearsonCorrelationTest performs a hypothesis test on v1 and v2 with null hypothesis that the vectors are linearly independent, and alternative hypothesis that they are not.
  • By default, a probability value or -value is returned.
  • A small -value suggests that it is unlikely that is true.
  • The arguments v1 and v2 can be any real-valued vectors of equal length.
  • PearsonCorrelationTest is based on the Pearson product-moment correlation computed by Correlation[v1,v2]. Under , asymptotically follows a StudentTDistribution[n-2].
  • PearsonCorrelationTest[v1,v2,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
  • PearsonCorrelationTest[v1,v2,"property"] can be used to directly give the value of "property".
  • Properties related to the reporting of test results include:
  • "DegreesOfFreedom"the degrees of freedom used in the test
    "PValue"the -value of the test
    "PValueTable"formatted table containing the -value
    "ShortTestConclusion"a short description of the conclusion of the test
    "TestConclusion"a description of the conclusion of the test
    "TestData"a list containing the test statistic and -value
    "TestDataTable"formatted table of the -value and test statistic
    "TestStatistic"the test statistic
    "TestStatisticTable"formatted table containing the test statistic
  • The following options can be used:
  • AlternativeHypothesis "Unequal"the inequality for the alternative hypothesis
    Method Automaticthe method to use for computing -values
    SignificanceLevel 0.05cutoff for diagnostics and reporting
    VerifyTestAssumptions Automaticwhat assumptions to verify
  • For tests of independence, a cutoff is chosen such that is rejected only if . The value of used for the "TestConclusion" and "ShortTestConclusion" properties is controlled by the SignificanceLevel option. This value is also used in diagnostic tests of normality. By default, is set to 0.05.
  • Named settings for VerifyTestAssumptions in IndependenceTest include:
  • "Normality"verify that all data is normally distributed

Examples

open allclose all

Basic Examples  (1)

Test whether two vectors are independent:

Scope  (7)

Testing  (4)

Test whether two vectors are independent:

The -values are typically large when the vectors are independent:

The -values are typically small when there are dependencies:

Create a HypothesisTestData object for repeated property extraction:

The properties available for extraction:

Extract some properties from the HypothesisTestData object:

The -value and test statistic from the test:

Extract any number of properties simultaneously:

The -value, test statistic, and degrees of freedom:

Reporting  (3)

Tabulate the results from the test:

A table of the test results:

Retrieve the entries from a test table for customized reporting:

Tabulate the -value or test statistic:

The -value from the table:

The test statistic from the table:

Options  (12)

AlternativeHypothesis  (2)

A two-sided test is performed by default:

Perform a two-sided test or a one-sided alternative:

A two-sided test:

The two one-sided alternatives:

Method  (4)

By default, -values are computed using asymptotic test statistic distributions:

The -value can be obtained using permutation methods:

Set the number of permutations to use:

By default, random permutations are used:

Set the seed used for generating random permutations:

SignificanceLevel  (3)

Set the significance level for diagnostic tests:

By default, 0.05 is used. The message shows 0.025 because two tests were performed:

Setting the significance level may alter which test is automatically chosen:

A nonparametric test would have been chosen by default:

The significance level is also used for "TestConclusion" and "ShortTestConclusion":

VerifyTestAssumptions  (3)

By default, normality is tested when appropriate:

Diagnostics can be controlled as a group using All or None:

Verify all assumptions:

Check no assumptions:

Diagnostics can be controlled independently:

Check for normality:

Explicitly set the diagnostic result:

Properties & Relations  (7)

The test statistic is equivalent to Correlation:

Under , the test statistic asymptotically follows a StudentTDistribution[n-2]:

Use SpearmanRankTest for non-normal distributions:

Tests based on Spearman's do a better job of preserving the size of the test:

A table of expected and observed test sizes:

IndependenceTest can be used to automatically select an appropriate test:

Use CorrelationTest to test a particular value of :

The Pearson correlation test works with the values only when the input is a TimeSeries:

The Pearson correlation test works with all the values together when the input is a TemporalData:

Test selected components of the temporal data explicitly:

Use the values directly:

Neat Examples  (1)

Compute the statistic when the null hypothesis is true:

The test statistic given a particular alternative:

Compare the distributions of the test statistics:

Wolfram Research (2012), PearsonCorrelationTest, Wolfram Language function, https://reference.wolfram.com/language/ref/PearsonCorrelationTest.html.

Text

Wolfram Research (2012), PearsonCorrelationTest, Wolfram Language function, https://reference.wolfram.com/language/ref/PearsonCorrelationTest.html.

CMS

Wolfram Language. 2012. "PearsonCorrelationTest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/PearsonCorrelationTest.html.

APA

Wolfram Language. (2012). PearsonCorrelationTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PearsonCorrelationTest.html

BibTeX

@misc{reference.wolfram_2023_pearsoncorrelationtest, author="Wolfram Research", title="{PearsonCorrelationTest}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/PearsonCorrelationTest.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_pearsoncorrelationtest, organization={Wolfram Research}, title={PearsonCorrelationTest}, year={2012}, url={https://reference.wolfram.com/language/ref/PearsonCorrelationTest.html}, note=[Accessed: 19-March-2024 ]}