8  Internal and External Validity

Validity will be evaluated in terms of two major criteria. First, and as a basic minimum, is what can be called internal validity: did in fact the experimental stimulus make some significant difference in this specific instance? The second criterion is that of external validity, representativeness, or generalizability: to what populations, settings, and variables can this effect be generalized? Both criteria are obviously important although it turns out that they are to some extent incompatible, in that the controls required for internal validity often tend to jeopardize representativeness. (Campbell 1957)

In statistics, we make inferences about a population based on a sample. A study is said to have internal validity if it makes accurate measurements or inferences within the sample itself, and it is said to have external validity if these inferences accurately describe the population up to random sampling error (Campbell 1957). Both internal and external validity are best thought of as continuous, not binary. High internal validity is a prerequisite for high external validity, but there is often a tradeoff between them in practice. For simplicity, we focus on internal and external validity for descriptive epidemiology (i.e., for association and not necessarily causation).

So far, our discussion of 2x2 tables has assumed that the classification of exposure and disease is completely accurate and that the participants are a random sample from the population. Table 8.1 shows our 2x2 table based on true exposure and disease classifications. In reality, misclassification and selection bias threaten the validity of almost all epidemiologic studies. It is critical to understand where they come from and what they do.

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

8.1 Misclassification

Misclassification of exposure and disease threatens both the internal and external validity of an epidemiologic study. In a cohort study, we compare the exposed and unexposed groups and we have to classify disease outcomes in each group. In a case-control study, we compare cases and controls and we have to classify exposure in each group.

Nondifferential misclassification occurs when the same classification errors affect both populations being compared. Under nondifferental misclassification, a test of the null hypothesis is still has the correct significance level but the power of the test is reduced—much like a reduction in the effective sample size (Bross 1954; Rubin, Rosenbaum, and Cobb 1956). Nondifferential classification almost always causes bias toward the null, making the expected value of a given measure of association closer to the null than its true value. However, a measure of association under nondifferential misclassification can be farther away from the null than its true value due to random variation (Gullen, Bearman, and Johnson 1968; Sorahan and Gilthorpe 1994; Wacholder et al. 1995; Yland et al. 2022).

Differential misclassification occurs when classification errors differ between the two populations being compared. Differental misclassification can distort both the significance level and power of a hypothesis test, and it can cause bias toward the null, away from the null, or across the null. The unpredictability of the size and direction of the bias makes differential misclassification fundamentally more dangerous than nondifferential misclassification.

8.1.1 Nondifferential misclassification of disease

In our discussion of diagnostic tests, we let \(\Dplus\) indicate \(D = 1\), \(\Dminus\) indicate \(D = 0\), \(\Tplus\) indicate testing positive for disease, and \(\Tminus\) indicate testing negative. Let \(D^\obs\) be the measured disease outcome of individuals in a cohort study where disease is detected using a diagnostic test with sensitivity \[ \sens_D = \Pr(\Tplus \given{} \Dplus) = \Pr\bigl(D^\obs = 1 \,\big|\, D = 1\bigr) \] and specificity \[ \spec_D = \Pr(\Tminus \given{} \Dminus) = \Pr\bigl(D^\obs = 0 \,\big|\, D = 0\bigr). \] We assume that \[ \sens_D = \Pr(\Tplus \given{} \Dplus) > \Pr(\Tplus \,\big|\, \Dminus) = 1 - \spec_D, \] so individuals with disease are more likely to test positive than individuals without disease.1 This is equivalent to assuming that \(\sens_D + \spec_D > 1\). We also assume that the misclassification of each participant is independent of the misclassification of all other participants. Table 8.2 shows a 2x2 table with misclassification of disease. The row sums \(r_1\) and \(r_0\) are the same as in Table 8.1 because there is no misclassification of exposure.

Table 8.2: 2x2 table with misclassified disease status
\(D^\obs = 1\) \(D^\obs = 0\) Total
\(X = 1\) \(a^\obs\) \(b^\obs\) \(r_1\)
\(X = 0\) \(c^\obs\) \(d^\obs\) \(r_0\)
Total \(k_1^\obs\) \(k_0^\obs\) \(n\)

