Tutorials › Generalized Linear Models › Risk Calibration When Sampling Fractions Are Unknown

Case-Control and Sampling Designs · Tutorial 967 of 981

Risk Calibration When Sampling Fractions Are Unknown

Learn how to recover absolute logistic risks from case-control data by combining fitted slopes with external population prevalence.

Advanced 11 min read

What You'll Learn

  • Explain why unknown case and control sampling fractions shift the logistic intercept.
  • Distinguish estimable logistic slopes from unidentified absolute risks.
  • Reconstruct the target covariate distribution from outcome-specific samples and external prevalence.
  • Solve the prevalence-calibration equation and establish when its intercept solution is unique.
  • Identify assumptions that can invalidate this calibration.

Why Absolute Risk Is Not Identified

A case-control study deliberately samples people according to their outcome: cases are included at one rate and controls at another. This design can preserve information about how covariates relate to the outcome, but the observed fraction of cases is chosen by the sampling plan. It is therefore not, by itself, the population prevalence. When the sampling fractions are unknown, the case-control data do not determine the population logistic intercept or absolute risks.

Suppose \(Y\) is a binary outcome, \(X\) is a covariate vector, and the source-population risk follows a logistic model. Write \(\operatorname{expit}(u)=1/(1+\exp(-u))\). If selection depends on outcome but not on \(X\) within outcome groups, the sampled logistic model has the same slopes but a shifted intercept.

Definition: Let \(s_1=P(S=1\mid Y=1)\) and \(s_0=P(S=1\mid Y=0)\) be the case and control sampling fractions, where \(S=1\) means included in the study. Under outcome-dependent sampling independent of \(X\) conditional on \(Y\), the source-population model \(\operatorname{logit}P(Y=1\mid X=x)=\alpha+\beta^\mathsf{T}x\) becomes the sampled model \(\operatorname{logit}P(Y=1\mid X=x,S=1)=\alpha+\log(s_1/s_0)+\beta^\mathsf{T}x\).

The intercept shift follows directly from Bayes' rule. For any covariate value \(x\) with positive probability of selection,

$$ \frac{P(Y=1\mid x,S=1)}{P(Y=0\mid x,S=1)} = \frac{P(Y=1\mid x)}{P(Y=0\mid x)} \frac{s_1}{s_0}. $$

Taking logarithms gives the stated shift. If \(s_1/s_0\) is unknown, a fitted sampled intercept cannot be translated into the source-population intercept. The sampled case proportion does not resolve the problem: it reflects the design as well as the source population.

Worked Example: Same Slopes, Different Absolute Risks

Suppose the source-population model is \(\operatorname{logit}P(Y=1\mid X=x)=-2+0.7x\). Cases are sampled with probability \(s_1=0.10\), and controls with probability \(s_0=0.50\).

The sampling ratio is \(s_1/s_0=0.2\), so the sampled intercept is \[ -2+\log(0.2)=-2-1.60944=-3.60944. \] The slope remains \(0.7\). At \(x=0\), the source risk is \(\operatorname{expit}(-2)\approx0.1192\), while the sampled conditional probability is \(\operatorname{expit}(-3.60944)\approx0.0264\). At \(x=1\), the corresponding values are \(\operatorname{expit}(-1.3)\approx0.2142\) and \(\operatorname{expit}(-2.90944)\approx0.0517\).

Thus the fitted slope describes the same change in log odds per unit of \(X\), but the sampled probabilities are not source-population risks. Without the sampling ratio or other calibration information, the source intercept and risks are not recovered.

Calibrating With Prevalence and a Covariate Distribution

An external estimate of population prevalence supplies the marginal constraint needed to locate the intercept. Let \(\pi=P(Y=1)\) be the source-population prevalence and let \(F_X\) denote the source-population distribution of \(X\). For a given slope vector \(\beta\), an intercept \(\alpha\) must satisfy

$$ \int \operatorname{expit}(\alpha+\beta^\mathsf{T}x)\,dF_X(x)=\pi. $$

