7  Cohort and Case-Control Studies

Like fire, the \(\chi^2\) test is an excellent servant and a bad master. (Hill 1965)

Some the most important questions in public health involve the association between a disease and a possible predictor or cause, which we call an exposure. Here, we consider testing the null hypothesis that exposure and disease are independent in a population based on a sample from that population. If exposure and disease are independent, an individual’s exposure status contains no information about their risk of disease and vice versa. For simplicity, we focus on a binary exposure and a binary disease outcome and we focus on association, not causation. It turns out this null hypothesis can be tested most efficiently when we sample study participants according to exposure or according to disease (but not both). Sampling by exposure leads to the cohort study design, and sampling by disease leads to the case-control study design.

7.1 Sampling from a population

Suppose we take a random sample of size \(n\) from a population of size \(N \gg n\) (i.e., \(N\) is much greater than \(n\)) and classify each individual in the sample by exposure and disease in a contingency table. We assume that each possible sample of size \(n\) is equally likely. Each of the cell counts in the resulting 2x2 table is a random variable in the sample space \(\Omega_n\) that consists of all possible samples of size \(n\) from the population \(\Omega\). In Table 7.1, these random variables are \(\A\), \(\B\), \(\C\), and \(\D\). The random row totals are \(\R_1 = \A + \B\) and \(\R_0 = \C + \D\), and the random column totals are \(\K_1 = \A + \C\) and \(\K_0 = \B + \D\). The total sample size \(n\) is fixed, which means that it is the same for every sample \(\omega_n \in \Omega_n\).

Table 7.1: Random 2x2 table of exposure (\(X\)) and disease (\(D\)).
\(D = 1\) \(D = 0\) Total
\(X = 1\) \(\A\) \(\B\) \(\R_1\)
\(X = 0\) \(\C\) \(\D\) \(\R_0\)
Total \(\K_1\) \(\K_0\) \(n\)

Table 7.2 shows the observed values of these random variables from a single sample. These are the values available to us for statistical inference about the independence of exposure and disease.

Table 7.2: Observed 2x2 table of exposure (\(X\)) and disease (\(D\)).
\(D = 1\) \(D = 0\) Total
\(X = 1\) \(a\) \(b\) \(r_1\)
\(X = 0\) \(c\) \(d\) \(r_0\)
Total \(k_1\) \(k_0\) \(n\)

7.1.1 Hypergeometric distribution*

Over all possible samples from the population \(\Omega\), the joint distribution of the cell counts \(\A\), \(\B\), \(\C\), and \(\D\) in Table 7.1 is a multivariate hypergeometric distribution. Its probability mass function (PMF) is \[ \Pr(\A = a, \B = b, \C = c, D = d) = \frac{\binom{N p_{\A}}{a} \binom{N p_{\B}}{b} \binom{N p_{\C}}{c} \binom{N p_{\D}}{d}}{\binom{N}{n}} \tag{7.1}\] for all \(a, b, c, d \geq 0\) such that \(a + b + c + d = n\), where \[ \begin{aligned} p_{\A} &= \Pr(X = 1 \text{ and } D = 1) \\ p_{\B} &= \Pr(X = 1 \text{ and } D = 0) \\ p_{\C} &= \Pr(X = 0 \text{ and } D = 1) \\ p_{\D} &= \Pr(X = 0 \text{ and } D = 0) \end{aligned} \] in the underlying population (i.e., where \(\Omega\) is the population and we sample a single individual \(\omega\) at random). The numerator in Equation 7.1 is the number of ways of getting cell counts \(\A = a\), \(\B = b\), \(\C = c\), and \(\D = d\) in a sample of size \(n\), and the denominator is the number of samples of size \(n\) that can be chosen from our population \(\Omega\) of size \(N \geq n\).

The marginal distribution of each cell count is a hypergeometric distribution. The PMF of \(\A\), which is the number of individuals who are exposed and have disease (or disease onset), is \[ \Pr(\A = a) = \frac{\binom{N p_{\A}}{a} \binom{N (1 - p_{\A})}{n - a}}{\binom{N}{n}}. \] where \(a \geq 0\) and \(a \leq n\). Its mean is \[ \E(\A) = n p_{\A}, \] which is identical to the binomial(\(n\), \(p_{\A}\)) mean. Its variance is \[ \Var(\A) = n p_{\A} (1 - p_{\A}) \frac{N - n}{N - 1}, \] which is smaller than the binomial(\(n\), \(p_{\A}\)) variance for all \(n > 1\). The factor \((N - n) / (N - 1)\) is called the finite population correction.

The row totals \(\R_1\) and \(\R_0\) and the column totals \(\K_1\) and \(\K_0\) from Table 7.1 also have hypergeometric distributions. For \(\R_1\), we have \[ \Pr(\R_1 = r_1) = \frac{\binom{N \pi}{r_1} \binom{N (1 - \pi)}{n - r_1}}{\binom{N}{n}} \] where \(\pi = \Pr(X = 1)\) is the marginal probability of exposure in the population. For \(\K_1\), we have \[ \Pr(\K_1 = k_1) = \frac{\binom{N p}{k_1} \binom{N (1 - p)}{n - k_1}}{\binom{N}{n}} \] where \(p = \Pr(D = 1)\) is the marginal prevalence or risk of disease in the population.

As the population size \(N \rightarrow \infty\), the distribution of \(\A\) converges to a binomial(\(n\), \(p_{\A}\)) distribution. If \(N \rightarrow \infty\) and \(n \rightarrow \infty\) such that \(n^2 / N \rightarrow 0\), the distribution of \[ \frac{\A - \E(\A)}{\sqrt{\Var(\A)}} \] converges to the standard normal distribution \(N(0, 1)\). The hypergeometric distributions of the other cell counts and marginal totals also converge to binomial or normal distributions.

7.1.2 Multinomial distribution

If we fix the sample size \(n\) and let the population size \(N \rightarrow \infty\), the multivariate hypergeometric distribution converges to the multinomial distribution. Its PMF is \[ \Pr(\A = a, \B = b, \C = c, \D = d) = \frac{n!}{a! b! c! d!} p_{\A}^a p_{\B}^b p_{\C}^c p_{\D}^d. \] for \(a, b, c, d \geq 0\) such that \(a + b + c + d = n\). This PMF is written in terms of four probabilities, but there are only three degrees of freedom because \(p_{\A} + p_{\B} + p_{\C} + p_{\D} = 1\). In the multinomial distribution, the covariance of \(\A\) and \(\B\) is \[ \Cov(\A, \B) = -n p_{\A} p_{\B}, \] and the covariances for the other five pairs of cell counts follow the same pattern. The multinomial approximation to the multivariate hypergeometric distribution and the binomial approximation to the hypergeometric distribution can be used when \(N\) is much larger than \(n\) (i.e., \(N \gg n\)), which is a common situation in epidemiologic studies.1

When the joint distribution of the cell counts is multinomial, the marginal distribution of each cell count is binomial. For example, the distribution of \(\A\) is binomial(\(n\), \(p_{\A}\)), so its mean is \(n p_{\A}\) and its variance is \(n p_{\A} (1 - p_{\A})\). The row and column sums also have binomial distributions. The distribution of \(\R_1\) is binomial(\(n\), \(\pi\)) where \[ \pi = \Pr(X = 1) \] is the marginal prevalence of exposure. The distribution of \(\K_1\) is binomial(\(n\), \(p\)) where \[ p = \Pr(D = 1) \] is the marginal prevalence or risk of disease.

7.2 Hypothesis tests for independence in a 2x2 table

When exposure and disease are independent, the multiplication rule for independent events implies that \[ \Pr(X = x \text{ and } D = d) = \Pr(X = x) \Pr(D = d) \] for all possible values \(x\) of \(X\) and \(d\) of \(D\). There are two equivalent ways to express this null hypothesis that will prove useful in thinking about epidemiologic study design: one in terms of conditional risks of disease given exposure and one in terms of conditional prevalences of exposure given disease.