Misclassification of disease is nondifferential when the sensitivity and specificity of the test are the same in all exposure groups. In other words, we have nondifferential misclassification of disease if and only if \[ \Pr\bigl(\Tplus \,\big|\, \Dplus, X = x\bigr) = \Pr(\Tplus \given{} \Dplus) = \sens_D \] and \[ \Pr\bigl(\Tminus \,\big|\, \Dminus, X = x\bigr) = \Pr(\Tminus \given{} \Dminus) = \spec_D \] for all possible values \(x\) of exposure \(X\). It is critical that nondifferential misclassification is defined in terms of the sensitivity and specificity of the test, not its positive predictive value (PPV) or negative predictive value (NPV). When there is an association between exposure and disease, nondifferential misclassification of disease may produce different PPVs and NPVs in the exposed and unexposed because these predictive values depend on the prevalence of disease in addition to the sensitivity and specificity of the test (D. J. Newell 1962; Buell and Dunn Jr 1964).

Under nondifferential misclassification, the probability that an exposed person tests positive for disease is \[ \begin{aligned} p_1^\obs &= p_1 \sens_D + (1 - p_1) (1 - \spec_D) \\ &= (1 - \spec_D) + (\sens_D + \spec_D - 1) p_1 \end{aligned} \] where \(p_1\) is the true risk of disease in the exposed. Similarly, the probability that an unexposed person tests positive for disease is \[ p_0^\obs = (1 - \spec_D) + (\sens_D + \spec_D - 1) p_0 \] where \(p_0\) is the true risk of disease in the unexposed. The misclassified risk difference is \[ \RD^\obs = p_1^\obs - p_0^\obs = (\sens_D + \spec_D - 1) (p_1 - p_0). \tag{8.1}\] Given the margins of Table 8.2, the number \(\A^\obs\) of exposed individuals who test positive for disease has a hypergeometric distribution with mean \(r_1 p_1^\obs\) and the number \(\C^\obs\) of unexposed people who test positive for disease has a hypergeometric distribution with mean \(r_0 p_0^\obs\). The estimated risk difference based on the misclassified data is \[ \hat{\RD}^\obs = \hat{p}_1^\obs - \hat{p}_0^\obs, \] where \(\hat{p}_1^\obs = a^\obs / r_1\) and \(\hat{p}_0^\obs = c^\obs / r_0\). It is an unbiased estimate of \(\RD^\obs\).

When \(\sens_D < 1\) or \(\spec_D < 1\), the misclassified risk difference \(\RD^\obs\) in Equation 8.1 is closer to zero than the true risk difference (Bross 1954; Rubin, Rosenbaum, and Cobb 1956; D. Newell 1963). The risk ratio and odds ratio are also biased toward the null under nondifferential misclassification (Goldberg 1975; Copeland et al. 1977). This bias operates on average, not for every single estimate based on misclassified data. Even under nondifferential misclassification of disease, random variation can produce an estimate of the risk difference, risk ratio, or odds ratio that is farther from the null than the true value (Gullen, Bearman, and Johnson 1968; Sorahan and Gilthorpe 1994; Wacholder et al. 1995; Yland et al. 2022).

When \(\sens_D + \spec_D > 1\) (as is true of any useful diagnostic or screening test), Equation 8.1 implies that the null hypothesis that \(p_1^\obs = p_0^\obs\) is equivalent to the null hypothesis that \(p_1 = p_0\). Both null hypotheses are equivalent to the null hypothesis that exposure and disease are independent (see Section 7.2.1). Therefore, a test of the null hypothesis that \(X\) and \(D^\obs\) are independent is also a valid test of the independence of \(X\) and \(D\) (Bross 1954; Rubin, Rosenbaum, and Cobb 1956). The Pearson chi-squared statistic for Table 8.2 is \[ \chisqPobs = \frac{n \bigl(a^\obs d^\obs - b^\obs c^\obs\bigr)^2}{r_1 r_0 k_1^\obs k_0^\obs}, \tag{8.2}\] and it has a \(\chi^2_1\) distribution under the null hypothesis that \(p_1 = p_0\). If we set the critical value at the \(1 - \alpha\) quantile of the \(\chi^2_1\) distribution, the test will reject the null with probability \(\alpha\) when \(p_1 = p_0\) even under nondifferential misclassification of disease. A similar result holds for the hypergeometric chi-squared test, Fisher’s exact test, and other tests of independence for 2x2 tables from Section 7.2.

