tests whether the vectors v1 and v2 are independent.


returns the value of "property".

Details and Options

  • GoodmanKruskalGammaTest 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 of equal length.
  • GoodmanKruskalGammaTest is based on the GoodmanKruskal gamma coefficient γ, which is computed by GoodmanKruskalGamma[v1,v2].
  • GoodmanKruskalGammaTest[v1,v2,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
  • GoodmanKruskalGammaTest[v1,v2,"property"] can be used to directly give the value of "property".
  • Properties related to the reporting of test results include:
  • "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
  • 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. By default, is set to 0.05.


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 and test statistic from the test:

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  (7)

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  (1)

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

Properties & Relations  (3)

For vector to vector comparisons, the test statistic is computed as GoodmanKruskalGamma:

IndependenceTest can be used to select an appropriate test of independence:

GoodmanKruskalGammaTest is one of the available tests:

GoodmanKruskalGammaTest only detects monotonic dependence:

HoeffdingDTest can be used to detect a wider variety of dependence structures:

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), GoodmanKruskalGammaTest, Wolfram Language function,


Wolfram Research (2012), GoodmanKruskalGammaTest, Wolfram Language function,


Wolfram Language. 2012. "GoodmanKruskalGammaTest." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2012). GoodmanKruskalGammaTest. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_goodmankruskalgammatest, author="Wolfram Research", title="{GoodmanKruskalGammaTest}", year="2012", howpublished="\url{}", note=[Accessed: 24-April-2024 ]}


@online{reference.wolfram_2024_goodmankruskalgammatest, organization={Wolfram Research}, title={GoodmanKruskalGammaTest}, year={2012}, url={}, note=[Accessed: 24-April-2024 ]}