rStats.js v1.3.0
    Preparing search index...

    Function goodmanKruskalGamma

    • Goodman and Kruskal's gamma of a table of two ordered classifications, with its asymptotic standard error and a Wald confidence interval. Equivalent to DescTools::GoodmanKruskalGamma() in R.

      gamma = (C - D) / (C + D) with C and D the numbers of concordant and discordant pairs. The standard error is the non-null ASE1 (Agresti 2010, section 7.1): sqrt(sum x psi^2) with psi_ij = 2 (D Pc_ij - C Pd_ij) / (C + D)^2, Pc_ij the counts above-left and below-right of cell (i, j) and Pd_ij those above-right and below-left. The interval is [max(-1, gamma - z ase), min(1, gamma + z ase)], z the normal quantile of 1 - (1 - confLevel) / 2. Without concordant or discordant pairs (a table with one row, for example) gamma and the interval are NaN, as DescTools. No test of gamma = 0 is given (it would need the null standard error).

      Parameters

      Returns GoodmanKruskalGammaResult

      See GoodmanKruskalGammaResult.

      RangeError for negative or non-finite counts, or a level outside (0, 1).

      const g = goodmanKruskalGamma([[10, 5, 2], [3, 8, 6], [1, 4, 9]]);
      g.estimate; // 0.6703296703296703
      g.confInt; // [0.4241347346132843, 0.9165246060460562]