Although nondifferential misclassification does not affect the significance level of a hypothesis test of the null hypothesis that \(p_1 = p_0\), it reduces the power of the test away from the null (Bross 1954; Rubin, Rosenbaum, and Cobb 1956; Rogot 1961). The Pearson chi-squared statistic based on the misclassified data in Table 8.2 can be rewritten \[ \chisqPobs = \frac{(\hat{p}_1^\obs - \hat{p}_0^\obs)^2} {\hat{p}^\obs (1 - \hat{p}^\obs) \Bigl(\frac{1}{r_1} + \frac{1}{r_0}\Bigr)}. \] where \(\hat{p}^\obs = k_1^\obs / n\) is the misclassified estimate of the marginal risk of disease among the study participants. Let \(\varphi \in (0, 1)\) be the proportion of the sample that is exposed, which we assume to be (approximately) constant as \(n \rightarrow \infty\). Let \[ K_D = \sens_D + \spec_D - 1, \] so \(K_D \in (0, 1)\) whenever we have a useful but imperfect test for disease. When both \(r_1 = \varphi n\) and \(r_0 = (1 - \varphi) n\) are large, the numerator on the right-hand side of Equation 8.2 is approximately \[ \E(\hat{p}_1^\obs - \hat{p}_0^\obs)^2 = K_D^2 (p_1 - p_0)^2 \] by the law of large numbers (LLN) and the continuous mapping theorem.2 Similarly, \(\hat{p}^\obs\) is approximately \[ \begin{aligned} p^\obs &= p\, \sens_D + (1 - p) (1 - \spec_D) \\ &= (1 - \spec_D) + K_D p, \end{aligned} \] where \[ p = \varphi p_1 + (1 - \varphi) p_0 \] is the marginal risk of disease among the study participants. Thus, \[ \hat{p}^\obs (1 - \hat{p}^\obs) \approx \big(1 - \spec_D + K_D p\big) \big(1 - \sens_D + K_D (1 - p)\big). \] in large samples. It follows that \[ \chisqPobs \approx \frac{K_D^2 p (1 - p)}{\big(1 - \spec_D + K_D p\big) \big(1 - \sens_D + K_D (1 - p)\big)} \chisqP \] where \(\chisqP\) is the Pearson chi-squared statistic based on the correctly classified data in Table 8.1. Therefore, nondifferential misclassification of disease has approximately the same effect as multiplying the sample size \(n\) by the effective sample size ratio \[ \ESSR_D = \frac{K_D^2 p (1 - p)}{\big(1 - \spec_D + K_D p\big) \big(1 - \sens_D + K_D (1 - p)\big)} \leq 1 \] with equality if and only if \(\sens_D = \spec_D = 1\). Thinking about nondifferential misclassification as a reduction in the effective sample size is a good way to remember both that it preserves the correct significance level under the null and that it reduces power away from the null (Bross 1954; Rubin, Rosenbaum, and Cobb 1956).

When the prevalence or risk of disease is low, the effective sample size depends much more on the specificity of the test than on the sensitivity of the test (Rubin, Rosenbaum, and Cobb 1956). Figure 8.1 shows the effective sample size ratio \(\ESSR_D\) for three values of the marginal risk of disease in the sample (\(p\)) under two different scenarios: one where \(\spec_D = 1\) while sensitivity varies from zero to one and one where \(\sens_D = 1\) while specificity varies from zero to one. For all three values of \(p\), \(\ESSR_D\) is substantially lower in the scenario with varying specificity. This difference is greatest for \(p = 0.02\) and smallest for \(p = 0.40\). If \(p = 0.5\), the two scenarios produce identical curves. If \(p > 0.5\), then \(\ESSR_D\) depends more on the sensitivity than the specificity of the test for disease.

Code
ESSratio.R
## Effective sample size under nondifferential misclassification

# function that returns the effective sample size ratio
ess_ratio <- function(sens, spec, p) {
  # returns the multiplier of the sample size to get the effective sample size
  # under nondifferential misclassification with marginal risk (or prevalence) 
  # p in the sample
  K <- sens + spec - 1
  Kden <- (1 - spec + K * p) * (1 - sens + K * (1 - p))
  return(K^2 * p * (1 - p) / Kden)
}

# data frame for ESSR with specificity = 1 and varying sensitivity
s <- seq(0.01, 1, by = 0.005)
p <- c(0.02, 0.05, 0.1, 0.2, 0.4)
pnames <- c("p02", "p05", "p10", "p20", "p40")
essr_sens <- outer(s, p, function(s, p) ess_ratio(sens = s, spec = 1, p = p))
colnames(essr_sens) <- pnames
essr_sens <- as.data.frame(essr_sens)

# data frame for ESSR with sensitivity = 1 and varying specificity
essr_spec <- outer(s, p, function(s, p) ess_ratio(sens = 1, spec = s, p = p))
colnames(essr_spec) <- pnames
essr_spec <- as.data.frame(essr_spec)

# plot
plot(s, essr_spec$p02, type = "l", asp = 1, xlim = c(0, 1), ylim = c(0, 1),
     xlab = "Sensitivity (gray) or specificity (black)",
     ylab = "Effective sample size ratio")
