Tutorials › Generalized Linear Models › Inverse-Probability Weighting For Case-Control Data

Case-Control and Sampling Designs · Tutorial 970 of 981

Inverse-Probability Weighting For Case-Control Data

Derive inverse-probability weighted regression equations from the sampling design and use them to recover source-population logistic parameters.

Advanced 10 min read

What You'll Learn

  • Define inverse-inclusion-probability weights for case-control observations
  • Derive the Horvitz–Thompson identity underlying weighted estimating equations
  • Construct weighted logistic-regression score equations for source-population parameters
  • Recover logistic coefficients from case-control tables with known selection probabilities
  • Identify when unweighted and weighted estimates agree or differ
  • Recognize positivity, model, and weighting pitfalls

Why Weight Case-Control Data?

In a case-control study, inclusion is often determined partly by outcome: cases may be sampled more heavily than controls. If inclusion also depends on covariates, the sampled covariate-outcome distribution can differ substantially from the source population. When the inclusion probabilities are known, inverse-probability weighting provides a direct way to construct estimating equations for source-population regression parameters.

The central idea is to give each sampled observation a weight equal to the reciprocal of its probability of inclusion. A sampled person who represents many source-population people then contributes more to the estimating equation than a person who was easy to select. This tutorial develops the identity behind that correction and applies it to logistic regression.

Inclusion Probabilities and Weighted Equations

Definition: Let \(Y_i\) and \(X_i\) denote the outcome and covariates for source-population unit \(i\), and let \(R_i=1\) if that unit is selected into the study and \(R_i=0\) otherwise. The unit's inclusion probability is \(\pi_i=P(R_i=1\mid Y_i,X_i)\). When \(\pi_i>0\), its inverse-inclusion-probability weight is \(w_i=1/\pi_i\).

The probability \(\pi_i\) may depend on both outcome and covariates. For example, investigators may select cases with one probability and controls with different probabilities across covariate groups. The probability used for weighting must be the probability that the particular source-population unit is included under the actual sampling design.

Suppose a complete source-population observation would contribute \(U_i(\theta)\) to an estimating equation for a parameter \(\theta\). The corresponding inverse-probability weighted equation uses only selected observations:

$$ \sum_{i:R_i=1}\frac{1}{\pi_i}U_i(\theta)=0. $$

Equivalently, using all source-population indices and noting that unselected units have \(R_i=0\), write the left side as \(\sum_i R_i U_i(\theta)/\pi_i\). The weights are not arbitrary corrections: they make this weighted sum unbiased for the complete-data sum under the sampling design.

Theorem: For a fixed finite population with known inclusion probabilities \(\pi_i>0\), and any fixed values \(U_i\), the Horvitz–Thompson identity is $$ E_{\mathrm{design}}\!\left[\sum_i\frac{R_i}{\pi_i}U_i\right]=\sum_i U_i. $$ Here the expectation is over the sampling design, with the finite-population values held fixed.

Proof. By linearity of expectation and the definition \(E_{\mathrm{design}}[R_i]=P(R_i=1)=\pi_i\),

$$ E_{\mathrm{design}}\!\left[\sum_i\frac{R_i}{\pi_i}U_i\right] =\sum_i\frac{U_i}{\pi_i}E_{\mathrm{design}}[R_i] =\sum_i\frac{U_i}{\pi_i}\pi_i =\sum_i U_i. $$

No independence among the inclusion indicators is needed for this expectation identity. Positivity is needed so that each reciprocal weight is defined. \(\square\)

For a source-population likelihood score \(U_i(\theta)=\partial\ell_i(\theta)/\partial\theta\), the weighted equation estimates the root of the complete-data score equation. In practice, the weighted equation is often solved as an estimating equation or as the score equation of a weighted log-likelihood. The latter is a computational representation; it should not automatically be interpreted as the likelihood of the sampling design.

Weighted Logistic Regression

Consider a source-population logistic model with covariate vector \(X_i\), including an intercept, and

$$ P(Y_i=1\mid X_i)=p_i(\beta) =\frac{\exp(X_i^\mathsf{T}\beta)}{1+\exp(X_i^\mathsf{T}\beta)}. $$

