Tutorials › Generalized Linear Models › Prospective And Retrospective Logistic Likelihoods

Case-Control and Sampling Designs · Tutorial 963 of 981

Prospective And Retrospective Logistic Likelihoods

Learn to factor logistic-regression likelihoods by outcome or by covariates and distinguish a fixed case-control likelihood from the population likelihood.

Advanced 11 min read

What You'll Learn

  • Factor the population likelihood into prospective and retrospective forms
  • Express outcome-specific covariate distributions using a logistic model
  • Separate likelihood factors for outcome counts from those for covariates
  • Derive the observed-data likelihood under outcome-dependent sampling
  • Identify when covariate-distribution terms still involve logistic parameters

Two Ways to Factor the Same Joint Likelihood

A logistic regression model specifies the probability of an outcome given covariates. In a population sample, the likelihood can therefore be organized around the covariates first and the outcomes second. In a case-control sample, it is natural to organize the same joint distribution around the outcome groups instead. These are distinct factorizations of a joint law, not automatically distinct population models.

Let \(Y\in\{0,1\}\) be a binary outcome and let \(X\) denote a covariate vector. Suppose the source-population outcome model is

$$ P(Y=1\mid X=x)=p(x)=\frac{\exp(\alpha+\beta^{\mathsf T}x)}{1+\exp(\alpha+\beta^{\mathsf T}x)}. $$

Write \(f_X(x)\) for the density or mass function of \(X\), with respect to an appropriate common measure, and let \(\pi=P(Y=1)\). Assume \(0<\pi<1\), and that the logistic model and \(f_X\) define a joint distribution for which the probabilities and densities below exist. The prevalence is determined by both the regression model and the covariate distribution:

$$ \pi=\int p(x)f_X(x)\,dx. $$

For discrete \(X\), the integral means a sum. The outcome-specific covariate distributions are denoted \(f_1(x)=f(x\mid Y=1)\) and \(f_0(x)=f(x\mid Y=0)\), wherever the corresponding outcome has positive probability.

Definition: The prospective factorization writes the joint distribution as the covariate distribution multiplied by the outcome distribution conditional on covariates: \(f_X(x)P(Y=y\mid X=x)\). The retrospective factorization writes it as the outcome probability multiplied by the covariate distribution conditional on outcome: \(P(Y=y)f(x\mid Y=y)\).

Population Likelihoods

For \(n\) independent observations \((y_i,x_i)\) from the source population, the prospective likelihood is obtained by multiplying the joint densities. Define \(\eta_i=\alpha+\beta^{\mathsf T}x_i\). The Bernoulli probability can be written \(p(x_i)^{y_i}\{1-p(x_i)\}^{1-y_i}\), giving

$$ L_{\mathrm{pros}}(\alpha,\beta,f_X) =\prod_{i=1}^n f_X(x_i) \left\{\frac{\exp(\eta_i)}{1+\exp(\eta_i)}\right\}^{y_i} \left\{\frac{1}{1+\exp(\eta_i)}\right\}^{1-y_i}. $$

This factorization displays the covariate-distribution contribution and the logistic outcome contribution. If inference conditions on the observed covariates in an ordinary prospective design, the factors \(f_X(x_i)\) are not part of that conditional likelihood for \((\alpha,\beta)\). If instead the joint distribution of outcomes and covariates is being modeled, the covariate distribution remains part of the joint likelihood.

The retrospective factorization follows from the product rule for joint probabilities and densities:

$$ f(y,x)=P(Y=y)f(x\mid Y=y). $$

In the logistic model, Bayes’ rule gives the outcome-specific covariate distributions

$$ f_1(x)=\frac{f_X(x)p(x)}{\pi}, \qquad f_0(x)=\frac{f_X(x)\{1-p(x)\}}{1-\pi}. $$

Consequently, the retrospective likelihood for the same population observations is

$$ L_{\mathrm{ret}}(\alpha,\beta,f_X) =\prod_{i=1}^n \pi^{y_i}(1-\pi)^{1-y_i} \left\{\frac{f_X(x_i)p(x_i)}{\pi}\right\}^{y_i} \left\{\frac{f_X(x_i)\{1-p(x_i)\}}{1-\pi}\right\}^{1-y_i}. $$

This expression equals the prospective likelihood exactly: for each observation, the factor \(\pi\) or \(1-\pi\) cancels the corresponding denominator in \(f(x_i\mid y_i)\). The equality is an algebraic identity, not an approximation. Importantly, \(\pi\) is not generally an unrelated free quantity in this model: it is the integral of \(p(x)f_X(x)\).