lines(s, essr_spec$p10, lty = "dashed")
lines(s, essr_spec$p40, lty = "dotdash")
lines(s, essr_sens$p02, col = "darkgray")
lines(s, essr_sens$p10, col = "darkgray", lty = "dashed")
lines(s, essr_sens$p40, col = "darkgray", lty = "dotdash")
grid()
legend("topleft", bg = "white",
       lty = c("solid", "dashed", "dotdash"),
       legend = c("p = 0.02", "p = 0.10", "p = 0.40"))
text(0.48, 0.52, srt = 45, col = "darkgray",
     "Specificity = 1 with varying sensitivity")
text(0.68, 0.32, srt = 45, "Sensitivity = 1 with varying specificity")
Figure 8.1: The effective sample size ratio \(\ESSR_D\) as a function of \(\sens_D\) when \(\spec_D = 1\) (gray lines) and as a function of \(\spec_D\) when \(\sens_D = 1\) (black lines).

8.1.2 Nondifferential misclassification of exposure

Nondifferential misclassification of exposure has effects similar to those of nondifferential misclassification of disease. Although we usually discuss sensitivity and specificity in the context of a test for disease, the same ideas can be applied to a test or measurement used to determine exposure status. For simplicity, we will focus on a binary exposure \(X\) with \(\Xplus\) indicating \(X = 1\) and \(\Xminus\) indicating \(X = 0\).

Let \(\Xobs\) be the measured disease outcome of individuals in a case-control study when we classify exposure using a test \(T_X\) that has sensitivity \[ \sens_X = \Pr\bigl(\Tplus_X \,\big|\,\Xplus\bigr) = \Pr\bigl(\Xobs = 1 \,\big|\, X = 1\bigr) \] and specificity \[ \spec_X = \Pr\bigl(\Tminus_X \,\big|\, \Xminus\bigr) = \Pr\bigl(\Xobs = 0 \,\big|\, X = 0\bigr). \] We assume that \(\sens_X > 1 - \spec_X\), so exposed individuals are more likely to test positive for exposure than unexposed individuals. This is equivalent to assuming \(\sens_X + \spec_X > 1\).3 We also assume that the misclassification of each participant is independent of the misclassification of all other participants. Table 8.3 shows a 2x2 table with exposure misclassification. The column sums \(k_1\) and \(k_0\) are the same in both tables because there is no misclassification of disease status.

Table 8.3: 2x2 table with misclassified exposure
\(D = 1\) \(D = 0\) Total
\(X^\obs = 1\) \(a^\obs\) \(b^\obs\) \(r_1^\obs\)
\(X^\obs = 0\) \(c^\obs\) \(d^\obs\) \(r_0^\obs\)
Total \(k_1\) \(k_0\) \(n\)

The misclassification of exposure is nondifferential when the sensitivity and specificity of the exposure test are the same in cases and controls. In other words, we need \[ \Pr\bigl(\Tplus_X \,\big|\, \Xplus, D = d\bigr) = \Pr\bigl(\Tplus_X \,\big|\, \Xplus\bigr) \] and \[ \Pr\bigl(\Tminus_X \,\big|\, \Xminus, D = d\bigr) = \Pr\bigl(\Tminus_X \,\big|\, \Xminus\bigr) \] for all possible values \(d\) of disease status \(D\). As with disease, it is critical that nondifferential misclassification of exposure is defined through the sensitivity and specificity of the test for exposure. When there is an association between exposure and disease, nondifferential misclassification can produce a PPV and NPV that differ between cases and controls because these predictive values depend on the prevalence of exposure in addition to the sensitivity and specificity of the test (D. J. Newell 1962; Buell and Dunn Jr 1964).

Under nondifferential misclassification, the probability that a case tests positive for exposure is \[ \pi_1^\obs = (1 - \spec_X) + (\sens_X + \spec_X - 1) \pi_1 \] where \(\pi_1\) is the true prevalence of exposure among cases. Similarly, the probability that a control tests positive for exposure is \[ \pi_0^\obs = (1 - \spec_X) + (\sens_X + \spec_X - 1) p_0 \] where \(\pi_0\) is the true prevalence of exposure in controls. The misclassified difference in exposure prevalences is \[ \pi_1^\obs - \pi_0^\obs = (\sens_X + \spec_X - 1) (\pi_1 - \pi_0). \] When \(\sens_X + \spec_X > 1\) (as is true of any useful test for exposure), the null hypothesis that \(\pi_1^\obs = \pi_0^\obs\) is equivalent to the null hypothesis that \(\pi_1 = \pi_0\), which is equivalent to the null hypothesis that exposure and disease are independent (see Section 7.2.1). Therefore, any test of the independence of \(X^\obs\) and \(D\) has the correct significance level under the null hypothesis that \(X\) and \(D\) are independent (Bross 1954).4

