Compute Goodman-Kruskal's gamma statistic for a two-dimensional table of ordered categories
gkgamma(x, conf.level = 0.95)
x | A matrix or table representing the two-dimensional ordered contingency table of observations |
---|---|
conf.level | Level of confidence interval |
A list with class htest
containing the following components:
the value the test statistic for testing no association
the p-value for the test
the value the gamma estimate
the confidence interval for the gamma estimate
a character string indicating the type of test performed
a character string indicating the name of the data input
the observed counts
the SE used when computing the test statistics
the SE used when computing the confidence interval
Goodman, Leo A. and Kruskal, William H. (1954). "Measures of Association for Cross Classifications". Journal of the American Statistical Association 49 (268): 732-764.
chisq.test
# Data from the Glostrup study comparing smoking to overall health in males smoke <- matrix(c(16, 15, 13, 10, 1, 73, 75, 59, 81, 29, 6, 6, 7, 17, 3, 1, 0, 1, 3, 1), ncol=4) colnames(smoke) <- c("VGood", "Good", "Fair", "Bad") # General health status rownames(smoke) <- c("Never", "No more", "1-14", "15-24", "25+") # Smoke amount gkgamma(smoke)#> #> Goodman-Kruskal's gamma for ordinal categorical data #> #> data: smoke #> Z = 3.297, p-value = 0.0009771 #> 95 percent confidence interval: #> 0.1033214 0.3803133 #> sample estimates: #> Goodman-Kruskal's gamma #> 0.2418174 #>chisq.test(smoke)#> Warning: Chi-squared approximation may be incorrect#> #> Pearson's Chi-squared test #> #> data: smoke #> X-squared = 16.198, df = 12, p-value = 0.1824 #>