7.2.1 Equality of conditional probabilities

Independence of exposure and disease can be expressed in terms of equality of conditional probabilities of disease (or disease onset) given exposure. Let \[ p_1 = \Pr(D = 1 \given{} X = 1) \] be the risk of disease among the exposed and \[ p_0 = \Pr(D = 1 \given{} X = 0) \] be the prevalence or risk of disease among the unexposed. If exposure and disease are independent, then \[ \Pr(D = 1 \given{} X = x) = \frac{\Pr(D = 1) \Pr(X = x)}{\Pr(X = x)} = \Pr(D = 1) \] for \(x = 1\) and \(x = 0\). Therefore, \(p_1 = p_0\) if exposure and disease are independent. Conversely, suppose \(p_1 = p_0\). By definition of \(p_1\) and \(p_0\), \[ \Pr(D = 1 \given{} X = 1) = \Pr(D = 1 \given{} X = 0). \] Expanding the conditional probabilities, we get \[ \frac{\Pr(D = 1 \text{ and } X = 1)}{\Pr(X = 1)} = \frac{\Pr(D = 1 \text{ and } X = 0)}{\Pr(X = 0)}. \] This can be rewritten as \[ \frac{\Pr(D = 1 \vand X = 1)}{\Pr(X = 1)} = \frac{\Pr(D = 1) - \Pr(D = 1 \vand X = 1)}{1 - \Pr(X = 1)}. \] Cross-multiplying the numerators and denominators shows that this equality holds if and only if \[ \Pr(D = 1 \vand X = 1) = \Pr(D = 1) \Pr(X = 1). \] Because \(D\) and \(X\) are binary, this is establishes that \(D\) and \(X\) are independent random variables. Therefore, \(p_1 = p_0\) implies that exposure and disease are independent. Combining both results shows that \(H_0: p_1 = p_0\) is equivalent to the null hypothesis that exposure and disease are independent.

A similar argument applies to the conditional prevalence of exposure given disease status. Let \[ \pi_1 = \Pr(X = 1 \given D = 1) \] be the prevalence of exposure among cases and \[ \pi_0 = \Pr(X = 1 \given D = 0) \] be the prevalence of exposure among controls. The null hypothesis \(H_0: \pi_1 = \pi_0\) is equivalent to the null hypothesis that exposure and disease are independent.

7.2.2 Hypergeometric chi-squared test

Under the null hypothesis that exposed and disease are independent, we have \[ \begin{aligned} p_{\A} &= \Pr(X = 1) \Pr(D = 1) = \pi p, \\ p_{\B} &= \Pr(X = 1) \Pr(D = 0) = \pi (1 - p), \\ p_{\C} &= \Pr(X = 0) \Pr(D = 1) = (1 - \pi) p, \\ p_{\D} &= \Pr(X = 0) \Pr(D = 0) = (1 - \pi) p. \end{aligned} \] The marginal prevalence of exposure \(\pi\) and the marginal risk of disease \(p\) are both unknown. In a score test of the null hypothesis, these are nuisance parameters that can be replaced by maximum likelihood estimates (Rao 1948; Boos and Stefanski 2013). Because \(\R_1\) has an approximate binomial(\(n\), \(\pi\)) distribution when \(N \gg n\), \[ \hat{\pi} = \frac{r_1}{n}. \tag{7.2}\] is the maximum likelihood estimate of \(\pi\) based on Table 7.2. Because \(\K_1\) has an approximate binomial(\(n\), \(p\)) distribution when \(N \gg n\), \[ \hat{p} = \frac{k_1}{n} \tag{7.3}\] is the maximum likelihood estimate of \(p\) based on Table 7.2. When we use these maximum likelihood estimates of \(\pi\) and \(p\) to test independence, we are conditioning on the row and column totals in the observed 2x2 table in Table 7.2.

Given the margins of a 2x2 table, the entire table is determined by any one of the four cell counts. Table 7.3 shows how the cell counts in Table 7.2 are determined by \(\A\) and the margins. Because all cell counts must be nonnegative, we must have \(\A \geq 0\), \(\A \leq r_1\), and \(\A \leq k_1\). In the bottom right cell of the \(2 \times 2\) table, we must have \[ \A - (a - d) \geq 0. \] Therefore, \[ a_\text{min} = \max(0, a - d) \leq \A \leq \min(r_1, k_1) = a_\text{max}. \] Note that the cells along the diagonal of the \(2\times 2\) table (the \(\A\) and \(\D\) cells) both increase with \(\A\), while the cells off the diagonal (the \(\B\) and \(\C\) cells) both decrease with \(\A\). Any of the other cells could also determine the entire table given the margins, and constraints on the possible values of \(\B\), \(\C\), and \(\D\) given the margins could be found in a similar way.

Table 7.3: 2x2 table determined by \(\A\) and the margins.
\(D = 1\) \(D = 0\) Total
\(X = 1\) \(\A\) \(r_1 - \A\) \(r_1\)
\(X = 0\) \(k_1 - \A\) \(\A - (a - d)\) \(r_0\)
Total \(k_1\) \(k_0\) \(n\)

The conditional distribution of the cell count \(\A\) given the margins of Table 7.2 is hypergeometric. Imagine our sample as a bowl of \(n\) marbles, \(r_1\) of which are exposed and \(r_0\) of which are unexposed. If we randomly choose \(k_1\) marbles without replacement to represent the individuals with disease, then \(\A\) is the number of exposed marbles in our sample. The probability that we get \(a\) exposed marbles and \(k_1 - a\) unexposed marbles is \[ \Pr(\A = a \given{} \margins) = \frac{\binom{r_1}{a} \binom{r_0}{k_1 - a}}{\binom{n}{k_1}} = \frac{\binom{r_1}{a} \binom{r_0}{c}}{\binom{n}{k_1}} = \frac{r_1!\, r_0!\, k_1!\, k_0!}{a!\, b!\, c!\, d!\, n!} \] We could also view our sample as a bowl of \(n\) marbles of which \(k_1\) have disease (or disease onset) and \(k_0\) do not. In that case, \(A\) is the number of diseased marbles in a sample of \(r_1\) marbles that represent exposed individuals and we get exactly the same hypergeometric distribution of \(\A\). The cell counts \(\B\), \(\C\), and \(\D\) also have hypergeometric distributions given the margins of the table.

Under the null hypothesis that exposure and disease are independent, the conditional mean of \(\A\) given the margins of Table 7.2 is \[ \E(\A \given{} \margins) = n \hat{\pi} \hat{p} = \frac{r_1 k_1}{n} \] and its conditional variance is \[ \Var(\A \given{} \margins) = \frac{r_1 r_0 k_1 k_0}{n^2 (n - 1)}. \] For large \(n\), the hypergeometric distribution is approximately normal so the hypergeometric chi-squared statistic is \[ \chisqH = \frac{\big(a - \E(\A \given{} \margins)\big)^2}{\Var(\A \given{} \margins)} = \frac{(n - 1) (a d - b c)^2}{r_1 r_0 k_1 k_0} \tag{7.4}\] Under the null hypothesis, \(\chisqH \approxsim \chi^2_1\) (i.e., the chi-squared distribution with one degree of freedom). The p-value is \(1 - F(\chisqH)\) where \(F\) is the cumulative distribution function (CDF) of the \(\chi^2_1\) distribution. We reject the null hypothesis at significance level \(\alpha\) when \(\chisqH\) is sufficiently large that the p-value is less than \(\alpha\). We get exactly the same hypothesis test using \(\B\), \(\C\), or \(\D\) instead of \(\A\).

7.2.3 Pearson’s chi-squared test

