Tutorials › Generalized Linear Models › Profiling Risk Differences in Logistic Regression

Profile Likelihood and Intervals · Tutorial 294 of 981

Profiling Risk Differences in Logistic Regression

Learn to define a logistic risk difference, maximize the likelihood subject to its value, and use the profile likelihood to form and interpret an interval.

Advanced 11 min read

What You'll Learn

  • Define a risk difference between two covariate settings in a logistic regression model
  • Form the profile likelihood by constraining the risk difference and maximizing over coefficients
  • Derive the constrained score equation in a two-group binomial example
  • Construct a likelihood-ratio confidence interval using a chi-square cutoff
  • Compare profile and Wald intervals and identify when their conclusions can differ

Why Profile a Risk Difference?

In logistic regression, coefficients describe changes in log odds, but a clinical question often concerns an absolute change in probability. For example, a treatment may change a patient's probability of an outcome from 0.20 to 0.30. The risk difference is 0.10, even though the corresponding odds ratio is not 1.10. Moreover, a risk difference depends on the covariates at which the two risks are evaluated: the same coefficient change can imply different probability changes for patients with different baseline risks.

This tutorial constructs a profile likelihood interval for the difference between two logistic risks at specified covariate settings. The key operation is to fix a candidate difference and maximize the likelihood over all regression coefficients that produce it. The resulting interval can be asymmetric, unlike the usual Wald interval, which uses a standard error and a symmetric cutoff.

Define the Target and Its Profile Likelihood

Suppose \(Y_i\) are independent Bernoulli responses with fixed covariate vectors \(x_i\), and \(\operatorname{logit}\{P(Y_i=1\mid x_i)\}=x_i^\mathsf{T}\beta\), where \(\operatorname{logit}(p)=\log\{p/(1-p)\}\). At two specified covariate vectors \(x_0\) and \(x_1\), define the risks and their difference by \(p_j(\beta)=\operatorname{expit}(x_j^\mathsf{T}\beta)\), \(j=0,1\), and \(\delta(\beta)=p_1(\beta)-p_0(\beta)\), where \(\operatorname{expit}(u)=1/(1+\exp(-u))\).

Definition: The risk difference at the two specified covariate settings is \(\delta(\beta)=\operatorname{expit}(x_1^\mathsf{T}\beta)-\operatorname{expit}(x_0^\mathsf{T}\beta)\). If \(\ell(\beta)\) is the log-likelihood, the profile log-likelihood for a candidate difference \(d\) is \(\ell_p(d)=\sup_{\beta:\,\delta(\beta)=d}\ell(\beta)\). The profile likelihood-ratio statistic is \(R(d)=2\{\ell(\hat\beta)-\ell_p(d)\}\), where \(\hat\beta\) is the unrestricted maximum-likelihood estimator.

Only differences attainable under the model belong to the profile's domain. The constrained maximum may involve every coefficient, not just the coefficient for treatment: changing nuisance coefficients can alter both risks while preserving their difference. A profile interval uses the set of candidate \(d\) values whose likelihood-ratio statistic does not exceed a chosen cutoff. With a one-degree-of-freedom chi-square cutoff \(c\), this set is \(\{d:R(d)\le c\}\). Its usual large-sample 95% version takes \(c=\chi^2_{1,0.95}\approx3.841\).

Worked Example: Translating a Logistic Model Into a Risk Difference

Suppose a treatment indicator \(A\) is the only covariate and the fitted model is \(\operatorname{logit}\{P(Y=1\mid A)\}=\beta_0+\beta_1 A\), with estimates \(\hat\beta_0=-1.2\) and \(\hat\beta_1=0.9\). Compare the treatment and control risks.

For control, \(A=0\), so the estimated risk is \(\hat p_0=\operatorname{expit}(-1.2)=1/(1+\exp(1.2))\approx0.2315\). For treatment, \(A=1\), so \(\hat p_1=\operatorname{expit}(-1.2+0.9)=\operatorname{expit}(-0.3)\approx0.4256\). Thus the estimated risk difference is \(\hat\delta=0.4256-0.2315=0.1941\), or about 19.4 percentage points.

The fitted odds ratio is \(\exp(0.9)\approx2.46\), which is not the risk difference. It describes a multiplicative change in odds; the contrast of interest here is a subtraction of two probabilities. To make an interval for that subtraction, uncertainty in both fitted risks and their dependence must be accounted for.

Deriving the Constrained Maximization