Like nondifferential misclassification of disease, nondifferential misclassification of exposure reduces the power of the hypothesis test that exposure and disease are independent (Bross 1954; Rubin, Rosenbaum, and Cobb 1956; Rogot 1961). The maximum likelihood estimates \(\hat{\pi}_1^\obs = a^\obs / k_1\) and \(\hat{\pi}_0^\obs = b^\obs / k_0\) are unbiased. The Pearson chi-squared statistic based on the misclassified data in Table~[tab:2by2obsX] can be rewritten \[ \chisqPobs = \frac{(\hat{\pi}_1^\obs - \hat{\pi}_0^\obs)^2} {\hat{\pi}^\obs (1 - \hat{\pi}^\obs) \Bigl(\frac{1}{k_1} + \frac{1}{k_0}\Bigr)}. \tag{8.3}\] where \(\hat{\pi}^\obs = k_1^\obs / n\) is the misclassified estimate of the marginal prevalence of exposure among the study participants. Let \(\varphi_X\) be the proportion of the sample that consists of cases, and let \(K_X = \sens_X + \spec_X - 1\), so \(K_X \in (0, 1)\) whenever we have a useful but imperfect test for exposure. When both \(k_1 = \varphi_X n\) and \(k_0 = (1 - \varphi_X) n\) are large, the numerator on the right-hand side of Equation 8.3 is approximately \[ \E(\hat{\pi}_1^\obs - \hat{\pi}_0^\obs)^2 = K_X^2 (\pi_1 - \pi_0)^2, \] and \[ \hat{\pi}^\obs \approx \E(\hat{\pi}^\obs) = (1 - \spec_X) + K_X \pi \] where \[ \pi = \varphi_X \pi_1 + (1 - \varphi_X) \pi_0 \] is the marginal prevalence of exposure among the study participants, In large samples, \[ \hat{\pi}^\obs (1 - \hat{\pi}^\obs) \approx \big(1 - \spec_X + K_X \pi\big) \big(1 - \sens_X + K_X (1 - \pi)\big). \] For hypothesis testing, nondifferential misclassification of exposure has approximately the same effect as multiplying the sample size \(n\) by the effective sample size ratio \[ \ESSR_X = \frac{K_X^2 \pi (1 - \pi)}{\big(1 - \spec_X + K_X \pi\big) \big(1 - \sens_X + K_X (1 - \pi)\big)} \leq 1 \] with equality if and only if \(\sens_X = \spec_X = 1\). Just like nondifferential misclassification of disease, nondifferential misclassification of exposure acts like reduction in the effective sample size. It preserves the significance level under the null, but it reduces the power of the test away from the null. A similar reduction in power occurs when more complex exposures (such as dietary intakes) are measured with error, requiring larger sample sizes to achieve a given power (Freedman, Schatzkin, and Wax 1990).

The curves in Figure 8.1 are the same if we replace the marginal risk of disease \(p\) with the marginal prevalence of exposure \(\pi\). The effective sample size ratio \(\ESSR_X\) depends on the specificity more than the sensitivity when \(\pi < 0.5\), and it depends on the sensitivity more than the specificity when \(\pi > 0.5\). While diseases typically (and fortunately) have low risks, exposures can have both low and high prevalences.

When there are more than two levels of exposure, nondifferential misclassification does not always bias a measure of association toward the null for all exposure categories (Walker, Velema, and Robins 1988; Dosemeci, Wacholder, and Lubin 1990; Verkerk and Buitendijk 1992; Correa-Villaseñor et al. 1995). Misclassification causes the risks of disease in different exposure categories to get closer to each other on average. Without loss of generality, suppose that higher exposure is associated with a higher risk of disease. Misclassification of high-exposure individuals to lower-exposure categories can increase the apparent risk of disease in these categories, and misclassification of low-exposure individuals into higher-exposure categories can decrease the apparent risk of disease in these categories. The risk in the highest-exposure category can only go down on average due to misclassification, and the risk in the lowest-exposure category can only go up on average. In both cases, this results in bias toward the null—and these are the only possible cases for a binary exposure. The risk in an intermediate-exposure category can go up or down on average, so some measures of association can be biased away from the null. Despite this exception, bias toward the null remains the most likely outcome of nondifferential misclassification of exposure (Dosemeci, Wacholder, and Lubin 1990; Correa-Villaseñor et al. 1995). However, random variation can produce point estimates closer to, farther from, or across the null compared to the true value of a measure of association.