A more general approach to testing independence of the rows and columns in a contingency table is Pearson’s chi-squared test (Pearson 1900, 1922).2 Like the hypergeometric test, Pearson’s chi-squared test conditions on the margins of the table. In a contingency table with \(I\) rows and \(J\) columns, let \(O_{ij}\) be the observed cell count in row \(i\) and column \(j\). Let \(r_i\) be the total for row \(i\) and \(k_j\) be the total for column \(j\). Under independence, the expected cell count is \[ E_{ij} = \frac{r_i k_j}{n}. \] Pearson’s chi-squared statistic is \[ \chisqP = \sum_{i = 1}^I \sum_{j = 1}^J \frac{(O_{ij} - E_{ij})^2}{E_{ij}} \tag{7.5}\] Under the null hypothesis that the variables defining the rows and the colums are independent, \(\chisqP\) has a chi-squared distribution with \((I - 1) (J - 1)\) degrees of freedom (Fisher 1922; Boos and Stefanski 2013). In any contingency table, Pearson’s chi-squared test is the score test of the null hypothesis that the rows and columns are independent based on a multinomial model (see Section 7.1.2) for the joint distribution of the cell counts (Boos and Stefanski 2013).

In Table 7.2, we have \(I = J = 2\) with \(O_{11} = a\), \(O_{12} = b\), \(O_{21} = c\), and \(O_{22} = d\). Using the multivariate hypergeometric distribution or its multinomial approximation, we have the following estimated expected cell counts under the null hypothesis that exposure and disease are independent: \[ \begin{aligned} \E_{11} = \E(\A \given \margins) &= n \hat{\pi} \hat{p} = \frac{r_1 k_1}{n} \\ \E_{12} = \E(\B \given \margins) &= n \hat{\pi} (1 - \hat{p}) = \frac{r_1 k_0}{n} \\ \E_{21} = \E(\C \given \margins) &= n (1 - \hat{\pi}) \hat{p} = \frac{r_0 k_1}{n} \\ \E_{22} = \E(\D \given \margins) &= n (1 - \hat{\pi}) (1 - \hat{p}) = \frac{r_0 k_0}{n}. \end{aligned} \tag{7.6}\] As in the hypergeometric chi-squared test, we are conditioning on the margins of the table because we are using the maximum likelihood estimates of \(\pi\) (the prevalence of exposure) and \(p\) (the risk of disease). When the dust settles in Equation 7.5, we get \[ \chisqP = \frac{n (ad - bc)^2}{r_1 r_0 k_1 k_0} = \frac{n}{n - 1} \chisqH. \tag{7.7}\] When exposure and disease are independent, \(\chisqP\) has a chi-squared distribution with \((2 - 1) (2 - 1) = 1\) degrees of freedom. The p-value is \(1 - F(\chisqP)\) where \(F\) is the CDF of the \(\chi^2_1\) distribution, and we reject the null hypothesis at significance level \(\alpha\) when \(\chisqP\) is sufficiently large that the p-value is less than \(\alpha\).

The chi-squared approximation to the distribution of \(\chisqP\) is generally considered acceptable if the minimum expected cell count is greater than or equal to five, and it is likely to be accurate whenever the average expected cell count is greater than or equal to \(7.5\) (Roscoe and Byars 1971), which is equivalent to \(n \geq 30\) for a 2x2 table.3 Because \(\chisqH < \chisqP\), the hypergeometric chi-squared test is slightly more conservative than Pearson’s chi-squared test in the sense that it is less likely to reject the null hypothesis of independence. For large \(n\), there is no practical difference.

7.2.4 Small samples and exact tests*

In small samples, the hypergeometric distribution can be used to calculate “exact” p-values. For two-sided alternative hypotheses, this leads to Fisher’s exact test (Fisher 1935; Irwin et al. 1935) or Blaker’s exact test (Blaker 2000). These use the hypergeometric PMF to calculate a p-value for the null hypothesis of independent rows and columns. These tests differ slightly in the way that they define the tails of the distribution of \(\A\), and there are two versions of Fisher’s exact test.

The minimum likelihood Fisher’s exact test defines the p-value as the sum of the probabilities of all possible \(\mathcal{a}\) such that \(\Pr(A = \mathcal{a} \given{} \margins) \leq \Pr(\A = a \given{} \margins)\). The simpler but slightly less powerful central Fisher’s exact test defines the p-value as twice the twice the minimum of the tail probabilities \(\Pr(\A \leq a \given{} \margins)\) and \(\Pr(A \geq a \given{} \margins)\).4

Blaker’s exact test defines the p-value as the minumum tail probability plus the probability of an opposite tail defined so that its probability is less than or equal to that of the smaller tail. For example: If the smaller tail is \(\A \leq a\), then the p-value is \[ \Pr(A \leq a \given{} \margins) + \sum_{a' = a_\text{opp}}^{a_\text{max}} \Pr(A = a' \given{} \margins) \] where \(a_\text{opp}\) is chosen so that the sum in the second term is less than or equal to \(\Pr(A \leq a \given{} \margins)\). Blaker’s test is sometimes more powerful and never less powerful than both versions of Fisher’s exact test (Blaker 2000; Fay 2010).

These tests are ``exact’’ in the sense that they reject a true null hypothesis with probability less than or equal to the nominal significance level \(\alpha\). However, they are often overly conservative in that the true significance level (i.e., the actual probability of rejecting the null hypothesis when it is true) can be substantially less than \(\alpha\). Using mid-p values mitigates this problem, ensuring that the true significance level stays closer to \(\alpha\). The price of this is that the true significance level of the test can be slightly greater than \(\alpha\), so the mid-p tests are no longer “exact” (Lancaster 1961; Routledge 1992; Agresti 2013).

7.3 Cohort studies

Random sampling from the population is not the most efficient way to detect a departure from independence of exposure and disease. By rearranging the Pearson chi-squared statistic \(\chisqP\) from equation Equation 7.7, we can identify two strategies for generating a more powerful test. One is to select participants by exposure, which leads to the cohort study design. The other is to select participants by disease, which leads to the case-control study design. In both cases, a balanced study design is optimal (or near-optimal) and Pearson’s chi-squared test is the score test of the null hypothesis that exposure and disease are independent. If participation in the study involves any cost, risk, or inconvenience, then maximizing the power of the study for a given number of participants is an important ethical consideration because an inefficient study will place an unnecessary burden on some participants.

7.3.1 Selection by exposure

The Pearson chi-squared statistic \(\chisqP\) from Equation 7.5 can be rewritten in terms of the risks of disease in exposed and unexposed individuals. As above, let \(p_1\) be the risk of disease in the exposed and \(p_0\) be the risk of disease in the unexposed. In Table 7.2, their maximum likelihood estimates are \(\hat{p}_1 = a / r_1\) and \(\hat{p}_0 = c / r_0\). The maximum likelihood estimate of \(p_1 - p_0\) is \[ \hat{p}_1 - \hat{p}_0 = \frac{a}{a + b} - \frac{c}{c + d} = \frac{a d - b c}{(a + b) (c + d)} = \frac{a d - b c}{r_1 r_0}. \tag{7.8}\] Section 7.2.1 showed that the null hypothesis that exposure and disease are independent is equivalent to \(H_0: p_1 = p_0 = p\) where \(p\) is the marginal risk of disease.