A useful special case makes the profiling operation explicit. Suppose there are two independent groups, with \(x_0\) events among \(n_0\) control observations and \(x_1\) events among \(n_1\) treated observations. A logistic regression with an intercept and a binary treatment indicator is saturated for these two groups: it allows separate probabilities \(p_0\) and \(p_1\). For a fixed difference \(d\), write \(p_0=q\) and \(p_1=q+d\). The feasible values of \(q\) satisfy \(0<q<1\) and \(0<q+d<1\).

Result: For interior event counts \(0<x_j<n_j\), the constrained log-likelihood, up to a constant that does not depend on \(q\), is \(\ell_d(q)=x_0\log q+(n_0-x_0)\log(1-q)+x_1\log(q+d)+(n_1-x_1)\log(1-q-d)\). An interior constrained maximizer satisfies \[ \frac{x_0}{q}-\frac{n_0-x_0}{1-q} +\frac{x_1}{q+d}-\frac{n_1-x_1}{1-q-d}=0. \]

To derive the equation, substitute \(p_0=q\) and \(p_1=q+d\) into the two binomial log-likelihood contributions. Differentiating with respect to \(q\) gives the displayed expression. Its derivative is \[ -\frac{x_0}{q^2}-\frac{n_0-x_0}{(1-q)^2} -\frac{x_1}{(q+d)^2}-\frac{n_1-x_1}{(1-q-d)^2}, \] which is strictly negative throughout the feasible interval when all four event and non-event counts are positive. Therefore \(\ell_d(q)\) is strictly concave there. If its derivative crosses zero within the feasible interval, that root is the unique constrained maximum; otherwise the supremum is approached at a feasible boundary. For interior counts and an interior feasible maximum, the root gives the profile likelihood at \(d\). This establishes both the score equation and the uniqueness claim. \(\square\)

Worked Example: Profiling at a Fixed Risk Difference

In a study with 20 people per group, 6 control participants and 12 treated participants experience the event. The observed risks are \(0.30\) and \(0.60\), so the unrestricted estimate of the risk difference is \(0.30\). Find the constrained maximum when the candidate difference is \(d=0\).

At \(d=0\), the constraint requires \(p_0=p_1=q\). The log-likelihood score equation becomes \[ \frac{6}{q}-\frac{14}{1-q}+\frac{12}{q}-\frac{8}{1-q}=0, \] or \(18/q-22/(1-q)=0\). Multiplication by \(q(1-q)\) gives \(18(1-q)-22q=0\), hence \(q=18/40=0.45\). Strict concavity, as shown above, makes this the unique constrained maximum.

The unrestricted estimates are \(\hat p_0=0.30\) and \(\hat p_1=0.60\). The log-likelihood loss at the constraint, expressed as the sum of binomial likelihood terms, is \[ 6\log(0.30/0.45)+14\log(0.70/0.55) +12\log(0.60/0.45)+8\log(0.40/0.55). \] The four terms are approximately \(-2.433,\ 3.376,\ 3.452,\ -2.548\), which sum to \(1.848\). The likelihood-ratio statistic is twice this loss: \(R(0)\approx2(1.848)=3.696\). Thus zero is inside the usual 95% profile likelihood set, since \(3.696<3.841\), though it is close to the cutoff.

From a Profile Curve to an Interval

For a general logistic regression, the same construction applies even when the constrained optimization cannot be reduced to one scalar \(q\). At each candidate \(d\), maximize \(\ell(\beta)\) subject to \(\operatorname{expit}(x_1^\mathsf{T}\beta)-\operatorname{expit}(x_0^\mathsf{T}\beta)=d\). Then compare the resulting profile likelihood with the unrestricted maximum. The interval endpoints are the values where \(R(d)\) meets the selected cutoff; the accepted values satisfy \(R(d)\le c\).

1
Specify the contrast.
Fix the two covariate settings and write the target as the risk at the second setting minus the risk at the first.
2
Fit the unrestricted model.
Obtain \(\hat\beta\), its maximized log-likelihood, and the estimated risk difference \(\hat\delta=\delta(\hat\beta)\).
3
Profile candidate differences.
For each \(d\), maximize the log-likelihood subject to \(\delta(\beta)=d\), retaining the largest likelihood found among feasible coefficient values.
4
Find the accepted set.
Calculate \(R(d)=2\{\ell(\hat\beta)-\ell_p(d)\}\) and retain values at or below the chosen cutoff. Locate endpoints by solving \(R(d)=c\).

