# Biostatistics Series Module 4: Comparing Groups - Categorical Variables

Indian J Dermatol. Jul-Aug 2016;61(4):385-92. doi: 10.4103/0019-5154.185700.

## Abstract

Categorical variables are commonly represented as counts or frequencies. For analysis, such data are conveniently arranged in contingency tables. Conventionally, such tables are designated as r × c tables, with r denoting number of rows and c denoting number of columns. The Chi-square (χ(2)) probability distribution is particularly useful in analyzing categorical variables. A number of tests yield test statistics that fit, at least approximately, a χ(2) distribution and hence are referred to as χ(2) tests. Examples include Pearson's χ(2) test (or simply the χ(2) test), McNemar's χ(2) test, Mantel-Haenszel χ(2) test and others. The Pearson's χ(2) test is the most commonly used test for assessing difference in distribution of a categorical variable between two or more independent groups. If the groups are ordered in some manner, the χ(2) test for trend should be used. The Fisher's exact probability test is a test of the independence between two dichotomous categorical variables. It provides a better alternative to the χ(2) statistic to assess the difference between two independent proportions when numbers are small, but cannot be applied to a contingency table larger than a two-dimensional one. The McNemar's χ(2) test assesses the difference between paired proportions. It is used when the frequencies in a 2 × 2 table represent paired samples or observations. The Cochran's Q test is a generalization of the McNemar's test that compares more than two related proportions. The P value from the χ(2) test or its counterparts does not indicate the strength of the difference or association between the categorical variables involved. This information can be obtained from the relative risk or the odds ratio statistic which is measures of dichotomous association obtained from 2 × 2 tables.

Keywords: Binomial test; Chi-square distribution; Chi-square for trend; Chi-square test; Cochran's Q test; Mantel–Haenszel test; McNemar's test; contingency table; sign test.