When \(n \ll N\) and the null hypothesis is true, \(\A\) has an approximate binomial(\(r_1\), \(p\)) conditional distribution, \(\C\) has an approximate binomial(\(r_0\), \(p\)) conditional distribution, and they are conditionally independent given the row sums \(r_1\) and \(r_0\). Thus, the large-sample variance of \(\hat{p}_1 - \hat{p}_0\) under the null is approximately \[ \Var_0(\hat{p}_1 - \hat{p}_0) = p (1 - p) \bigg(\frac{1}{r_1} + \frac{1}{r_0}\bigg) = p (1 - p) \frac{n}{r_1 r_0} \tag{7.9}\] where we used \(n = r_1 + r_0\). Replacing the unknown \(p\) with its maximum likelihood estimate \(\hat{p} = k_1 / n\), we get the estimated null variance \[ \hat{\Var}_0(\hat{p}_1 - \hat{p}_0) = \hat{p} (1 - \hat{p}) \frac{n}{r_1 r_0} = \frac{k_1 k_0}{r_1 r_0 n} \tag{7.10}\] where we used \(1 - \hat{p} = k_0 / n\). Combining Equation 7.8 and Equation 7.9, we get \[ \frac{(\hat{p}_1 - \hat{p}_0)^2}{\hat{p} (1 - \hat{p}) \Big(\frac{1}{r_1} + \frac{1}{r_0}\Big)} = \frac{n (a d - b c)^2}{r_1 r_0 k_1 k_0} = \chisqP \] (see Equation 7.7). Let \(\varphi\) be the proportion of our sample that is exposed, so \(r_1 = \varphi n\) and \(r_0 = (1 - \varphi) n\). As \(n \rightarrow \infty\), we have \(r_1 \rightarrow \infty\) and \(r_0 \rightarrow \infty\). The law of large numbers (LLN) guarantees that \(\hat{p}_1 \rightarrow p_1\), \(\hat{p}_0 \rightarrow p_0\), and \[ \hat{p} \rightarrow p_\varphi = \varphi p_1 + (1 - \varphi) p_0. \] In large samples, \[ \chisqP \approx \frac{(p_1 - p_0)^2}{p_\varphi (1 - p_\varphi) \Big(\frac{1}{r_1} + \frac{1}{r_0}\Big)} = \frac{(p_1 - p_0)^2}{p_\varphi (1 - p_\varphi) \frac{1}{\phi (1 - \phi) n}} \tag{7.11}\] The numerator of Equation 7.11 is fixed, but the denominator depends on \(r_1\), \(r_0\), and \(\varphi = r_1 / n\). By sampling according to exposure, we can choose \(r_1\) and \(r_0\) to increase the power of the Pearson chi-squared test for a fixed total number of participants.

7.3.2 Score test for independence in a cohort study*

We need to make sure that sampling by exposure does not change the score test of the null hypothesis that exposure and disease are independent. Using a binomial(\(r_1\), \(p_1\)) distribution for the number of individuals with disease the exposed group and a binomial(\(r_0\), \(p_0\)) distribution for the number of individuals with disease in the unexposed group, the log likelihood is \[ \ell(p_1, p_0) = \A \ln p_1 + \B \ln(1 - p_1) + \C \ln p_0 + \D \ln(1 - p_0), \] where we have dropped terms that do not depend on \(p_1\) or \(p_0\). In order to calculate the expected information for the score test, we view the log likelihood as a random variable whose value will be determined by the realized values \(a\), \(b\), \(c\), and \(d\) of the random variables \(\A\), \(\B\), \(\C\), and \(\D\). The score function and the information function will also be treated as random variables.

Because \(\ell(p_1, p_0)\) depends on two parameters, the score function is a column vector of length two: \[ U(p_1, p_0) = \begin{pmatrix} \frac{\partial}{\partial p_1} \ell(p_1, p_0) \\[5pt] \frac{\partial}{\partial p_0} \ell(p_1, p_0) \end{pmatrix} = \begin{pmatrix} \frac{\A}{p_1} - \frac{\B}{1 - p_1} \\[5pt] \frac{\C}{p_0} - \frac{\D}{1 - p_0} \end{pmatrix}. \] The information \(I(p_1, p_0)\) is a 2x2 matrix \[ \begin{bmatrix} \frac{\partial^2}{\partial p_1^2} \ell(p_1, p_0) & \frac{\partial^2}{\partial p_1 \partial p_0} \ell(p_1, p_0) \\[5pt] \frac{\partial^2}{\partial p_0 \partial p_1} \ell(p_1, p_0) & \frac{\partial^2}{\partial p_0^2} \ell(p_1, p_0) \end{bmatrix} \\ = \begin{bmatrix} \frac{\A}{p_1^2} + \frac{\B}{(1 - p_1)^2} & 0 \\ 0 & \frac{\C}{p_0^2} + \frac{\D}{(1 - p_0)^2} \end{bmatrix}. \] The realized value of \(U(p_1, p_0)\) and the observed information \(I(p_1, p_0)\) are obtained by replacing the random variables \(\A\), \(\B\), \(\C\), and \(\D\) with their realized values \(a\), \(b\), \(c\), and \(d\).

The score statistic is calculated under the null hypothesis \(H_0: p_1 = p_0 = p\), and we use the expected information (Freedman 2007). Let \(\E_0(Y)\) be the expected value of a random variable \(Y\) calculated under \(H_0\). Then \(\E_0(\A) = n_1 p\), \(\E_0(\B) = n_1 (1 - p)\), \(\E_0(\C) = n_0 p\), and \(\E_0(\D) = n_0 (1 - p)\), so the expected information under \(H_0\) is \[ \mathcal{I}(p, p) = \E_0[I(p, p)] = \begin{bmatrix} \frac{n_1}{p} + \frac{n_1}{1 - p} & 0 \\ 0 & \frac{n_0}{p} + \frac{n_0}{1 - p} \end{bmatrix}. \] Both \(U(p, p)\) and \(\mathcal{I}(p, p)\) depend on the unknown \(p\), which we replace with its maximum likelihood estimate \(\hat{p} = k_1 / n\). This gives us the score \[ U(\hat{p}, \hat{p}) = \begin{pmatrix} \frac{a}{\hat{p}} - \frac{b}{1 - \hat{p}} \\[5pt] \frac{c}{\hat{p}} - \frac{d}{1 - \hat{p}} \end{pmatrix} = \begin{pmatrix} \frac{n a}{k_1} - \frac{n b}{k_0} \\[5pt] \frac{n c}{k_1} - \frac{n d}{k_0} \end{pmatrix} = \begin{pmatrix} \frac{n (a d - b c)}{k_1 k_0} \\[5pt] - \frac{n (a d - b c)}{k_1 k_0} \end{pmatrix}. \] where we used \(k_1 = a + c\) and \(k_0 = b + d\). The expected information at \(p = \hat{p}\) is \[ \mathcal{I}(\hat{p}, \hat{p}) = \begin{bmatrix} \frac{r_1 n^2}{k_1 k_0} & 0 \\ 0 & \frac{r_0 n^2}{k_1 k_0} \end{bmatrix} \;\Rightarrow\; \mathcal{I}^{\,-1}(\hat{p}, \hat{p}) = \begin{bmatrix} \frac{k_1 k_0}{r_1 n^2} & 0 \\ 0 & \frac{k_1 k_0}{r_0 n^2} \end{bmatrix} \] where we used \(n_1 = r_1\) and \(n_0 = r_0\). The score statistic is \[ U(\hat{p}, \hat{p})^\transpose \mathcal{I}(\hat{p}, \hat{p})^{-1} U(\hat{p}, \hat{p}) = \frac{n (a d - b c)^2}{r_1 r_0 k_1 k_0} = \chisqP, \] from Equation 7.7. Because \(H_0\) reduces the degrees of freedom from two (\(p_1\) and \(p_0\)) to one (\(p_1 = p_0 = p\)), \(\chisqP\) has an asymptotic \(\chi^2\) distribution with \(2 - 1 = 1\) degree of freedom under the null. Therefore, Pearson’s chi-squared test is the score test of independence of exposure and disease in a cohort study. The row sums \(r_1\) and \(r_0\) are fixed by design, and we condition on the column sums \(k_1\) because we use the maximum likelihood estimate \(\hat{p} = k_1 / n\) of the risk of disease under \(H_0\).