8.1.3 Simultaneous nondifferential misclassification

Although we discussed nondifferential misclassification of disease in the context of a cohort study and nondifferential misclassification of exposure in the context of a case-control study, simultaneously misclassification of \(X\) and \(D\) can occur in any epidemiologic study. Table 8.4 shows a 2x2 table with \(X\) and \(D\) both misclassified. The row totals are affected by misclassification of \(X\), and the column totals are affected by misclassification of \(D\). Only the total sample size \(n\) is unaffected.

Table 8.4: 2x2 table for a study with misclassified exposure and disease
\(D^\obs = 1\) \(D^\obs = 0\) Total
\(X^\obs = 1\) \(a^\obs\) \(b^\obs\) \(r_1^\obs\)
\(X^\obs = 0\) \(c^\obs\) \(d^\obs\) \(r_0^\obs\)
Total \(k_1^\obs\) \(k_0^\obs\) \(n\)

The effects of nondifferential misclassification of both \(X\) and \(D\) can be derived by imagining that we misclassify one first and then the other. Here, we will consider misclassifying \(X\) and then \(D\). When we misclassify \(X\), we have the equivalent null hypotheses \[ X \indep D \iff X^\obs \indep D. \] where the symbol \(\indep\) indicates independence (Dawid 1979). When we misclassify \(D\) in addition to \(X\), we have the equivalent null hypotheses \[ X^\obs \indep D \iff X^\obs \indep D^\obs. \] Therefore, \[ X \indep D \iff X^\obs \indep D^\obs \] so a test of the null hypothesis that \(X\) and \(D\) are independent based on the misclassified data in Table 8.4 has the correct significance level (as long as \(\sens_X + \spec_X > 1\) and \(\sens_D + \spec_D > 1\)). However, the power of the test is reduced when we misclassify \(X\) and reduced again when we misclassify \(D\). Simultaneous misclassification of \(X\) and \(D\) has approximately the same effect as multiplying the sample size by \[ \ESSR_X \ESSR_D \leq 1 \] with equality if and only if \(\sens_X = \spec_X = 1\) and \(\sens_D = \spec_D = 1\).

8.2 Selection bias

Participants in an epidemiologic study can be selected according to exposure (in a cohort study) or according to disease (in a case-control study), but they cannot be selected according to both. In a cohort study, selection must be conditionally independent of disease given exposure so that risks of disease are estimated accurately in all exposure groups. In a case-control study, selection must be conditionally independent of exposure given disease, so the prevalence of exposure is measured accurately among both cases and controls.. Selection according to exposure and disease simultaneously leads to selection bias, which is a threat to the external validity of a study.5 A study with uncontrolled selection bias is neither generalizable nor transportable.

8.2.1 Selection bias in cohort studies

In a cohort study, selection bias leads to biased estimates of the risks of disease in exposure groups. Let \(S\) indicate selection into the study, so \(S_i = 1\) if individual \(i\) is selected into the study and \(S_i = 0\) otherwise. When only \(X\) and \(D\) are measured, there is no selection bias in a cohort study if and only if the conditional probability of disease given exposure in sampled individuals equals that in the population: \[ \Pr(D = 1 \given{} X = x, S = 1) = \Pr(D = 1 \given{} X = x) \tag{8.4}\] for both \(x = 1\) and \(x = 0\). By the definition of conditional probability, \[ \Pr(D = 1 \given{} X = x, S = 1) = \frac{\Pr(D = 1, S = 1 \given{} X = x)}{\Pr(S = 1 \given{} X = x)}. \] Multiplying both sides of Equation 8.4 by \(\Pr(S = 1 \given{} X = x)\) show that there is no selection bias in a cohort study if and only if \[ \Pr(D = 1, S = 1 \given{} X = x) = \Pr(D = 1 \given{} X = x) \Pr(S = 1 \given{} X = x), \tag{8.5}\] which means that \(D\) and \(S\) are conditionally independent given \(X\). This condition can be relaxed somewhat if additional covariates are measured. In that case, we only need \(D\) and \(S\) to be conditionally independent given the measured covariates.

8.2.2 Selection bias in case-control studies