The Bernoulli log-likelihood contribution for a complete observation is \(Y_i\log p_i+(1-Y_i)\log(1-p_i)\). Differentiating with respect to \(\beta\) gives the score \(X_i\{Y_i-p_i(\beta)\}\). Thus the inverse-probability weighted logistic estimating equation is

$$ \sum_{i:R_i=1}\frac{1}{\pi_i} X_i\{Y_i-p_i(\beta)\}=0. $$

It asks the fitted source-population model to balance weighted observed outcomes against weighted fitted probabilities. If \(\pi_i\) depends on \(Y_i\), it must be evaluated using the observed outcome as part of the sampling rule; it is not generally enough to weight only by covariates.

Theorem: Suppose source-population observations are identically distributed, \(E[R\mid Y,X]=\pi(Y,X)>0\), and the source-population score \(U_\theta(Y,X)\) is integrable. Then $$ E\!\left[\frac{R}{\pi(Y,X)}U_\theta(Y,X)\right] =E[U_\theta(Y,X)]. $$ If the source-population model is correctly specified at \(\theta_0\) and its usual score has expectation zero there, the weighted score also has expectation zero at \(\theta_0\).

Proof. First condition on the complete observation \((Y,X)\). Since \(U_\theta(Y,X)\) and \(\pi(Y,X)\) are then fixed, and \(E[R\mid Y,X]=\pi(Y,X)\),

$$ E\!\left[\left.\frac{R}{\pi(Y,X)}U_\theta(Y,X)\right|Y,X\right] =\frac{U_\theta(Y,X)}{\pi(Y,X)}E[R\mid Y,X] =U_\theta(Y,X). $$

Taking expectations of both sides proves the identity. At \(\theta_0\), correct specification gives \(E[U_{\theta_0}(Y,X)]=0\), so the weighted score has expectation zero as well. \(\square\)

For independent source units sampled with known probabilities, this identity explains why a weighted equation targets the source-population score. A consistency claim also requires regularity conditions: for example, an identifiable, unique population-score root; a compact parameter space; continuity in the parameter; an integrable envelope for the weighted score; and a uniform law of large numbers for the sampled contributions. Under those conditions, an approximate root of the empirical weighted equation converges in probability to the population root. If weights can become arbitrarily large, the required integrability and convergence conditions deserve particular attention.

Worked Case-Control Reconstructions

Worked Example: Outcome-Only Selection

Suppose the source population has the following counts. The study selects cases with probability \(0.5\) and controls with probability \(0.1\), regardless of covariate value. The displayed sample has the counts implied by those probabilities.

Covariate \(Z\)Source casesSource controlsSample casesSample controls
02080108
16040304

The case weight is \(1/0.5=2\); the control weight is \(1/0.1=10\). Weighting the sample counts therefore gives \(Z=0\): 20 cases and 80 controls; \(Z=1\): 60 cases and 40 controls. These are the source counts.

The source odds at \(Z=0\) are \(20/80=0.25\), and at \(Z=1\) they are \(60/40=1.5\). Hence the source odds ratio is \(1.5/0.25=6\). The corresponding saturated logistic regression has intercept \(\log(0.25)=-\log 4\) and slope \(\log(6)\).

Check the unweighted sample odds ratio carefully: it is \((30/4)/(10/8)=7.5/1.25=6\), equal to the weighted odds ratio. This agreement is expected here: selection depends on outcome but not on \(Z\), so the same case-versus-control sampling factor applies in both covariate groups and cancels in the odds ratio. It does not mean the sample counts themselves represent the source counts.

Worked Example: Covariate-Dependent Control Selection

Keep the same source population, but now select cases with probability \(0.5\) at both values of \(Z\), controls with probability \(0.1\) when \(Z=0\), and controls with probability \(0.5\) when \(Z=1\). The observed sample counts are 10 cases and 8 controls at \(Z=0\), and 30 cases and 20 controls at \(Z=1\).

The weights are 2 for cases, 10 for controls with \(Z=0\), and 2 for controls with \(Z=1\). Applying them recovers the source counts:

$$ \begin{array}{c|cc} Z & \text{weighted cases} & \text{weighted controls}\\ 0 & 10(2)=20 & 8(10)=80\\ 1 & 30(2)=60 & 20(2)=40 \end{array} $$

