gkgammatst

Goodman-Kruskal's gamma test.
516 Downloads
Updated 16 Jul 2013

View License

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 (2024). gkgammatst (https://www.mathworks.com/matlabcentral/fileexchange/42645-gkgammatst), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Gamma Functions in Help Center and MATLAB Answers
Communities

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.1.0.0

It was added an appropriate format to cite this file.

1.0.0.0