When it uses the expected information, the score test does not depend on the parameterization of the model for \(p_1\) and \(p_0\) (Boos and Stefanski 2013). We get the same score statistic \(\chisqP\) and the same \(\chi^2_1\) distribution under the null even if the model uses transformations of \(p_1\) and \(p_0\) (e.g., log or logit) or if it is parameterized in terms of the risk difference \(\RD = p_1 - p_0\), the risk ratio \(\RR = p_1 / p_0\), or the odds ratio \(\OR = \odds(p_1) / \odds(p_0)\) where \(\odds(p) = p / (1 - p)\). All roads lead to the same score test of the null hypothesis that exposure and disease are independent, which corresponds to \(\RD = 0\) and \(\RR = \OR = 1\).

7.3.3 Optimal sampling by exposure

Having established that \(\chisqP\) is the score statistic for testing the independence of exposure and disease in a cohort study, we can choose \(r_1\) and \(r_0\) to maximize the power of the test for a given number of participants \(n = r_1 + r_0\). The value of the chi-squared statistic in Equation 7.11 depends on \(r_1\) and \(r_0\) only in the denominator, so we can maximize the statistic by minimizing its denominator. Writing the denominator of Equation 7.10 in terms of \(p_1\), \(p_0\), and \(\varphi = r_1 / n\) of the sample that is exposed and simplifying gives us \[ \frac{n p (1 - p)}{r_1 r_0} = \frac{\varphi}{1 - \varphi} p_1 (1 - p_1) + \frac{1 - \varphi}{\varphi} p_0 (1 - p_0) + C(p_1, p_0) \tag{7.12}\] where \(C(p_1, p_0) = p_1 (1 - p_0) + p_0 (1 - p_1)\) does not depend on \(\varphi\). The derivative of this with respect to \(\varphi\) is \[ \frac{\dif}{\dif \varphi} \frac{n p (1 - p)}{r_1 r_0} = \frac{p_1 (1 - p_1)}{(1 - \varphi)^2} - \frac{p_0 (1 - p_0)}{\varphi^2}, \tag{7.13}\] which equals zero when \[ \frac{\varphi}{1 - \varphi} = \sqrt{\frac{p_0 (1 - p_0)}{p_1 (1 - p_1)}}. \tag{7.14}\] To see that this is a minimum and not a maximum, notice that the function in equation Equation 7.12 takes large values for \(\varphi\) near one when \(p_1 (1 - p_1) > 0\) and for \(\varphi\) near zero when \(p_0 (1 - p_0) > 0\). It also has a positive second derivative with respect to \(\varphi\).

Solving for \(\varphi\) in Equation 7.14 shows that a proportion exposed of \[ \varphi^* = \frac{1}{1 + \sqrt{\frac{p_1 (1 - p_1)}{p_0 (1 - p_0)}}}. \tag{7.15}\] maximizes the expected value of the Pearson chi-squared statistic \(\chisqP\) for a given \(n\) (Walter 1977). The expression inside the square root is the variance of a Bernoulli(\(p_1\)) random variable divided by the variance of a Bernoulli(\(p_0\)) random variable. Figure 7.1 shows how \(\varphi^*\) depends on this variance ratio. When \(p_1 \approx p_0\), the Bernoulli variance ratio is approximately one and \(\varphi^* \approx 0.5\).

Code
optim-phi.R
## Optimal proportion exposed in a cohort study

# plot of optimal phi as a function of the Bernoulli variance ratio
logvratio <- seq(-3, 3, by = 0.01)
phi <- function(v) 1 / (1 + sqrt(v))
plot(logvratio, phi(exp(logvratio)), type = "l", xaxt = "n", ylim = c(0, 1),
     xlab = "Bernoulli variance ratio (log scale)",
     ylab = expression(paste("Optimal proportion exposed or cases (", phi, "*)")))
axis(1, at = log(c(1 / c(16, 8, 4, 2), 1, c(2, 4, 8, 16))),
     labels = c("1/16", "1/8", "1/4", "1/2", 1, 2, 4, 8, 16))
grid()
abline(h = 0.5, col = "darkgray")
Figure 7.1: The optimal proportion exposed \(\varphi^*\) in a cohort study as a function of the Bernoulli variance ratio \(p_1 (1 - p_1) / (p_0 (1 - p_0))\). In a case-control study, \(\varphi^*\) represents the optimal proportion of the sample who are cases and the Bernoulli variance ratio is \(\pi_1 (1 - \pi_1) / (\pi_0 (1 - \pi_0))\). There is a dark gray horizontal line at \(\varphi = 0.5\), which represents a balanced study.

The “optimal” proportion exposed \(\varphi^*\) from Equation 7.15 is based on maximizing the value of \(\chisqP\) in large samples. For a given sample size, the power of the test is actually determined by the distribution of possible values of \(\chisqP\), so the maximum power can occur at a value of \(\varphi\) slightly different from \(\varphi^*\). Figure 7.2 shows the power achieved by Pearson’s chi-squared test at several combinations of \(p_1\), \(p_0\), and \(n\). In all cases, the power at \(\varphi = 0.5\) is close to that at \(\varphi^*\). In several cases, the power at \(\varphi = 0.5\) exceeds that at \(\varphi^*\). If we have strong enough prior information about \(p_1\) and \(p_0\) to justify an imbalanced study design, the value of testing the null hypothesis that \(p_1 = p_0\) is questionable. Without such prior information, a balanced study is a safe bet to be optimal or near-optimal in terms of the power to detect an association between exposure and disease (Walter 1977).

chisq-power.R
## Actual power of a Pearson chi-squared test

# calculate Pearson chi-squared test power
# This can take a few minutes to run with large n.
powers <- function(p1, p0, n, level = 0.95) {
  chisq_alpha <- qchisq(level, df = 1)
  htest <- function(r1) {
    r0 <- n - r1
    joint_dbinom <- outer(0:r1, 0:r0,
                          function(a, c) dbinom(a, r1, p1) * dbinom(c, r0, p0))
    joint_include <- outer(0:r1, 0:r0,
                           function(a, c) max(a, c) > 0 & a + c < n)
    acpower <- Vectorize(function(a, c) {
      if (max(a, c) > 0 & a + c < n) {
        b <- r1 - a
        d <- r0 - c
        k1 <- a + c
        k0 <- b + d
        chisqP <- n * (a * d - b * c)^2 / (r1 * r0 * k1 * k0)
        return(chisqP > chisq_alpha)
      } else {
        return(0)
      }
    })
    joint_power <- outer(0:r1, 0:r0, acpower)
    return(sum(joint_dbinom * joint_power) / sum(joint_dbinom * joint_include))
  }
  r1s <- 1:(n - 1)
  powers <- sapply(r1s, htest)
  return(data.frame(r1 = r1s, power = powers, n = n))
}

# optimal value proportion exposed (or proportion cases)
optimphi <- function(p1, p0) 1 / (1 + sqrt(p1 * (1 - p1) / (p0 * (1 - p0))))

# Pearson chi-squared test power for p1 = 0.1 and p0 = 0.02
power_10_02_400 <- powers(0.10, 0.02, 400)
power_10_02_200 <- powers(0.10, 0.02, 200)
power_10_02_100 <- powers(0.10, 0.02, 100)

# Pearson chi-squared test power for p1 = 0.10 and p0 = 0.05
power_10_05_400 <- powers(0.10, 0.05, 400)
power_10_05_200 <- powers(0.10, 0.05, 200)
power_10_05_100 <- powers(0.10, 0.05, 100)

# Pearson chi-squared test power for p1 = 0.2 and p0 = 0.02
power_20_02_400 <- powers(0.20, 0.02, 400)
power_20_02_200 <- powers(0.20, 0.02, 200)
power_20_02_100 <- powers(0.20, 0.02, 100)

# Pearson chi-squared test power for p1 = 0.2 and p0 = 0.05
power_20_05_400 <- powers(0.20, 0.05, 400)
power_20_05_200 <- powers(0.20, 0.05, 200)
power_20_05_100 <- powers(0.20, 0.05, 100)

