Tutorials › Generalized Linear Models › Delta-Method Uncertainty for Fitted Risks

Binary Logistic Regression · Tutorial 361 of 981

Delta-Method Uncertainty for Fitted Risks

Learn to propagate coefficient uncertainty through the inverse-logit link to quantify uncertainty in a fitted probability at a fixed covariate profile.

Intermediate 10 min read

What You'll Learn

  • Differentiate the inverse-logit fitted risk with respect to the coefficient vector
  • Calculate a risk standard error from the coefficient covariance matrix
  • Apply the delta method under explicit asymptotic conditions
  • Work through covariance, confidence-interval, and near-boundary examples
  • Distinguish uncertainty in a fitted risk from uncertainty in a future binary outcome

Why a Fitted Risk Has Uncertainty

A logistic model gives a fitted probability for each covariate profile, but that probability is computed using estimated coefficients. If the coefficients would change across repeated samples, the fitted probability would change as well. The delta method translates uncertainty in the coefficient estimates into an approximate standard error for the fitted risk.

The calculation is specific to a fixed covariate profile. It describes uncertainty from estimating the model coefficients, conditional on the chosen covariate values. It does not include the additional randomness of whether a particular future person experiences the binary outcome.

The Fitted Risk and Its Gradient

Let \(\hat{\boldsymbol{\beta}}\) be the estimated coefficient vector of a logistic regression, and let \(\mathbf{x}_0\) be a fixed covariate vector, including the intercept component if the model has an intercept. The fitted linear predictor and risk at this profile are

$$ \hat{\eta}_0=\mathbf{x}_0^{\mathsf T}\hat{\boldsymbol{\beta}}, \qquad \hat{p}_0=\frac{\exp(\hat{\eta}_0)}{1+\exp(\hat{\eta}_0)}. $$

Write \(V_{\hat{\boldsymbol{\beta}}}\) for an estimated covariance matrix of the coefficient estimator. The key derivative is the gradient of the fitted risk as a function of the coefficients.

Definition: For a fixed profile \(\mathbf{x}_0\), define \(h(\boldsymbol{\beta})=\{1+\exp(-\mathbf{x}_0^{\mathsf T}\boldsymbol{\beta})\}^{-1}\). Its gradient is \(\nabla h(\boldsymbol{\beta})=p(\boldsymbol{\beta})\{1-p(\boldsymbol{\beta})\}\mathbf{x}_0\), where \(p(\boldsymbol{\beta})=h(\boldsymbol{\beta})\). The delta-method standard error is the square root of this gradient, evaluated at \(\hat{\boldsymbol{\beta}}\), times \(V_{\hat{\boldsymbol{\beta}}}\) times the gradient transpose.

To verify the derivative, set \(\eta=\mathbf{x}_0^{\mathsf T}\boldsymbol{\beta}\) and \(p=(1+\exp(-\eta))^{-1}\). Differentiation with respect to \(\eta\) gives \(dp/d\eta=p(1-p)\); the chain rule gives \(\nabla h=p(1-p)\mathbf{x}_0\). Therefore the plug-in standard error is

$$ \widehat{\operatorname{SE}}(\hat{p}_0) = \sqrt{ \hat{p}_0^{\,2}(1-\hat{p}_0)^2 \mathbf{x}_0^{\mathsf T} V_{\hat{\boldsymbol{\beta}}} \mathbf{x}_0 }. $$

The quadratic form \(\mathbf{x}_0^{\mathsf T}V_{\hat{\boldsymbol{\beta}}}\mathbf{x}_0\) is the estimated variance of the fitted linear predictor at the profile. The inverse-logit derivative then scales that uncertainty by \(\hat{p}_0(1-\hat{p}_0)\). The full covariance matrix matters: coefficient covariances contribute to the quadratic form, not just the diagonal variances.

Worked Example: A Profile with an Intercept and One Predictor

Suppose the estimated coefficients are \(\hat{\boldsymbol{\beta}}=(-1,0.7)^{\mathsf T}\), and their estimated covariance matrix is

$$ V_{\hat{\boldsymbol{\beta}}} = \begin{pmatrix} 0.0400 & -0.0100\\ -0.0100 & 0.0225 \end{pmatrix}. $$

Find the fitted risk and its delta-method standard error at the profile \(x_0=2\), with covariate vector \(\mathbf{x}_0=(1,2)^{\mathsf T}\).

Fitted risk. The linear predictor is \(\hat{\eta}_0=-1+0.7(2)=0.4\). Thus \(\hat{p}_0=1/(1+\exp(-0.4))=0.59869\), to five decimal places.

Linear-predictor variance. Multiplying out the quadratic form gives

$$ \mathbf{x}_0^{\mathsf T}V_{\hat{\boldsymbol{\beta}}}\mathbf{x}_0 = 0.0400+4(0.0225)+2(1)(2)(-0.0100) =0.0900. $$