Consequently, the weighted source odds ratio is again \((60/40)/(20/80)=1.5/0.25=6\). Without weighting, however, the sample odds are \(10/8=1.25\) at \(Z=0\) and \(30/20=1.5\) at \(Z=1\). The unweighted sample odds ratio is \(1.5/1.25=1.2\), not 6. Here the control selection probability changes with \(Z\), so selection no longer cancels from the comparison. The weighted saturated logistic fit recovers intercept \(-\log 4\) and slope \(\log 6\).

Worked Example: Checking a Weighted Logistic Score Across Three Covariate Values

Let \(Z\) take values 0, 1, and 2, with 100 source-population units at each value. Suppose the source case counts are 20, 50, and 80, respectively; the control counts are therefore 80, 50, and 20. The source case probabilities are \(0.2, 0.5,\) and \(0.8\). Cases are selected with probability \(0.5\) at each \(Z\); controls are selected with probabilities \(0.1, 0.2,\) and \(0.5\) at \(Z=0,1,2\). Consider a sample with the corresponding counts: cases 10, 25, 40 and controls 8, 10, 10.

The case weights are all 2. The control weights at \(Z=0,1,2\) are 10, 5, and 2. Thus weighted case counts are \(20,50,80\), and weighted control counts are \(80,50,20\). At each \(Z\), the weighted total is 100 and the weighted case proportion is the source proportion.

For the model \(\operatorname{logit}\{p(Z)\}=\beta_0+\beta_1Z\), these proportions have logits \(-\log 4,0,\log 4\). They are represented by \(\beta_0=-\log 4\) and \(\beta_1=\log 4\), since \(-\log 4+\log 4(0)=-\log 4\), \(-\log 4+\log 4(1)=0\), and \(-\log 4+\log 4(2)=\log 4\).

At these coefficients, the weighted logistic score contribution for each covariate group is zero: its weighted cases minus its weighted total times the fitted probability is, respectively, \(20-100(0.2)=0\), \(50-100(0.5)=0\), and \(80-100(0.8)=0\). Multiplying these three zero residual totals by the covariate values 0, 1, and 2 also gives zero. Therefore both the weighted intercept score and slope score are zero, verifying the stated regression parameters directly.

Conditions and Common Pitfalls

Inverse-probability weighting is useful because it separates the target population from the selection mechanism: the regression equation is built for the source population, while the weights account for who entered the sample. Its validity nevertheless depends on knowing the appropriate inclusion probabilities and on having a positive chance of observing every kind of source unit relevant to the target.

  • Using the wrong inclusion probability. A case's probability and a control's probability can differ, and control probabilities may also vary by covariates. Use the probability for the unit's actual outcome and covariate values under the design.
  • Ignoring positivity. If \(\pi(Y,X)=0\) for a source-population subgroup, its contribution cannot be recovered by weighting; no finite reciprocal weight exists.
  • Rescaling case and control weights separately without justification. Multiplying every weight by one common positive constant leaves a score root unchanged. Multiplying case weights and control weights by different constants generally changes the estimating equation and its root.
  • Assuming weighting always changes the logistic slope. When sampling depends on outcome alone, the sample odds ratio may already equal the source odds ratio. Covariate-dependent selection can break that cancellation, as the second example shows.
  • Calling a weighted score a design likelihood. The weighted score can target a source-population parameter through the identity proved above. That fact alone does not make the weighted objective the probability model for the sampling process.
Key takeaway: Use the reciprocal of each unit's known inclusion probability to weight its source-population score contribution. Under positivity, the resulting equation has the same expected score as the complete source-population equation; whether an unweighted analysis has the same answer depends on the selection mechanism.

Check Your Understanding

Use the sampling probabilities and score identities developed above to answer the following.

  1. If cases are selected with probability \(0.4\) and controls with probability \(0.2\), what are their inverse-inclusion-probability weights?
  2. State the Horvitz–Thompson identity and identify which expectation is taken in its finite-population version.
  3. In a logistic model, write the inverse-probability weighted score equation for a covariate vector \(X_i\).
  4. Why can a sample odds ratio equal the source odds ratio when selection depends on outcome but not on a binary covariate?
  5. What prevents inverse-probability weighting from recovering a subgroup's contribution if its inclusion probability is zero?
Clinical Biostats