# save values of graphical parameter "mar" before changing them
orig_mar <- par("mar")
orig_mfrow <- par("mfrow")

# png(filename = "chisq-power.png")
par(mar = c(4, 4, 3, 2))
par(mfrow = c(2, 2))

# Pearson chi-squared test power for p1 = 0.1 and p0 = 0.02
plot(power_10_02_400$r1 / 400, power_10_02_400$power,
     type = "l", ylim = c(0, 1),
     main = expression(paste(p[1], " = 0.10", " and ", p[0], " = 0.02")),
     xlab = "",
     ylab = "Power (Pearson chi-squared test)")
lines(power_10_02_200$r1 / 200, power_10_02_200$power, lty = "dashed")
lines(power_10_02_100$r1 / 100, power_10_02_100$power, lty = "dotted")
abline(v = 0.5, col = "darkgray")
abline(v = optimphi(0.10, 0.02), lty = "dashed", col = "darkgray")
grid()

# Pearson chi-squared test power for p1 = 0.10 and p0 = 0.05
plot(power_10_05_400$r1 / 400, power_10_05_400$power,
     type = "l", ylim = c(0, 1),
     main = expression(paste(p[1], " = 0.10", " and ", p[0], " = 0.05")),
     xlab = "", ylab = "")
lines(power_10_05_200$r1 / 200, power_10_05_200$power, lty = "dashed")
lines(power_10_05_100$r1 / 100, power_10_05_100$power, lty = "dotted")
abline(v = 0.5, col = "darkgray")
abline(v = optimphi(0.10, 0.05), lty = "dashed", col = "darkgray")
grid()
legend("topright", bg = "white", lty = c("solid", "dashed", "dotted"),
       legend = c("n = 400", "n = 200", "n = 100"))

# Pearson chi-squared test power for p1 = 0.2 and p0 = 0.02
plot(power_20_02_400$r1 / 400, power_20_02_400$power,
     type = "l", ylim = c(0, 1),
     main = expression(paste(p[1], " = 0.20", " and ", p[0], " = 0.02")),
     xlab = expression(paste("Proportion exposed (", phi, ")")),
     ylab = "Power (Pearson chi-squared test)")
lines(power_20_02_200$r1 / 200, power_20_02_200$power, lty = "dashed")
lines(power_20_02_100$r1 / 100, power_20_02_100$power, lty = "dotted")
abline(v = 0.5, col = "darkgray")
abline(v = optimphi(0.20, 0.02), lty = "dashed", col = "darkgray")
grid()

# Pearson chi-squared test power for p1 = 0.2 and p0 = 0.05
plot(power_20_05_400$r1 / 400, power_20_05_400$power,
     type = "l", ylim = c(0, 1),
     main = expression(paste(p[1], " = 0.20", " and ", p[0], " = 0.05")),
     xlab = expression(paste("Proportion exposed (", phi, ")")),
     ylab = ""
    #  ylab = "Power (Pearson chi-squared test)"
     )
lines(power_20_05_200$r1 / 200, power_20_05_200$power, lty = "dashed")
lines(power_20_05_100$r1 / 100, power_20_05_100$power, lty = "dotted")
abline(v = 0.5, col = "darkgray")
abline(v = optimphi(0.20, 0.05), lty = "dashed", col = "darkgray")
grid()
# dev.off()

# reset graphical parameters "mar" and "mfrow"
par(mar = orig_mar)
par(mfrow = orig_mfrow)

7.4 Case-control studies

The Pearson chi-squared statistic \(\chisqP\) from Equation 7.7 can also be rewritten in terms of the prevalence of exposure among cases (participants who have disease or disease onset) and controls (participants who do not have disease or disease onset). This leads to the case-control study design.

7.4.1 Selection by disease

As above, let \(\pi_1\) be the exposure prevalence in cases and \(\pi_0\) be the exposure prevalence in controls. Their maximum likelihood estimates are \(\hat{\pi}_1 = a / k_1\) and \(\hat{\pi}_0 = c / k_0\), so the maximum likelihood estimate of \(\pi_1 - \pi_0\) is \[ \hat{\pi}_1 - \hat{\pi}_0 = \frac{a}{a + c} - \frac{b}{b + d} = \frac{a d - b c}{(a + c) (b + d)} = \frac{a d - b c}{k_1 k_0}. \tag{7.16}\] Section 7.2.1 showed that null hypothesis that exposure and disease are independent is equivalent to \(H_0: \pi_1 = \pi_0 = \pi\) where \(\pi\) is the marginal prevalence of exposure.

In large samples under the null, \(\A\) has a binomial(\(k_1\), \(\pi\)) conditional distribution, \(\B\) has a binomial(\(k_0\), \(\pi\)) conditional distribution, and they are conditionally independent given the column sums \(k_1\) and \(k_0\). Thus, the large-sample variance of \(\hat{\pi}_1 - \hat{\pi}_0\) under the null is \[ \Var_0(\hat{\pi}_1 - \hat{\pi}_0) = \pi (1 - \pi) \bigg(\frac{1}{k_1} + \frac{1}{k_0}\bigg) = \pi (1 - \pi) \frac{n}{k_1 k_0} \tag{7.17}\] where we used \(k_1 + k_0 = n\). Replacing the unknown \(\pi\) with its maximum likelihood estimate \(\hat{\pi} = r_1 / n\), we get the estimated null variance \[ \hat{\Var}_0(\hat{\pi}_1 - \hat{\pi}_0) = \hat{\pi} (1 - \hat{\pi}) \frac{n}{k_1 k_0} = \frac{r_1 r_0}{k_1 k_0 n} \tag{7.18}\] where we used \(1 - \hat{\pi} = r_0 / n\). Combining the results in Equation 7.16} and Equation 7.18, we get \[ \frac{(\hat{\pi}_1 - \hat{\pi}_0)^2}{\hat{\Var}_0(\hat{\pi}_1 - \hat{\pi}_0)} = \frac{n (a d - b c)^2}{r_1 r_0 k_1 k_0} = \chisqP \] (see Equation 7.7). The LLN guarantees that \(\hat{\pi}_1 \rightarrow \pi_1\) as \(k_1 \rightarrow \infty\) and that \(\hat{\pi}_0 \rightarrow \pi_0\) as \(k_0 \rightarrow \infty\). In large samples, \[ \chisqP \approx \frac{(\pi_1 - \pi_0)^2}{\pi (1 - \pi) \Big(\frac{1}{k_1} + \frac{1}{k_0}\Big)} \tag{7.19}\] because the sample average \[ \frac{k_1 \pi_1 + k_0 \pi_0}{n} \rightarrow \pi \] as \(n \rightarrow \infty\) by the LLN. The numerator of Equation 7.19 is fixed, but the denominator depends on \(k_1\) and \(k_0\). By sampling according to disease status, we can choose \(k_1\) and \(k_0\) to increase the power of the Pearson chi-squared test for a fixed total number of participants.

7.4.2 Score test for independence in a case-control study*