The estimated linear-predictor standard error is therefore \(\sqrt{0.09}=0.3\). Since \(\hat{p}_0(1-\hat{p}_0)=0.59869(0.40131)\approx0.24026\), the risk standard error is \(0.24026(0.3)\approx0.07208\). This is the uncertainty in the fitted probability due to coefficient estimation at this fixed profile.

Delta-Method Result and Its Justification

The plug-in formula is an approximation justified by the asymptotic distribution of the coefficient estimator. The following version states the conditions directly. It applies, for example, to a fixed-dimensional, regular logistic regression when the coefficient estimator has the stated asymptotic normality and the estimated covariance matrix consistently estimates its asymptotic covariance on the same scale.

Theorem: Let the coefficient dimension be fixed, let \(\boldsymbol{\beta}_0\) be finite, and let \(\mathbf{x}_0\) be fixed. Suppose \(\sqrt{n}(\hat{\boldsymbol{\beta}}-\boldsymbol{\beta}_0)\xrightarrow{d}N(\mathbf{0},\Sigma)\), where \(\Sigma\) is finite and positive definite, and suppose \(nV_{\hat{\boldsymbol{\beta}}}\xrightarrow{p}\Sigma\). Define \(p_0=h(\boldsymbol{\beta}_0)\), with \(h(\boldsymbol{\beta})=\{1+\exp(-\mathbf{x}_0^{\mathsf T}\boldsymbol{\beta})\}^{-1}\). Then \(\sqrt{n}(\hat{p}_0-p_0)\xrightarrow{d}N(0,\mathbf{a}^{\mathsf T}\Sigma\mathbf{a})\), where \(\mathbf{a}=p_0(1-p_0)\mathbf{x}_0\). If \(\mathbf{a}^{\mathsf T}\Sigma\mathbf{a}>0\), the plug-in standard error consistently estimates the corresponding first-order uncertainty, and the studentized statistic converges in distribution to \(N(0,1)\).

Proof. The inverse-logit function is continuously differentiable at every finite linear predictor. Its gradient at \(\boldsymbol{\beta}_0\) is \(\mathbf{a}=p_0(1-p_0)\mathbf{x}_0\). By differentiability, for \(\boldsymbol{\delta}\) tending to zero, \(h(\boldsymbol{\beta}_0+\boldsymbol{\delta})=h(\boldsymbol{\beta}_0)+\mathbf{a}^{\mathsf T}\boldsymbol{\delta}+r(\boldsymbol{\delta})\), where \(r(\boldsymbol{\delta})/\|\boldsymbol{\delta}\|\to0\). The assumed asymptotic normality implies \(\hat{\boldsymbol{\beta}}-\boldsymbol{\beta}_0=O_p(n^{-1/2})\), so the remainder satisfies \(\sqrt{n}r(\hat{\boldsymbol{\beta}}-\boldsymbol{\beta}_0)=o_p(1)\). Hence

$$ \sqrt{n}(\hat{p}_0-p_0) = \mathbf{a}^{\mathsf T} \sqrt{n}(\hat{\boldsymbol{\beta}}-\boldsymbol{\beta}_0) +o_p(1). $$

The assumed limit distribution and Slutsky’s theorem give the stated normal limit, with variance \(\mathbf{a}^{\mathsf T}\Sigma\mathbf{a}\). Also, \(\hat{\boldsymbol{\beta}}\xrightarrow{p}\boldsymbol{\beta}_0\), so continuity gives \(\nabla h(\hat{\boldsymbol{\beta}})\xrightarrow{p}\mathbf{a}\). Together with \(nV_{\hat{\boldsymbol{\beta}}}\xrightarrow{p}\Sigma\), this implies

$$ n\,\widehat{\operatorname{SE}}(\hat{p}_0)^2 = \nabla h(\hat{\boldsymbol{\beta}})^{\mathsf T} (nV_{\hat{\boldsymbol{\beta}}}) \nabla h(\hat{\boldsymbol{\beta}}) \xrightarrow{p} \mathbf{a}^{\mathsf T}\Sigma\mathbf{a}. $$

When this limit is positive, dividing the asymptotically normal error by its consistent standard-error estimate yields the stated standard normal limit. \(\square\)

A corresponding approximate two-sided confidence interval on the probability scale is \(\hat{p}_0\pm z_{1-\alpha/2}\widehat{\operatorname{SE}}(\hat{p}_0)\), where \(z_{1-\alpha/2}\) is the \(1-\alpha/2\) standard normal quantile. This follows by using the studentized normal approximation. It is an approximation, not an exact finite-sample guarantee.

Worked Example: Why the Covariance Term Matters

Consider \(\hat{\boldsymbol{\beta}}=(0.5,-0.4)^{\mathsf T}\), profile vector \(\mathbf{x}_0=(1,1.5)^{\mathsf T}\), and estimated covariance matrix

$$ V_{\hat{\boldsymbol{\beta}}} = \begin{pmatrix} 0.09 & -0.02\\ -0.02 & 0.01 \end{pmatrix}. $$