Worked Example: Expanding a Prospective Likelihood

Suppose two observations have covariates \(x_1,x_2\) and outcomes \(y_1=1,y_2=0\). Let \(p_i=p(x_i)\). Their prospective likelihood is

$$ f_X(x_1)f_X(x_2)p_1(1-p_2). $$

In retrospective form, the same likelihood is

$$ \pi(1-\pi) \left\{\frac{f_X(x_1)p_1}{\pi}\right\} \left\{\frac{f_X(x_2)(1-p_2)}{1-\pi}\right\}. $$

Multiplying the factors cancels \(\pi(1-\pi)\) against the two denominators, leaving \(f_X(x_1)f_X(x_2)p_1(1-p_2)\), precisely the prospective expression. The outcome-specific covariate densities in the retrospective expression still depend on the logistic probabilities \(p_1,p_2\).

What Outcome-Dependent Sampling Changes

In case-control sampling, inclusion depends on the outcome. A useful basic design selects a person with probability \(s_1\) if \(Y=1\) and \(s_0\) if \(Y=0\), where \(s_0,s_1>0\), with selection independent of \(X\) conditional on \(Y\). Let \(S=1\) indicate selection. The probability of selection in the source population is

$$ C=P(S=1)=s_1\pi+s_0(1-\pi). $$

The joint density among selected people is therefore \(f(y,x\mid S=1)=s_y f(y,x)/C\). Define the selected-sample case fraction \(q=P(Y=1\mid S=1)=s_1\pi/C\). Conditioning the selected joint density on \(Y=y\) cancels the selection probability \(s_y\), so \(f(x\mid Y=y,S=1)=f(x\mid Y=y)\). Thus the selected-sample density has the retrospective factorization

$$ f(y,x\mid S=1) =q^y(1-q)^{1-y}f_y(x). $$

This identity explains why the sampling design matters when writing a likelihood. If the study fixes the numbers of cases and controls, the outcome labels and their counts are fixed by design. Conditional on those labels, the likelihood for the observed covariates is

$$ L_{\mathrm{CC}} =\prod_{i:y_i=1} f_1(x_i) \prod_{i:y_i=0} f_0(x_i). $$

There is no likelihood contribution for the case fraction \(q\) in this conditional likelihood: the numbers of cases and controls were set rather than generated as random outcomes. If instead selected outcomes are treated as random, the selected joint likelihood also has the factor \(q^{n_1}(1-q)^{n_0}\), where \(n_1=\sum_i y_i\) and \(n_0=n-n_1\).

Theorem: Under outcome-only sampling with positive selection probabilities \(s_0,s_1\), the selected covariate distribution within each outcome group equals its source-population counterpart. For a fixed case-control design, the likelihood conditional on the outcome labels is the product of the source-population densities \(f(x\mid Y=y)\) for the sampled individuals.

Proof. For \(y\in\{0,1\}\), selection depends only on \(Y\), so

$$ f(x\mid Y=y,S=1) =\frac{P(S=1\mid Y=y,X=x)f(x\mid Y=y)} {P(S=1\mid Y=y)} =\frac{s_y f(x\mid Y=y)}{s_y} =f(x\mid Y=y). $$

The denominator is positive because \(s_y>0\). With fixed outcome labels, the sampled covariates are modeled by their conditional densities within the respective outcome groups; independence of sampled individuals gives their product. \(\square\)

Substituting the logistic model into this fixed-design likelihood makes its parameter dependence visible:

$$ L_{\mathrm{CC}} = \prod_{i:y_i=1} \frac{f_X(x_i)p(x_i)}{\pi} \prod_{i:y_i=0} \frac{f_X(x_i)\{1-p(x_i)\}}{1-\pi}. $$

For fixed \(f_X\), the factors \(p(x_i)\), \(1-p(x_i)\), and generally \(\pi=\int p(x)f_X(x)\,dx\) involve \(\alpha\) and \(\beta\). The factors \(f_X(x_i)\) involve the covariate distribution. If that distribution is unknown, those terms cannot simply be discarded from a joint likelihood without specifying how the nuisance distribution is handled. The retrospective likelihood is not, in general, just the usual prospective Bernoulli likelihood with a different count of cases.

Worked Example: Calculating Outcome-Specific Covariate Distributions

Let \(X\) be binary with \(P(X=1)=0.30\). Suppose a logistic model gives \(P(Y=1\mid X=1)=0.3775\) and \(P(Y=1\mid X=0)=0.1192142857\). The population prevalence is

