How do I calculate p-values for Goodman and Kruskal's lambda and/or tau tests for association between categorical variables (measure improvement in predictability of the dependent variable given the value of the independent one based on modal probabilities [lambda] or marginal/conditional proportions [tau])? I know SPSS can do it, but I use R instead.

  • $\begingroup$ DescTools has a test for tau (and gamma) and produces a CI for lambda. $\endgroup$
    – Glen_b
    Commented Nov 18, 2018 at 1:44
  • $\begingroup$ DescTools doesn't give p-values for some reason, I've tried. Thank you for your try, but you're right about this question beeing off topic, so I've moved it to stackoverflow.com/questions/53366888/…. $\endgroup$
    – LRM
    Commented Nov 19, 2018 at 15:56
  • $\begingroup$ A question about how to compute p-values for measures based on those tests would be on topic here; (you can even mention that you're working in R). It's also possible to back p-values out via confidence intervals, though it could be somewhat tedious. $\endgroup$
    – Glen_b
    Commented Nov 19, 2018 at 20:57
  • $\begingroup$ <huge smile> In that case, I rephrase my question: how do I calculate p-values for Goodman and Kruskal's lambda and tau-tests and is there a way to do so in R? I hear it's based on chi²-distribution approximation, but I have no clue as to the mathematics behind it. ;) $\endgroup$
    – LRM
    Commented Nov 20, 2018 at 1:54
  • $\begingroup$ On confidence intervals: yes, I sometimes do that (depending on the matter at hand), and it's always good to keep the option. Classical R hypothesis-testing functions such as chisq.test(), fisher.test(), wilcox.test() or gkgamma() (the latter from the MESS package) return htest-type objects that include p-values, confidence intervals, degrees of freedom, parameters, intermediate stats, etc. I've been trying to find an equivalent for Goodman & Kruskal's lambda and/or tau, but so far I haven't. For instance, DescTools and GoodmanKruskal return only coefficients, no intervals or p-vals. $\endgroup$
    – LRM
    Commented Nov 20, 2018 at 2:05

1 Answer 1


Let's create a synthesis data for illustration:

A <- sample(c("A1", "A2", "A3"), size=1000, replace = TRUE)
B <- sample(c("B1", "B2", "B3", "B4"), size=1000, replace = TRUE)
table(A, B)

Then this is the table of A and B

A    B1 B2 B3 B4
  A1 79 86 90 87
  A2 76 89 79 93
  A3 70 92 84 75

Now, you can get the p-value of the Goodman and Kruskal's lambda test

gkgamma_test <- gkgamma(table(A, B))

This is what you will get:

Goodman-Kruskal's gamma for ordinal
    categorical data

data:  table(A, B)
Z = -0.35154, p-value = 0.7252
95 percent confidence interval:
 -0.08784091  0.06112170
sample estimates:
Goodman-Kruskal's gamma 

You can also take only the p-value by using


then you will only have

[1] 0.7251808

NOTE: when using the gkgamma test like above, we assume that A and A are ordinal categorial.

In case A and B are nomials, use:

Lambda(table(A, B))

and the value for λ is (The value λ lies between 0 and 1; values close to 1 correspond to a strong association.)

[1] 0.01437815

Read more about the two comments from https://search.r-project.org/CRAN/refmans/DescTools/html/Lambda.html


Measure of association - How to choose


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.