In a case-control study, selection bias leads to biased estimates of exposure prevalences in cases and controls. When only \(X\) and \(D\) are measured, there is no selection bias in a case-control study if and only if the conditional probability of exposure given disease in sampled individuals equals that in the underlying population: \[ \Pr(X = 1 \given{} D = d) = \Pr(X = 1 \given{} D = d, S = 1) \tag{8.6}\] for \(d = 1\) and \(d = 0\). By the same argument used for the cohort study, there is no selection bias in a case-control study if and only if \[ \Pr(X = 1, S = 1 \given{} D = d) = \Pr(X = 1 \given{} D = d) \Pr(S = 1 \given{} D = d), \] which means that \(X\) and \(S\) are conditionally independent given \(D\). As with selection bias in a cohort study, this condition can be relaxed if additional covariates are measured.

8.2.3 Prospective and retrospective studies

A prospective study is one in which exposure information is collected and recorded prior to disease onset. A retrospective study is one in which exposure information is collected after the onset of disease. Traditionally, cohort studies were called “prospective studies” and case-control studies were called “retrospective studies”. While this classification is often accurate, it is possible for either design to be prospective or retrospective (Rothman, Greenland, and Lash 2008).

Because selection into a retrospective study occurs after disease onset and relevant exposures occur prior to disease onset, retrospective studies are more susceptible to selection bias than prospective studies. Because knowledge of disease occurrence can affect recall or measurement of exposure, retrospective studies are also more susceptible to differential misclassification.

8.2.4 Generalizability and transportability

To discuss sources of bias in epidemiologic studies, we will use terminology adapted from Dahabreh and Hernán (2019) and illustrated in Figure 8.2. These terms are meant to be consistent with the Consolidated Standards of Reporting Trials (CONSORT) statement (Moher et al. 2001; Altman et al. 2001) as well as the Strengthening the Reporting of Observational Studies in Epidemiology (STROBE) statement (Elm et al. 2007; Vandenbroucke et al. 2007). The eligible population is the population of individuals who meet the eligibility criteria for a study—whether or not they are invited to participate or willing to participate. Individuals within the eligible population who are invited to participate are the invited population, and those within the invited population who enroll in the study are the study sample.6 Members of the study sample are called participants. Inferences based on data from the study sample are applied to a target population that could be the eligible population or a population that includes individuals outside the eligible population.

A study that makes valid inferences for the eligible population has generalizability, and a study that makes valid inferences for a larger or different target population has transportability to that population. Generalizability and transportability live along a spectrum of external validity. Generalizability is typically a prerequisite for transportability, and a generalizable study can be transportable to some target populations but not to others. Qualitative insights (e.g., smoking causes lung cancer) might be generalizable or transportable even when the estimated risks of disease or prevalences of exposure are not. The best way to ensure that the results of a study are widely applicable is to make the eligible population as inclusive as possible within ethical and logistical constraints (Bibbins-Domingo and Helman 2022).

8.2.5 Example: Berkson’s bias

Berkson (1946) discussed a hypothetical case-control study to test whether cholecystitis (i.e., gallbladder inflammation) is associated with diabetes. The cases are patients who come to the clinic for diabetes treatment. The controls are nondiabetic patients who come to the clinic to get eyeglasses to correct refractive errors, a diagnosis considered to be independent of cholecystitis based on existing knowledge of human biology. The overall population has 10,000,000 individuals. The prevalence of diabetes is 1%, the prevalence of refractive errors is 10%, and the prevalence of cholecystitis is 3%. All three conditions are assumed to occur independently.

Table 8.5 shows the distribution of cholecystitis among individuals with diabetes and individuals with refractive errors. Eligible cases are individuals with diabetes, and eligible controls are individuals with refractive errors but no diabetes. The prevalence of cholecystitis is \(3\%\) in both groups, so \(\pi_1 = \pi_0 = 0.03\). It follows that the Pearson chi-squared statistic \(\chisqP = 0\) in the 2x2 table for the eligible population.

Table 8.5: Cholecystitis among eligible cases and controls in Berkson (1946)
Eligible cases Eligible controls Total
Cholecystitis 3,000 29,700 32,700
No cholecystitis 97,000 960,300 1,057,300
Total 100,000 990,000 1,090,000

The study sample consists of patients who visit the clinic for diabetes or refractive errors. Each diagnosis comes with a probability of visiting the clinic in the relevant time period. In one version of the example, diabetes patients visit the clinic with probability \(0.05\), refractive error patients visit with probability \(0.20\), and cholecystitis patients visit with probability \(0.15\). For patients with multiple conditions, “we shall say that these selective probabilities operate independently, as though a person who had two diseases were like [conjoined] twins, each one of whom had one disease, so that the probability of the twins’ coming to the hospital is the probability of either one getting there, but the presence of one disease does not affect the other in any way” (Berkson 1946). For example, a patient with both diabetes and refractive error visits the clinic with probability \(1 - (1 - 0.05) (1 - 0.20) = 0.24\). Table 8.6 shows the numbers of individuals in the population and among clinic visitors at each combination of cholecystitis, diabetes, and refractive errors.