As with sampling by exposure in a cohort study, sampling by disease in a case-control study does not affect the score test of the null hypothesis that exposure and disease are independent. Using a binomial(\(k_1\), \(\pi_1\)) distribution for the number of exposed cases and a binomial(\(k_0\), \(\pi_0\)) distribution for the number of exposed controls, we get the log likelihood \[ \ell(\pi_1, \pi_0) = \A \ln \pi_1 + \C \ln(1 - \pi_1) + \B \ln \pi_0 + \D \ln(1 - \pi_0) \] as a random variable whose value will be determined by the data. Calculating the score \(U(\pi, \pi)\) and the expected information \(\mathcal{I}(\pi, \pi)\) under the null hypothesis \(H_0: \pi_1 = \pi_0 = \pi\) and evaluating them at \(\hat{\pi} = r_1 / n\), we get \[ U(\hat{\pi}, \hat{\pi}) = \begin{pmatrix} \frac{a}{\hat{\pi}} + \frac{c}{1 - \hat{\pi}} \\[5pt] \frac{b}{\hat{\pi}} + \frac{d}{1 - \hat{\pi}} \end{pmatrix} = \begin{pmatrix} \frac{n (a d - b c)}{r_1 r_0} \\[5pt] - \frac{n (a d - b c)}{r_1 r_0} \end{pmatrix} \] and \[ \mathcal{I}(\hat{\pi}, \hat{\pi}) = \begin{bmatrix} \frac{k_1 n^2}{r_1 r_0} & 0 \\ 0 & \frac{k_0 n^2}{r_1 r_0} \end{bmatrix} \;\Rightarrow\; \mathcal{I}^{\,-1}(\hat{\pi}, \hat{\pi}) = \begin{bmatrix} \frac{r_1 r_0}{k_1 n^2} & 0 \\ 0 & \frac{r_1 r_0}{k_0 n^2} \end{bmatrix} \] The score statistic is \[ U(\hat{\pi}, \hat{\pi})^\transpose \mathcal{I}(\hat{\pi}, \hat{\pi})^{-1} U(\hat{\pi}, \hat{\pi}) = \frac{n (a d - b c)^2}{r_1 r_0 k_1 k_0} = \chisqP, \] which is the Pearson chi-squared statistic from Equation 7.7. The null hypothesis reduces the degrees of freedom from two (\(\pi_1\) and \(\pi_0\)) to one (\(\pi_1 = \pi_0 = \pi\)), so the score statistic has a \(\chi^2_1\) distribution under \(H_0\). Therefore, Pearson’s chi-squared test is the score test of the null hypothesis \(H_0: \pi_0 = \pi_1\) in a case-control study. The column sums \(k_1\) and \(k_0\) are fixed by design, and we condition on the row sums \(r_1\) and \(r_0\) because we use the maximum likelihood estimate \(\hat{\pi} = r_1 / n\) for the prevalence of exposure under \(H_0\). Because of the invariance of the score test when it uses the expected information, any parameterization of the model for the exposure prevalences \(\pi_1\) and \(\pi_0\) leads to the same test of the null hypothesis that exposure and disease are independent.

7.4.3 Optimal sampling by disease

Having established that \(\chisqP\) is the score statistic for testing the independence of exposure and disease in a case-control study, we can choose \(k_1\) and \(k_0\) to maximize the power of the test for a given number of participants \(n = k_1 + k_0\). Let \(\varphi\) be the proportion of the sample who are cases. Then \[ \begin{aligned} k_1 &= \varphi n \\ k_0 &= (1 - \varphi) n \\ \pi &= \varphi \pi_1 + (1 - \varphi) \pi_0. \end{aligned} \] Substituting these into equation Equation 7.17 and simplifying gives us the denominator as a function of \(\varphi\): \[ \frac{n \pi (1 - \pi)}{k_1 k_0} = \frac{\varphi}{1 - \varphi} \pi_1 (1 - \pi_1) + \frac{1 - \varphi}{\varphi} \pi_0 (1 - \pi_0) + C(\pi_1, \pi_0) \] where \(C(\pi_1, \pi_0) = \pi_1 (1 - \pi_0) + \pi_0 (1 - \pi_1)\) does not depend on \(\varphi\). This is identical to The derivative with respect to \(\varphi\) is \[ \frac{\dif}{\dif \varphi} \frac{n \pi (1 - \pi)}{r_1 r_0} = \frac{\pi_1 (1 - \pi_1)}{(1 - \varphi)^2} - \frac{\pi_0 (1 - \pi_0)}{\varphi^2}. \] This is identical to Equation 7.13 if we replace \(p_1\) with \(\pi_1\) and \(p_0\) with \(\pi_0\), so the same argument used in Section 7.3.3 tells us that the Pearson chi-squared statistic \(\chisqP\) from a case-control study is maximized when the proportion of the sample comprised of cases is \[ \varphi^* = \frac{1}{1 + \sqrt{\frac{\pi_1 (1 - \pi_1)}{\pi_0 (1 - \pi_0)}}}. \tag{7.20}\] Here, the expression inside the square root is the variance of a Bernoulli(\(\pi_1\)) random variable divided by the variance of a Bernoulli(\(\pi_0\)) random variable. Figure 7.1 shows how \(\phi^*\) depends on this variance ratio. When \(\pi_1 \approx \pi_0\), the Bernoulli variance ratio is approximately one \(\phi^* \approx 0.5\).

The power functions shown in Figure 7.2 apply to a case-control study if we replace \(p_1\) with \(\pi_1\) and \(p_0\) with \(\pi_0\). The justification for recruiting equal numbers of cases and controls in a case-control study is exactly the same as that for recruiting equal numbers of exposed and unexposed in a cohort study: When testing the null hypothesis can be justified, a balanced study is almost always optimal or near-optimal in terms of its power to detect an association between exposure and disease (Walter 1977).

7.5 Choice of study design

We have shown that the power of the Pearson and hypergeometric chi-squared tests can be increased by sampling participants according to exposure (in a cohort study) or disease (in a case-control study) instead of taking a random sample from the population. It remains to see how to choose between a cohort study and a case-control study.

7.5.1 Odds ratio

To choose between the cohort and case-control study designs, it is extremely helpful that the estimated odds ratio is the same for all three study designs. In Table 7.2, the estimated odds ratio comparing the risks of disease in the exposed (numerator) and the unexposed (denominator) is \[ \frac{\odds(\hat{p}_1)}{\odds(\hat{p}_0)} = \frac{a / b}{c / d} = \frac{a d}{b c} \] where \(r_1\) canceled out of the numerator and \(r_0\) canceled out of the denominator in the middle expression. The estimated odds ratio comparing the prevalence exposure in cases (numerator) and controls (denominator) is \[ \frac{\odds(\hat{\pi}_1)}{\odds(\hat{\pi}_0)} = \frac{a / b}{c / d} = \frac{a d}{b c} \] where \(k_1\) canceled out of the numerator and \(k_0\) canceled out of the denominator in the middle expression. The Pearson chi-squared statistic can be rewritten in terms of the odds ratio: \[ \chisqP = \frac{n \big(\frac{a d}{b c} - 1\big)^2 b^2 c^2}{r_1 r_0 k_1 k_0} = \frac{n (\hat{\OR} - 1)^2 b^2 c^2}{r_1 r_0 k_1 k_0}. \] Let \[ \Delta_n = n (\hat{\OR} - 1), \] which does not depend on which study design we use.

A random sample from the population has \[ \chisqP = \Delta_n \hat{p}_0 (1 - \hat{p}_1) \hat{\pi}_0 (1 - \hat{\pi}_1). \] because \(b = r_1 (1 - \hat{p}_1) = k_0 \hat{\pi}_0\) and \(c = r_0 \hat{p}_0 = k_1 (1 - \hat{\pi}_1)\). Close to the null hypothesis, \(\hat{p}_1 \approx \hat{p}_0 \approx \hat{p}\) and \(\hat{\pi}_0 \approx \hat{\pi}_1 \approx \hat{\pi}\). In large samples close to the null hypothesis, \[ \chisqP \approx \Delta_n p (1 - p) \pi (1 - \pi). \] because \(\hat{p} \rightarrow p\) and \(\hat{\pi} \rightarrow \pi\) as \(n \rightarrow \infty\) by the LLN. A balanced cohort study has \(r_0 = r_1 = n / 2\) and \[ \chisqP = \frac{\Delta_n (1 - \hat{p}_1)^2 \hat{p}_0^2}{4 \hat{p} (1 - \hat{p})}. \] because \(b c = n^2 (1 - \hat{p}_1) \hat{p}_0 / 4\) and \(k_1 k_0 = n^2 \hat{p} (1 - \hat{p})\). In a large sample close to (but not under) the null hypothesis, \[ \chisqP \approx \frac{\Delta_n p^2 (1 - p)^2}{4 p (1 - p)} = \frac{\Delta_n}{4} p (1 - p). \] Following similar logic for a case-control study, we get \[ \chisqP \approx \frac{\Delta_n}{4} \pi (1 - \pi) \] in large samples near the null hypothesis. Because \(v (1 - v) \leq 1 / 4\) for \(v \in [0, 1]\), the \(\chisqP\) statistics from the cohort and case-control studies are both upper bounds for the \(\chisqP\) statistic from a random sample of the population.