The familiar cutoff \(\chi^2_{1,0.95}\) is an asymptotic likelihood-ratio cutoff. Its usual justification requires a correctly specified, identifiable model; a true parameter in the interior of the parameter space; sufficient regularity for the maximum-likelihood estimator and likelihood-ratio statistic to have their standard large-sample behavior; and a locally smooth, nonconstant scalar target. The profile interval is therefore not automatically an exact finite-sample interval. With sparse data, separation, or weak information, the approximation may be poor, and the constrained maximization itself needs careful numerical checks.

Wald Intervals and Their Difference

A Wald interval estimates the standard error of the contrast at \(\hat\beta\) and forms a symmetric interval around \(\hat\delta\). If \(\widehat{\operatorname{Var}}(\hat\beta)=\widehat V\), the gradient of the risk difference is \[ g(\beta)=\nabla_\beta\delta(\beta) =p_1(\beta)\{1-p_1(\beta)\}x_1-p_0(\beta)\{1-p_0(\beta)\}x_0. \] The delta method gives the estimated variance \(g(\hat\beta)^\mathsf{T}\widehat V g(\hat\beta)\). This approximation is local: it uses the curvature and gradient near the unrestricted estimate. A profile interval instead re-maximizes the likelihood at every candidate difference, allowing nuisance coefficients to adjust under that constraint.

Worked Example: Comparing Wald and Profile Intervals

Continue with 6 events among 20 control participants and 12 among 20 treated participants. The estimated difference is \(0.60-0.30=0.30\). In this two-group model, the estimated variances of the separate sample proportions are \(0.30(0.70)/20=0.0105\) and \(0.60(0.40)/20=0.0120\). The groups are independent, so the estimated variance of their difference is \(0.0105+0.0120=0.0225\), and its standard error is \(\sqrt{0.0225}=0.15\).

The usual 95% Wald interval is \(0.30\pm1.96(0.15)=0.30\pm0.294\), or approximately \((0.006,\ 0.594)\). It excludes zero by a small margin. In contrast, the profile calculation at zero gave \(R(0)\approx3.696<3.841\), so zero is included in the 95% profile set. Numerically profiling the constrained likelihood gives endpoints approximately \((-0.01,\ 0.57)\) (rounded to two decimal places). The slight disagreement is plausible: the Wald interval uses a local symmetric approximation, while the profile interval is determined by the likelihood away from its maximum. It is not a contradiction in the calculations; the two procedures use different approximations to uncertainty.

Common Mistakes and Interpretation

  • Reporting a coefficient interval as a risk-difference interval. A treatment coefficient is a log odds ratio in this model. To obtain a risk difference, evaluate both risks at the specified covariate settings and subtract them.
  • Holding nuisance coefficients fixed during profiling. A profile likelihood maximizes over all coefficients compatible with the candidate difference. Evaluating the likelihood only at the unrestricted nuisance estimates is not the constrained maximum.
  • Using the wrong direction of subtraction. State which setting is subtracted from which. Reversing the order changes the sign of the risk difference and reverses the interval endpoints.
  • Assuming the profile interval must be symmetric. The likelihood can have different curvature on either side of its maximum, so the two endpoints need not be equally far from \(\hat\delta\).
  • Treating the chi-square cutoff as an exact guarantee. The standard cutoff relies on large-sample regularity. A numerically computed profile interval can still have poor coverage when the data are sparse or the model is weakly identified.

The practical value of profiling is that the interval is tied directly to the likelihood for the requested absolute contrast, while permitting the regression coefficients to adjust to each proposed value. It also makes the modeling choice visible: a risk difference is specific to the two covariate settings, so those settings should be stated when reporting the estimate and interval.

Key takeaway: To obtain a profile likelihood interval for a logistic risk difference, fix a candidate difference between the two specified risks, maximize the likelihood over all compatible coefficients, and retain candidates whose likelihood-ratio statistic is below the chosen cutoff. Compare this result with a Wald interval, but do not confuse the two procedures or their assumptions.

Check Your Understanding

Answer each question using the definitions and likelihood calculations above.

  1. Why can two patients with different covariate settings have different risk differences even when they share the same treatment coefficient?
  2. In the two-group binomial example, what equation determines the constrained estimate of \(q\) for a fixed candidate difference \(d\)?
  3. For the data with 6 of 20 control events and 12 of 20 treated events, does the 95% profile likelihood set include a zero risk difference? Justify your answer using the likelihood-ratio statistic.
  4. What is held fixed, and what is maximized over, when computing the profile likelihood at a candidate difference?
  5. Give one reason a Wald interval and a profile likelihood interval for the same risk difference can have different endpoints.
Clinical Biostats