The left side is the average model-predicted risk over the target population's covariate distribution. If \(F_X\) is available from a representative population sample, it can be used directly. In case-control data, it can instead be reconstructed from the covariate distributions among cases and controls, provided sampling within each outcome group is representative.

Theorem: Suppose \(0<\pi<1\), \(\beta\) is fixed and finite, and \(F_X\) is a probability distribution on finite covariate vectors \(x\). Then there is exactly one finite \(\alpha\) satisfying \(\int\operatorname{expit}(\alpha+\beta^\mathsf{T}x)\,dF_X(x)=\pi\).

Proof. Define \(g(\alpha)=\int\operatorname{expit}(\alpha+\beta^\mathsf{T}x)\,dF_X(x)\). For every finite \(x\), the integrand is continuous and strictly increasing in \(\alpha\), and it lies between zero and one. Bounded convergence therefore implies that \(g\) is continuous. If \(\alpha_1<\alpha_2\), the integrand at \(\alpha_1\) is strictly smaller than at \(\alpha_2\) for every \(x\), so integrating gives \(g(\alpha_1)<g(\alpha_2)\). By bounded convergence again, \(g(\alpha)\to0\) as \(\alpha\to-\infty\) and \(g(\alpha)\to1\) as \(\alpha\to+\infty\). Continuity and the intermediate value theorem give a solution for each \(\pi\in(0,1)\), and strict increase makes it unique. \(\square\)

When only outcome-specific covariate distributions are available, write \(F_1\) for the distribution of \(X\) among source-population cases and \(F_0\) for its distribution among source-population controls. The law of total probability gives

$$ F_X=\pi F_1+(1-\pi)F_0. $$

This identity is useful because case-control sampling can estimate \(F_1\) and \(F_0\) separately even though it distorts the overall case proportion. The mixture uses the external prevalence, not the proportion of cases enrolled in the study.

Calibration equation: Given an external prevalence \(\pi\), fitted source-population slopes \(\hat\beta\), and outcome-specific covariate distributions, choose \(\hat\alpha\) to solve \(\pi\int\operatorname{expit}(\hat\alpha+\hat\beta^\mathsf{T}x)\,dF_1(x)+(1-\pi)\int\operatorname{expit}(\hat\alpha+\hat\beta^\mathsf{T}x)\,dF_0(x)=\pi\).

The equation has a unique finite solution under the same conditions as the theorem. With empirical distributions from \(n_1\) cases and \(n_0\) controls, it becomes

$$ \frac{\pi}{n_1}\sum_{i:Y_i=1}\operatorname{expit}(\alpha+\hat\beta^\mathsf{T}X_i) + \frac{1-\pi}{n_0}\sum_{i:Y_i=0}\operatorname{expit}(\alpha+\hat\beta^\mathsf{T}X_i) =\pi. $$

The left side is continuous and strictly increasing in \(\alpha\), with limits zero and one. A one-dimensional root-finding method, such as bisection, can therefore find the calibrated intercept. Predictions \(\operatorname{expit}(\hat\alpha+\hat\beta^\mathsf{T}x)\) are then calibrated to the supplied prevalence over the specified target covariate distribution.

Worked Calibration Examples

Worked Example: Calibrating a Binary Covariate With a Known Distribution

Suppose \(X\) is binary, the source-population slope is \(\beta=\log(4)\), \(P(X=1)=0.75\), and the external prevalence is \(\pi=0.20\). Set \(t=\exp(\alpha)\), which must be positive. The two fitted risks are \(t/(1+t)\) at \(X=0\) and \(4t/(1+4t)\) at \(X=1\). Calibration requires

$$ 0.25\frac{t}{1+t}+0.75\frac{4t}{1+4t}=0.20. $$

Multiplying by \((1+t)(1+4t)\) gives \(0.25t(1+4t)+3t(1+t)=0.20(1+5t+4t^2)\), hence \(3.2t^2+2.25t-0.20=0\). The positive root is

$$ t=\frac{-2.25+\sqrt{7.6225}}{6.4}\approx0.079826. $$