Close to the null, a cohort study will be more powerful than a case-control study when \[ p (1 - p) > \pi (1 - \pi) \] and a case-control study will be more powerful than a cohort study when \[ p (1 - p) < \pi (1 - \pi). \] The advantage of a cohort study will be greatest for a rare exposure and a risk of disease close to \(1 / 2\), and the advantage of a case-control study will be greatest for rare disease and a prevalence of exposure close to \(1 / 2\). Both study designs are always more powerful than a random sample from the population.

7.5.2 Imbalance and efficiency on a fixed budget

Even when testing the null hypothesis is defensible, an imbalanced study design can be justified when one exposure or disease group is substantially more difficult or expensive to recruit than the other. In a cohort study with a rare exposure, exposed individuals might be harder to recruit than unexposed individuals. In a case-control study with a rare disease, cases might be harder to recruit than controls. Even when the greatest power for a given number of participants is achieved with a balanced study, the greatest power for a given study’s resources may occur with imbalanced groups.

Deliberately imbalanced designs are used most often in case-control studies, but the principle is the same in cohort studies. Let \(C\) be the ratio of the cost of recruiting a case to that of recruiting a control, and \(B\) be the budget of the study (expressed as the total number of controls that could be enrolled if no cases were enrolled). As in Table 7.2, \(k_1\) is the number of cases and \(k_0\) is the number of controls. We need to minimize the variance of \(\hat{\pi}_1 - \hat{\pi}_0\) from Equation 7.17 given that \[ k_1 C + k_0 = B. \] For simplicity, we will assume that the prevalences of exposure \(\pi_1\) (in cases) and \(\pi_0\) (in controls) are approximately equal, so we can ignore the fact that \(\hat{\pi}\) depends on \(\varphi = k_1 / n\).5 To maximize the value of \(\chisqP\) close to (but not under) the null, we need to minimize \[ \frac{1}{k_1} + \frac{1}{k_0} = \frac{1}{k_1} + \frac{1}{B - k_1 C} \] over \(k_1\) The derivative with respect to \(k_1\) is \[ \frac{\dif}{\dif k_1} \bigg(\frac{1}{k_1} + \frac{1}{B - k_1 C}\bigg) = -\frac{1}{k_1^2} + \frac{C}{(B - k_1 C)^2}, \] which equals zero when \[ k_0^2 = k_1^2 C. \] This corresponds to \(k_0 = k_1 \sqrt{C}\) or recruiting \(\sqrt{C}\) controls per case (Miettinen 1969; Nam 1973; Gail et al. 1976). The optimal proportion of the sample who are cases is \[ \varphi^*_C = \frac{1}{1 + \sqrt{C}}. \] A nearly identical argument based on Equation 7.9 shows that this \(\varphi^*_C\) is also the optimal proportion exposed in a cohort study where the cost of recruiting an exposed individual is \(C\) times that of recruiting an unexposed individual. This \(\sqrt{C}\) rule is a good approximation to more accurate and complicated optimal sampling rules (Meydrech and Kupper 1978; Pike and Casagrande 1979; Morgenstern and Winn 1983).

With a total sampling budget of \(B\), the optimal numbers of cases is \[ k_1^* = \frac{B}{\sqrt{C} + C} \] and the optimal number of controls is \[ k_0^* = k_1^* \sqrt{C} = \frac{B}{1 + \sqrt{C}}. \] The minimum variance of the risk difference that we can achieve near the null is proportional to \[ V^* = \frac{1}{k_1^*} + \frac{1}{k_0^*} = \frac{\left(1 + \sqrt{C}\right)^2}{B}. \] If we use a balanced study design, \(k_1 = k_0 = B / (1 + C)\) and the variance of the risk difference is proportional to \[ V^\text{bal} = \frac{2}{k_1} = \frac{2 (1 + C)}{B}. \] For any given budget \(B\), the asymptotic relative efficiency of the optimal study compared to a balanced study is \[ \frac{V^\text{bal}}{V^*} = \frac{2 (1 + C)}{\big(1 + \sqrt{C}\big)^2}. \] It is plotted as a function of \(C\) in Figure 7.3. The difference is small for moderate values of \(C\), with relative efficiencies of approximately \(1.029\) for \(C = 2\) and \(1.146\) for \(C = 5\). In extreme scenarios (i.e., as \(C \rightarrow 0\) or \(C \rightarrow \infty\)), the optimal study is twice as efficient as a balanced study with the same budget (Nam 1973).

Code
optimal-budget.R
## Relative efficiency of imbalanced study design on fixed budget

# variance ratio comparing balanced study to budget-optimal study
logC <- seq(-3, 3, by = 0.01)
releff <- function(C) 2 * (1 + C) / (1 + sqrt(C))^2
plot(logC, releff(exp(logC)), type = "l", ylim = c(0, 2), xaxt = "n",
     xlab = expression(paste("Cost ratio ", italic("C"), " (log scale)")),
     ylab = "Asymptotic relative efficiency of budget-optimal study")
axis(1, at = log(c(1 / c(20, 10, 5, 2), 1, c(2, 5, 10, 20))),
     labels = c("1/20", "1/10", "1/5", "1/2", 1, 2, 5, 10, 20))
grid()
abline(h = 1, col = "darkgray")
Figure 7.3: The asymptotic relative efficiency of an optimal case-control study compared to a balanced study with the same budget when recruiting a case costs \(C\) times as much as recruiting a control. There is a dark gray line at a relative efficiency of one. The same relative efficiency applies to cohort studies when recruiting an exposed individual costs \(C\) times as much as recruiting an unexposed individual.

The relative efficiency can thought of as the ratio of the sampling budgets of a balanced study and an optimal study that achieve the same power (Nam 1973; Gail et al. 1976). Thus, a balanced study requires at most twice the budget of an optimal study to achieve the same power. Brittain, Schlesselman, and Stadel (1981) found that sampling costs were approximately 33-66% of total costs in five case-control studies funded by the National Institute of Child Health and Human Development in the 1970s. Compared to a balanced study design, they found that optimal sampling of cases and controls would reduce total study costs by at most 8.5% for \(C \leq 5\) and at most 4.5% for \(C \leq 3\). As usual, balanced study designs are close to optimal.


  1. The distribution of the cell counts in Table 7.1 is exactly multinomial (and each cell count and row or column total is exactly binomial) if we sample with replacement.↩︎

  2. Named after Karl Pearson (1857–1936), an English statistician who appeared in the context of the Pearson correlation coefficient in Section 1.4.2. ↩︎

  3. These rules of thumb are for chi-squared tests with one degree of freedom and significance level \(\alpha = 0.05\). Smaller \(\alpha\) require larger average cell counts to estimate smaller p-values accurately, and chi-squared tests with more than one degree of freedom are more robust to small expected cell counts (Roscoe and Byars 1971).↩︎

  4. Inversion of the minimum likelihood Fisher’s or Blaker’s exact tests can produce confidence regions for the odds ratio that consist of two disjoint intervals, but inversion of the central Fisher’s exact test always produces a confidence region that consists of a single interval (Fay 2010).↩︎

  5. Without this assumption, it is difficult or impossible to derive an explicit expression for the optimal ratio \(\varphi^*\) because the total sample size \(n\) depends on \(\varphi\), which complicates the derivatives. An optimal ratio can be calculated numerically.↩︎