From a Case-Control Fit to a Population Risk
A logistic model fitted to a case-control sample can describe how the odds of disease vary with covariates while still giving incorrect absolute risks. The reason is that case-control sampling deliberately changes the proportion of cases in the data. A fitted probability therefore refers to the sampled data unless the sampling design is accounted for. Population risk prediction requires restoring the source-population intercept, or otherwise calibrating predicted risks to the source population.
This distinction matters in clinical use. A model may rank patients well, yet systematically overstate or understate their probabilities of disease. Correcting the sampling-induced shift can repair absolute-risk predictions without changing their ordering, provided sampling depends on the outcome alone and the same correction is applied to every person.
The earlier results on case-control logistic regression establish that outcome-dependent sampling shifts the intercept by \(\log r\) while preserving the slopes. If the sampled-data linear predictor is \(\eta_s(x)\), then the source-population linear predictor is \(\eta_s(x)-\log r\). The following calculation shows why this yields a risk correction.
Proof. By the definition of conditional probability, \(P(Y=y\mid x,S=1)=P(S=1\mid Y=y,x)P(Y=y\mid x)/P(S=1\mid x)\). Taking the ratio for \(y=1\) and \(y=0\) cancels the common denominator \(P(S=1\mid x)\), giving \[ \frac{P(Y=1\mid x,S=1)}{P(Y=0\mid x,S=1)} = \frac{s_1P(Y=1\mid x)}{s_0P(Y=0\mid x)}. \] Thus sampled odds equal source odds multiplied by \(r\). Taking logarithms and rearranging gives source log-odds \(\operatorname{logit}(p_s(x))-\log r\). Applying the expit function gives the stated risk. \(\square\)
Worked Example: Correcting a Sampled Risk With Known Fractions
Suppose the inclusion fractions are \(s_1=0.80\) among source-population cases and \(s_0=0.20\) among noncases. A fitted model gives sampled-data risk \(p_s=0.80\) for a patient. Calculate the source-population risk.
The sampling ratio is \(r=0.80/0.20=4\). The sampled odds are \(0.80/(1-0.80)=4\), so the source odds are \(4/4=1\). Converting odds of 1 to a probability gives \(1/(1+1)=0.50\).
Equivalently, \(\operatorname{logit}(0.80)=\log 4\), and \[ \operatorname{expit}\{\operatorname{logit}(0.80)-\log 4\} =\operatorname{expit}(0)=0.50. \] The sampled risk of 0.80 is not the population risk: cases were sampled four times as often as noncases.
Using an External Population Prevalence
Sometimes the outcome-specific sampling fractions are not available, but a reliable source-population prevalence is known. In that situation, the model’s slope estimates can be retained while its intercept is adjusted so that average predicted risk matches the external prevalence. This needs covariate values representative of the source population, or appropriate information to account for how the case-control sample differs from that population. The prevalence alone does not determine individual risks if the covariate distribution needed for the average is unavailable.
Proof. Define \(g(a)=E[\operatorname{expit}(a+Z)]\). The expit function is bounded between zero and one, so the expectation exists. If \(a_m\to a\), then \(\operatorname{expit}(a_m+Z)\to\operatorname{expit}(a+Z)\) almost surely and the terms are bounded by 1. The dominated convergence theorem therefore gives \(g(a_m)\to g(a)\), so \(g\) is continuous. If \(a_2>a_1\), then \(\operatorname{expit}(a_2+Z)>\operatorname{expit}(a_1+Z)\) almost surely because \(Z\) is finite and expit is strictly increasing. Hence \(g(a_2)>g(a_1)\).
As \(a\to-\infty\), \(\operatorname{expit}(a+Z)\to0\) almost surely; as \(a\to+\infty\), it tends to 1 almost surely. Dominated convergence, again using the bound 1, gives \(g(a)\to0\) and \(g(a)\to1\), respectively. Continuity and the intermediate value theorem imply that \(g(a)=\pi\) for some finite \(a\), since \(0<\pi<1\). Strict increase implies there is only one such value. \(\square\)
Worked Example: Calibrating to an External Prevalence
Suppose the source population has two equally common covariate groups, \(X=0\) and \(X=1\). The fitted slope is \(\beta=\log 3\), and an external study reports prevalence \(\pi=0.60\). Find the intercept \(a\) and the two calibrated risks.
The risks in the groups are \(\operatorname{expit}(a)\) and \(\operatorname{expit}(a+\log 3)\). Let \(q=e^a\), which is positive. Since \(e^{\log 3}=3\), the two risks are \(q/(1+q)\) and \(3q/(1+3q)\). Their equal-weight average must be 0.60: \[ \frac{1}{2}\left\{\frac{q}{1+q}+\frac{3q}{1+3q}\right\}=0.60. \]
Multiplying through by the positive denominator \(2(1+q)(1+3q)\) yields \(4q+6q^2=1.2(1+4q+3q^2)\), or \(2.4q^2-0.8q-1.2=0\). Dividing by 0.8 gives \(3q^2-q-1.5=0\). Its positive root is \(q=(1+\sqrt{19})/6\approx0.89315\), so \(a=\log q\approx-0.113\).
The group risks are approximately \(0.89315/(1+0.89315)=0.4718\) and \(3(0.89315)/(1+3(0.89315))=0.7282\). Their mean is approximately \((0.4718+0.7282)/2=0.6000\), as required. Calibration has changed the intercept while retaining the slope \(\log 3\).
For a finite collection of source-representative covariate values \(x_i\) with weights \(w_i\) summing to one, the expectation in the calibration equation becomes \(\sum_i w_i\operatorname{expit}(a+x_i^\mathsf{T}\beta)\). This equation is generally solved numerically. The weights must represent the source population: treating the case-control sample’s covariate mix as the population mix can produce a wrong intercept even when the external prevalence is correct.
Calibration and Discrimination Are Different
Calibration concerns the agreement between predicted probabilities and event frequencies in the target population. In ideal calibration, among individuals assigned risk \(p\), the event probability is \(p\). A practical assessment uses source-population validation data, for example by comparing observed and predicted frequencies across risk groups or by estimating a calibration curve. If the validation sample is itself outcome-dependent, its observed event frequencies cannot be read as population frequencies without accounting for that sampling design.
Discrimination concerns whether people who experience the event tend to receive higher scores than people who do not. One measure is the area under the receiver operating characteristic curve (AUC), defined for a score \(T\) as \(P(T_1>T_0)+\tfrac12P(T_1=T_0)\), where \(T_1\) and \(T_0\) are independent scores for a randomly selected case and noncase from the target population. AUC evaluates pairwise ordering, not whether a score is a correct probability.
Proof. For any case score \(T_1\) and noncase score \(T_0\), strict increase gives \(T_1>T_0\) if and only if \(h(T_1)>h(T_0)\), and \(T_1=T_0\) if and only if \(h(T_1)=h(T_0)\). Thus the probabilities of a win and a tie in the AUC definition are each unchanged by the transformation. Their stated combination is therefore unchanged. \(\square\)
Worked Example: Risk Correction Can Preserve AUC While Changing Calibration
Suppose two cases have sampled scores \(0.60\) and \(0.80\), and two controls have the same two scores. With sampling ratio \(r=4\), correct every score to a source risk.
For score \(0.60\), the sampled odds are \(0.60/0.40=1.5\). Dividing by 4 gives source odds \(0.375=3/8\), hence risk \((3/8)/(1+3/8)=3/11\approx0.2727\). For score \(0.80\), sampled odds are 4; dividing by 4 gives source odds 1 and risk \(0.50\). The corrected case scores and control scores are therefore both \(\{3/11,0.50\}\).
Of the four case-control pairs, the case with score \(3/11\) ties the control with score \(3/11\) and loses to the control with score \(0.50\). The case with score \(0.50\) beats the control with score \(3/11\) and ties the control with score \(0.50\). There is one winning pair, two ties, and one loss. Thus the AUC is \((1+0.5\times2)/4=0.50\), both before and after correction. The individual risk values changed substantially, but their common strictly increasing transformation preserved all pairwise orderings and ties.
Common Pitfall and Practical Checks
A frequent error is to treat good discrimination as evidence that predicted risks are accurate. AUC can remain exactly the same after a large intercept correction, as the example shows. A high AUC does not establish that a predicted risk of 0.30 corresponds to a 30% event rate in the source population. Conversely, an intercept correction that improves average risk calibration need not improve how well the model ranks people.
Another error is to subtract \(\log r\) when \(r\) was defined in the opposite direction. Under the convention here, \(r=s_1/s_0\): oversampling cases means \(r>1\), which raises sampled odds, so \(\log r\) must be subtracted to recover source odds. Always check the direction with a simple odds calculation. In the first worked example, sampled odds of 4 become source odds of 1, not 0.25.
Finally, a single intercept shift is justified only when inclusion probabilities depend on outcome but not on covariates. If selection varies with \(X\) within outcome groups, the sampled-to-source odds ratio need not be a constant multiplier across \(x\). In that setting, use a method that represents the selection process rather than applying one universal intercept correction.
Check Your Understanding
Use the definitions and results above to answer the following questions.
- If cases are sampled at fraction 0.30 and noncases at fraction 0.10, what is the sampling ratio, and in which direction must the sampled logit be shifted to recover the source logit?
- A sampled-data risk is 0.60 and \(r=3\). Calculate the source odds and source risk.
- Why does matching the average predicted risk to an external prevalence require information about the source-population covariate distribution?
- Explain why an intercept correction can change calibration while leaving AUC unchanged.
- What assumption about selection is needed for one constant intercept correction to work for all covariate values?