Table 8.6: Combinations of cholecystitis (C), diabetes (D), and refractive errors (R) in Berkson (1946).
Condition Population Selection probability Clinic visitors
None 8,642,700 0 0
C only 267,300 0.15 40,095
D only 87,300 0.05 4,365
R only 960,300 0.20 192,060
C and D 2,700 0.1925 520
C and R 29,700 0.32 9,504
D and R 9,700 0.24 2,328
C, D, and R 300 0.354 106
Total 10,000,000 0.0249 248,978

Table 8.7 shows the 2x2 table for the study sample. The cases with cholecystitis include the 520 individuals with diabetes and cholecystitis only and the 106 individuals with all three conditions. The cases without cholecystitis include the 4,365 individuals with diabetes only and the 2,328 individuals with diabetes and refractive errors only. In this table, we have \[ \chisqP = \frac{208{,}883 (626 \times 192{,}060 - 6{,}693 \times 192{,}060)^2} {10{,}130 \times 198{,}753 \times 7{,}319 \times 201{,}564} \approx 225.447. \] The p-value is \(5.9 \times 10^{-51}\).

Table 8.7: Cholecystitis among cases and controls in Berkson (1946)
Cases Controls Total
Cholecystitis 520 + 106 = 626 9,504 10,130
No cholecystitis 4,365 + 2,328 = 6,693 192,060 198,753
Total 7,319 201,564 208,883

If we ignored selection bias, we would conclude that there is almost certainly an association between cholecystitis and diabetes in the eligible population. The example is constructed with no such association. Because the study sample included only clinic visitors and individuals with multiple conditions (including cholecystitis) were more likely to visit the clinic, selection and exposure (cholecystitis) are not conditionally independent given disease in this example.

Berkson.R
## Berkson (1946) example of selection bias

# Pearson chi-squared test for the eligible population (X and D independent)
poptab <- matrix(c(3000, 97000, 29700, 960300), nrow = 2)
chisq.test(poptab, correct = FALSE)
# Fisher's exact test (with confidence limits for odds ratio)
fisher.test(poptab)

# Pearson chi-squared test for the study sample (X and D not independent)
sampletab <- matrix(c(626, 6693, 9504, 192060), nrow = 2)
chisq.test(sampletab, correct = FALSE)
# Fisher's exact test (with confidence limits for odds ratio)
fisher.test(sampletab)

  1. These tests are in the top left half of a receiver operating characteristic (ROC) plot from Section 2.3.2, which has \(1 - \spec_D\) is the horizontal axis and \(\sens_D\) is the vertical axis. A test with \(\sens_D = 1 - \spec_D\) (on the diagonal of the ROC plot) is a useless test. A test with \(\sens_D < 1 - \spec_D\) (in the bottom right half of an ROC plot) is worse than useless, but it can be redeemed by swapping the definitions of \(\Tplus\) and \(\Tminus\).↩︎

  2. The continuous mapping theorem says that if a statistic \(\hat{\theta}_n \rightarrow \theta\) in probability and \(f\) is a continuous function in a neighborhood of \(\theta\), then \(f(\hat{\theta}_n) \rightarrow f(\theta)\) in probability. Convergence in probability can be replaced with convergence in distribution or convergence almost surely (Chung 2000). Here, the statistic is \(\hat{p}_1 - \hat{p}_0\), which converges to \(p_1 - p_0\), and the function is \(f(v) = v^2\).↩︎

  3. As with a test for disease, a test for exposure with \(\sens_X + \spec_X = 1\) would be a useless test (on the diagonal of an ROC curve) and a test with \(\sens_X + \spec_X < 1\) would need to have the definitions of \(\Tplus_X\) and \(\Tminus_X\) reversed.↩︎

  4. Case control studies typically use the odds ratio \(\odds(\pi_1) / \odds(\pi_0)\), not the difference \(\pi_1 - \pi_0\), to compare the exposure prevalences in cases and controls. The difference between the prevalences is being used here only to establish that a hypothesis test of the independence of \(X\) and \(D\) based on misclassified data has the correct significance level.↩︎

  5. In causal inference, selection bias can threaten both the internal and external validity of a study. It can cause an apparent association between \(X\) and \(D\) within the study sample that does not represent a causal effect (Hernán, Hernández-Dı́az, and Robins 2004).↩︎

  6. We avoid use of the term “study population” because it sometimes refers to the study sample and sometimes to the eligible population.↩︎