$$ \pi=(0.30)(0.3775)+(0.70)(0.1192142857) =0.11325+0.08345 =0.19670. $$

For cases, Bayes’ rule gives

$$ P(X=1\mid Y=1) =\frac{(0.30)(0.3775)}{0.1967} =\frac{0.11325}{0.1967} \approx 0.5758. $$

For controls, \(P(Y=0)=1-0.1967=0.8033\), so

$$ P(X=1\mid Y=0) =\frac{(0.30)(1-0.3775)}{0.8033} =\frac{0.18675}{0.8033} \approx 0.2325. $$

The two sampled groups therefore have different covariate distributions. The case-control likelihood uses the case-group probability for each case and the control-group probability for each control; those probabilities are formed from the logistic outcome probabilities and the source prevalence.

Worked Example: Random Versus Fixed Case Counts

Suppose outcome-only selection has \(s_1=0.8\), \(s_0=0.2\), and source prevalence \(\pi=0.10\). The overall selection probability and selected case fraction are

$$ C=(0.8)(0.10)+(0.2)(0.90)=0.08+0.18=0.26, \qquad q=\frac{(0.8)(0.10)}{0.26}=\frac{4}{13}\approx0.3077. $$

If 100 selected outcomes are treated as random and 30 are cases, their outcome-count likelihood contribution is \(q^{30}(1-q)^{70}\). If the design instead stipulated exactly 30 cases and 70 controls, those counts are fixed and this factor is absent from the likelihood conditional on the design. In both cases, conditional on each outcome label, the covariate distribution is the source \(f(x\mid Y=y)\), under the stated outcome-only selection assumption.

A Factorization Result and a Common Pitfall

The distinction between a joint likelihood and a likelihood conditional on design can be summarized precisely. Suppose observations are independent from a joint density \(f(y,x)\), and \(P(Y=y)>0\) for each outcome group represented. Then the joint likelihood factors into the outcome-count part and the covariate-within-outcome part:

$$ \prod_{i=1}^n f(y_i,x_i) = \pi^{n_1}(1-\pi)^{n_0} \prod_{i:y_i=1}f_1(x_i) \prod_{i:y_i=0}f_0(x_i). $$

Derivation. Apply \(f(y_i,x_i)=P(Y=y_i)f(x_i\mid Y=y_i)\) separately to every observation. There are \(n_1\) factors \(\pi f_1(x_i)\) and \(n_0\) factors \((1-\pi)f_0(x_i)\). Collecting the outcome-probability factors gives \(\pi^{n_1}(1-\pi)^{n_0}\), leaving the two products of conditional covariate densities. Under fixed case-control counts, conditioning on the labels removes this first factor. \(\square\)

A frequent mistake is to argue: “The study deliberately chose the number of cases, so the likelihood contains no logistic-regression parameters.” The first clause correctly says that the case-count factor is absent from the likelihood conditional on the labels. It does not imply that the covariate distributions within the case and control groups are parameter-free. In the logistic formulation, those distributions contain \(p(x)\) and the source prevalence \(\pi\); both can depend on the regression coefficients.

Another mistake is to treat \(\pi\) as the observed case fraction in a fixed case-control sample. The observed fraction is set by the sampling design and generally differs from source prevalence. The likelihood factorization keeps these quantities conceptually distinct: source prevalence appears in the population conditional densities, while the sample case fraction is a design feature when counts are fixed.

Key takeaway: The prospective likelihood factors into \(f_X(x)\) and \(P(Y\mid X)\); the retrospective likelihood factors into \(P(Y)\) and \(f(X\mid Y)\). Under fixed case-control sampling, condition on the outcome labels and use the outcome-specific covariate densities. Their dependence on logistic parameters remains explicit through \(p(x)\) and \(\pi\).

Check Your Understanding

Use the factorizations above to answer the following questions.

  1. Write the prospective likelihood for three observations with outcomes \(1,0,1\) and covariates \(x_1,x_2,x_3\).
  2. Why does \(f(x\mid Y=y,S=1)=f(x\mid Y=y)\) hold when selection depends only on outcome?
  3. In a fixed case-control design, which likelihood factor associated with outcome counts is omitted when conditioning on the observed labels?
  4. Explain why the retrospective covariate likelihood can still depend on \(\alpha\) and \(\beta\), even though the case count was fixed.
  5. Distinguish the source prevalence \(\pi\) from the selected-sample case fraction \(q\).
Clinical Biostats