Therefore \(\alpha=\log(t)\approx-2.527\). The risks are approximately \(0.0739\) for \(X=0\) and \(0.2420\) for \(X=1\). Weighting the unrounded risks by their covariate probabilities gives \(0.25\{t/(1+t)\}+0.75\{4t/(1+4t)\}=0.20\), as required.

Worked Example: Reconstructing the Covariate Distribution From Case-Control Data

Suppose an external source gives prevalence \(\pi=0.10\). Among 10 sampled cases, 8 have \(X=1\); among 10 sampled controls, 2 have \(X=1\). Assume these samples represent their respective source-population outcome groups, and the fitted source slope is \(\hat\beta=\log(3)\).

The reconstructed target proportion with \(X=1\) is \(0.10(8/10)+0.90(2/10)=0.26\); thus the proportion with \(X=0\) is \(0.74\). Let \(t=\exp(\alpha)\). The calibration equation is

$$ 0.74\frac{t}{1+t}+0.26\frac{3t}{1+3t}=0.10. $$

After multiplying by \((1+t)(1+3t)\), this becomes \(0.74t(1+3t)+0.78t(1+t)=0.10(1+4t+3t^2)\), or \(2.7t^2+1.12t-0.10=0\). The positive root is \(t=(-1.12+\sqrt{2.3344})/5.4\approx0.075532\), so \(\alpha\approx-2.583\). The resulting risks are about \(0.0702\) at \(X=0\) and \(0.1847\) at \(X=1\). Their target-population average is approximately \(0.74(0.0702)+0.26(0.1847)=0.1000\); using the unrounded root gives exactly \(0.10\) by construction.

Assumptions, Interpretation, and Common Pitfalls

This calibration is meaningful only when its inputs refer to the same target population and period. The external prevalence must describe the population whose risks are wanted. The case and control samples must represent the covariate distributions within their respective outcome groups. The fitted slopes must be appropriate for the source population, as under a correctly specified logistic model with sampling independent of covariates conditional on outcome. If selection also depends on \(X\) within outcome groups, the simple intercept-shift argument and the mixture reconstruction need not hold.

The calibration equation enforces one marginal constraint; it does not establish that the logistic model is correctly specified or that subgroup risks are accurate. It also does not make prevalence alone sufficient when the target distribution of \(X\) is unknown. In the case-control version above, the outcome-specific covariate distributions provide the information needed to reconstruct that target distribution under the stated sampling assumptions. Uncertainty in the external prevalence, slopes, and covariate distributions should be recognized when drawing inferential conclusions.

  • Mistake: treating the sampled case fraction as prevalence. The wrong reasoning is to use \(n_1/(n_1+n_0)\) as \(\pi\). That fraction is determined partly by the sampling plan. Use a prevalence estimate for the target population.
  • Mistake: changing only the risks without stating the target covariate distribution. Calibration averages predictions over \(F_X\). If that distribution is unknown, prevalence by itself does not specify which average-risk constraint to apply.
  • Mistake: assuming the external prevalence changes the slopes. Under the stated outcome-dependent sampling model, calibration reconstructs the intercept while retaining the fitted source-population slopes. It does not repair slope bias caused by model misspecification or covariate-dependent selection.
Key takeaway: Unknown sampling fractions leave the source logistic intercept unidentified. An external prevalence, combined with a target covariate distribution (known directly or reconstructed from representative case and control samples), supplies a unique intercept-calibration equation and hence absolute risk predictions under the logistic model.

Check Your Understanding

Use the assumptions and calibration equation above to answer these questions.

  1. Why does outcome-dependent sampling shift the logistic intercept but leave the covariate slopes unchanged under the stated assumptions?
  2. Why can the observed fraction of sampled participants who are cases not generally be used as the target prevalence?
  3. If the external prevalence is \(0.15\), what mixture of \(F_1\) and \(F_0\) gives the target covariate distribution?
  4. What guarantees that the calibration equation has exactly one finite intercept solution when the prevalence is strictly between zero and one?
  5. Name one sampling or model condition whose failure could make the calibrated risks unreliable.
Clinical Biostats