# Cochran–Armitage test for trend

The Cochran–Armitage test for trend, named for William Cochran and Peter Armitage, is used in categorical data analysis when the aim is to assess for the presence of an association between a variable with two categories and an ordinal variable with k categories. It modifies the Pearson chi-squared test to incorporate a suspected ordering in the effects of the k categories of the second variable. For example, doses of a treatment can be ordered as 'low', 'medium', and 'high', and we may suspect that the treatment benefit cannot become smaller as the dose increases. The trend test is often used as a genotype-based test for case-control genetic association studies.

## Introduction

The trend test is applied when the data take the form of a 2 × k contingency table. For example, if k = 3 we have
| | B = 1 | B = 2 | B = 3 |
| A = 1 | N$_{11}$ | N$_{12}$ | N$_{13}$ |
| A = 2 | N$_{21}$ | N$_{22}$ | N$_{23}$ |
This table can be completed with the marginal totals of the two variables
| | B = 1 | B = 2 | B = 3 | Sum |
| A = 1 | N$_{11}$ | N$_{12}$ | N$_{13}$ | R$_1$ |
| A = 2 | N$_{21}$ | N$_{22}$ | N$_{23}$ | R$_2$ |
| Sum | C$_1$ | C$_2$ | C$_3$ | N |
where R$_1$ = N$_{11}$ + N$_{12}$ + N$_{13}$, and C$_1$ = N$_{11}$ + N$_{21}$, etc.
The trend test statistic is
    $T\equiv \sum _{i=1}^{k}t_{i}(N_{1i}R_{2}-N_{2i}R_{1}),$
where the t$_i$ are weights, and the difference N$_{1i}$R$_2$ −N$_{2i}$R$_1$ can be seen as the difference between N$_{1i}$ and N$_{2i}$ after reweighting the rows to have the same total.
The hypothesis of no association (the null hypothesis) can be expressed as:
    $\Pr(A=1|B=1)=\cdots =\Pr(A=1|B=k).$
Assuming this holds, then, using iterated expectation,
    $\operatorname {E} (T)=\operatorname {E} \left(\operatorname {E} (T|R_{1},R_{2})\right)=\operatorname {E} (0)=0.$
The variance can be computed by decomposition, yielding
    ${\rm {Var}}(T)={\frac {R_{1}R_{2}}{N}}\left(\sum _{i=1}^{k}t_{i}^{2}C_{i}(N-C_{i})-2\sum _{i=1}^{k-1}\sum _{j=i+1}^{k}t_{i}t_{j}C_{i}C_{j}\right),$
and as a large sample approximation,
    ${\frac {T}{\sqrt {\mathrm {Var} (T)}}}\sim \mathrm {N} (0,1).$
The weights t$_i$ can be chosen such that the trend test becomes locally most powerful for detecting particular types of associations. For example, if k = 3 and we suspect that B = 1 and B = 2 have similar frequencies (within each row), but that B = 3 has a different frequency, then the weights t = (1,1,0) should be used. If we suspect a linear trend in the frequencies, then the weights t = (0,1,2) should be used. These weights are also often used when the frequencies are suspected to change monotonically with B, even if the trend is not necessarily linear.

## Interpretation and role

The trend test will have higher power than the chi-squared test when the suspected trend is correct, but the ability to detect unsuspected trends is sacrificed. This is an example of a general technique of directing hypothesis tests toward narrow alternatives. The trend test exploits the suspected effect direction to increase power, but this does not affect the sampling distribution of the test statistic under the null hypothesis. Thus, the suspected trend in effects is not an assumption that must hold in order for the test results to be meaningful.

## Application to genetics

Suppose that there are three possible genotypes at some locus, and we refer to these as aa, Aa and AA. The distribution of genotype counts can be put in a 2 × 3 contingency table. For example, consider the following data, in which the genotype frequencies vary linearly in the cases and are constant in the controls:
| | Genotype aa | Genotype Aa | Genotype AA | Sum |
| Controls | 20 | 20 | 20 | 60 |
| Cases | 10 | 20 | 30 | 60 |
| Sum | 30 | 40 | 50 | 120 |
In genetics applications, the weights are selected according to the suspected mode of inheritance. For example, in order to test whether allele a is dominant over allele A, the choice t = (1, 1, 0) is locally optimal. To test whether allele a is recessive to allele A, the optimal choice is t = (0, 1, 1). To test whether alleles a and A are codominant, the choice t = (0, 1, 2) is locally optimal. For complex diseases, the underlying genetic model is often unknown. In genome-wide association studies, the additive (or codominant) version of the test is often used.
In the numerical example, the standardized test statistics for various weight vectors are
| Weights | Standardized test statistic |
| 1,1,0 | 1.85 |
| 0,1,1 | −2.1 |
| 0,1,2 | −4.67 |
and the Pearson chi-squared test gives a standardized test statistic of 2. Thus, we obtain a stronger significance level if the weights corresponding to additive (codominant) inheritance are used. Note that for the significance level to give a p-value with the usual probabilistic interpretation, the weights must be specified before examining the data, and only one set of weights may be used.