The fitted linear predictor is \(0.5-0.4(1.5)=-0.1\), giving \(\hat{p}_0=1/(1+\exp(0.1))\approx0.47502\). The quadratic form, including the off-diagonal terms, is

$$ \mathbf{x}_0^{\mathsf T}V_{\hat{\boldsymbol{\beta}}}\mathbf{x}_0 = 0.09+2.25(0.01)+2(1)(1.5)(-0.02) =0.0525. $$

Thus the linear-predictor standard error is \(\sqrt{0.0525}\approx0.22913\). The risk derivative is \(0.47502(1-0.47502)\approx0.24938\), so the risk standard error is \(0.24938(0.22913)\approx0.05715\).

If the covariance were incorrectly omitted, the quadratic form would be calculated as \(0.09+2.25(0.01)=0.1125\), producing a risk standard error of about \(0.24938\sqrt{0.1125}=0.08363\). That is not the delta-method standard error for the given covariance matrix. In this example, the negative coefficient covariance reduces uncertainty in the linear predictor for this particular profile.

Confidence Intervals and Their Limits

A probability-scale Wald interval is easy to calculate and interpret, but its endpoints are not guaranteed to fall between zero and one. This can happen when the fitted risk is close to a boundary or the standard error is large. A bounded alternative uses the linear predictor: form an interval for \(\eta_0=\mathbf{x}_0^{\mathsf T}\boldsymbol{\beta}\), then apply the inverse-logit to each endpoint. This preserves the probability range, though it is a different interval construction; it does not change the delta-method standard error.

Worked Example: A Wald Interval Near a Boundary

In an intercept-only logistic model, suppose the estimated intercept is \(\hat{\beta}_0=2.5\) with estimated variance \(0.64\). At this profile, \(\hat{\eta}_0=2.5\), so \(\hat{p}_0=1/(1+\exp(-2.5))\approx0.92414\). The inverse-logit derivative is \(0.92414(0.07586)\approx0.07010\), and the intercept standard error is \(\sqrt{0.64}=0.8\). Therefore

$$ \widehat{\operatorname{SE}}(\hat{p}_0) \approx 0.07010(0.8)=0.05608. $$

The 95% probability-scale Wald interval is approximately \(0.92414\pm1.96(0.05608)\), or \((0.8142,1.0341)\). Its upper endpoint exceeds one, so it cannot be a plausible probability interval. For comparison, the linear-predictor interval is \(2.5\pm1.96(0.8)=(0.932,4.068)\). Applying the inverse-logit gives approximately \((0.7176,0.9832)\), which stays within the probability range. Both are approximations; the choice of interval should be reported clearly.

What the Uncertainty Does—and Does Not—Measure

The covariance matrix may come from the model-based inverse information matrix or from another appropriate covariance estimator. The delta-method propagation uses the covariance estimate supplied; it does not decide whether that covariance estimate is suitable for the sampling design or model assumptions. Whatever the source, it must refer to the same coefficient vector and parameterization used to calculate the fitted risk.

The standard error concerns the estimated mean probability at the specified profile. It is not the standard deviation of a future Bernoulli response. If \(Y_{\mathrm{new}}\) is a binary outcome with success probability \(p_0\), its conditional variance is \(p_0(1-p_0)\); that outcome variability is distinct from the sampling uncertainty in \(\hat{p}_0\). The fitted-risk standard error instead quantifies how the estimated model probability would vary across repeated samples.

Common mistake: Treating the coefficient standard errors separately, multiplying each one by the corresponding profile value, and combining them while ignoring coefficient covariances. The correction is to use the complete quadratic form \(\mathbf{x}_0^{\mathsf T}V_{\hat{\boldsymbol{\beta}}}\mathbf{x}_0\), then multiply its square root by \(\hat{p}_0(1-\hat{p}_0)\). Also avoid interpreting the resulting standard error as outcome-level randomness: it is uncertainty in the fitted risk at a fixed profile.

Key takeaway: For a fixed covariate profile, first calculate the estimated linear-predictor variance with the full coefficient covariance matrix. Then scale its standard error by the inverse-logit slope, \(\hat{p}_0(1-\hat{p}_0)\), to obtain the delta-method standard error for the fitted risk.

Check Your Understanding

Use the definitions and results above to answer these questions.

  1. Why does the gradient of a fitted logistic risk contain both the profile vector and the factor \(p(1-p)\)?
  2. For a fixed profile, what does the quadratic form \(\mathbf{x}_0^{\mathsf T}V_{\hat{\boldsymbol{\beta}}}\mathbf{x}_0\) measure?
  3. Why can omitting coefficient covariances produce an incorrect fitted-risk standard error?
  4. What regularity and covariance-estimation conditions support the stated delta-method limit?
  5. How does uncertainty in a fitted probability differ from the variance of a future binary outcome?
Clinical Biostats