gkgammatst

Goodman-Kruskal's gamma test.

You are now following this Submission

It is an inference on the measure of correlation among two ordered qualitative variables. Measuring strength of association of cross tabulated data. It was proposed by Leo Goodman and William Kruskal across a series of papers (1954, 1959, 1963 and 1972).

A pair of observations is concordant if the subject who is higher on one variable also is higher on the other variable, and a pair of observations is discordant if the subject who is higher on one variable is lower on the other variable (Goktas and Qznur, 2011).

If C > D the variables have a positive association, but if C < D then the variables have a negative association. C and D are, respectivelly, the total number of concordances and discordances.

The ratio (C - D)/(C + D) is the Goodman-Kruskal´s gamma statistic (g). It can lie between -1 and 1. Sign indicates if ther is a negative or positive association. The magnitude indicates strength of association.

The asymtotic Goodman-Kruskal's gamma variance is calculated as,

varg = 4/(C + D)^2*(Sum_i Sum_j n_ij*((A_ij - B_ij)^2 - (C - D)^2/n)

where,
A_ij = Sum_k<i Sum_l<j a_kl + Sum_k>i Sum_l>j a_kl

B_ij = Sum_k>i Sum_l<j a_kl + Sum_k<i Sum_l>j a_kl

a_ij denote the observed frequency in cell (i,j) in an I x J contingency table.

Concordances, C is: C = Sum_i Sum_j a_ij*A_ij

Discordances, D is: D = Sum_i Sum_j a_ij*B_ij

The z-value = g/sqrt(varg)

Null hypothesis: no association (no relationship or independence) corresponding gamma = 0. Alternative hypothesis (one-sided) gamma < 0 or gamma > 0.

Syntax: function gkgammatst(x,alpha,tail)

Inputs:
x – rxc data matrix
alpha - significance value (default=0.05)
tail - two-sided=0; one-sided~=0

Output:
- Summary statistics from the analysis

Cite As

Antonio Trujillo-Ortiz (2026). gkgammatst (https://www.mathworks.com/matlabcentral/fileexchange/42645-gkgammatst), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Communities
Version Published Release Notes Action
1.1.0.0

It was added an appropriate format to cite this file.

1.0.0.0