tests whether the vectors v1 and v2 are independent.


tests whether the matrices m1 and m2 are independent.


returns the value of "property".

Details and Options

  • IndependenceTest performs a hypothesis test on v1 and v2 with null hypothesis that the vectors are 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 or matrices of equal length.
  • IndependenceTest[v1,v2] will choose the most powerful test that applies to v1 and v2.
  • IndependenceTest[v1,v2,All] will choose all tests that apply to v1 and v2.
  • IndependenceTest[v1,v2,"test"] reports the -value according to "test".
  • Some of the available tests assume normality for the vi. Some tests are restricted to vectors. Most tests are restricted to tests of monotonic or linear independence.
  • The following tests can be used:
  • "BlomqvistBeta"monotonicbased on Blomqvist's
    "GoodmanKruskalGamma"monotonic, vectorbased on the -coefficient
    "HoeffdingD"vectorbased on Hoeffding's
    "KendallTau"monotonicbased on Kendall's
    "PearsonCorrelation"linear, normality, vectorbased on Pearson product-moment
    "PillaiTrace"normality, linearbased on Pillai's trace
    "SpearmanRank"monotonicbased on Spearman's
    "WilksW"normality, linearbased on Wilks'
  • IndependenceTest[v1,v2,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
  • IndependenceTest[v1,v2,"property"] can be used to directly give the value of "property".
  • Properties related to the reporting of test results include:
  • "AllTests"list of all applicable tests
    "AutomaticTest"test chosen if Automatic is used
    "DegreesOfFreedom"the degrees of freedom used in a test
    "PValue"list of -values
    "PValueTable"formatted table of -values
    "ShortTestConclusion"a short description of the conclusion of a test
    "TestConclusion"a description of the conclusion of a test
    "TestData"list of pairs of test statistics and -values
    "TestDataTable"formatted table of -values and test statistics
    "TestStatistic"list of test statistics
    "TestStatisticTable"formatted table of test statistics
  • The following options can be used:
  • AlternativeHypothesis"Unequal"the inequality for the alternative hypothesis
    MaxIterationsAutomaticmax iterations for multivariate nonparametric tests
    MethodAutomaticthe method to use for computing -values
    SignificanceLevel0.05cutoff for diagnostics and reporting
    VerifyTestAssumptionsAutomaticwhat 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


open all close all

Basic Examples  (2)

Test whether two vectors are independent:

Click for copyable input
Click for copyable input
Click for copyable input

Test whether two matrices are independent:

Click for copyable input

At the 0.05 level, there is insufficient evidence to reject independence:

Click for copyable input

Scope  (12)

Options  (15)

Properties & Relations  (4)

Neat Examples  (1)

Introduced in 2012