Tutorials › Multivariate Statistics (Graduate) › Binary LDA Posterior Odds And Logistic Regression

Discriminant Analysis Theory · Tutorial 594 of 975

Binary LDA Posterior Odds And Logistic Regression

Learn how common-covariance Gaussian class distributions produce linear posterior log-odds and identify the corresponding logistic-regression coefficients.

Intermediate 10 min read

What You'll Learn

  • State the assumptions for the exact binary LDA posterior-odds result
  • Derive the log-likelihood ratio by expanding the Gaussian quadratic forms
  • Identify the logistic-regression intercept and slope vector
  • Calculate posterior odds and probabilities at specified feature values
  • Express the intercept using the midpoint of the two class means
  • Distinguish the conditional logistic model from how its parameters are estimated

Why Binary LDA Has Logistic Posterior Odds

Linear discriminant analysis (LDA) and logistic regression are often introduced as different approaches to classification. In the two-class Gaussian model with a shared covariance matrix, however, the conditional probability of the class label given the features has an exact logistic form. The result comes from taking a ratio of the two class densities: the quadratic terms in the features cancel, leaving a linear function.

That identity concerns the probability model, not automatically the method used to estimate its parameters. LDA models the class-conditional feature distributions and class probabilities; logistic regression models the conditional class probability directly. Under the assumptions below, the former implies a logistic conditional model.

Definition: Let \(Y\in\{0,1\}\) be a class label and let \(X\in\mathbb{R}^p\) be a feature vector. Write \(\pi_k=P(Y=k)\), and suppose \(\pi_0,\pi_1>0\). Binary LDA assumes \(X\mid Y=k\sim N(\mu_k,\Sigma)\), for \(k=0,1\), where \(\mu_k\in\mathbb{R}^p\) and the shared covariance matrix \(\Sigma\) is positive definite. The positive-definiteness assumption ensures that both class distributions have nonsingular Gaussian densities.

Write \(Q=\Sigma^{-1}\), and use \(x\) for a possible observed feature vector. Logistic regression uses the convention \(\log\{P(Y=1\mid X=x)/P(Y=0\mid X=x)\}=\beta_0+x^\mathsf{T}\beta\). The intercept is \(\beta_0\), and \(\beta\in\mathbb{R}^p\) is the slope vector.

Deriving the Linear Log-Odds

Bayes' rule expresses the posterior odds as the prior odds multiplied by a likelihood ratio: \[ \frac{P(Y=1\mid X=x)}{P(Y=0\mid X=x)} =\frac{\pi_1}{\pi_0}\frac{f_1(x)}{f_0(x)}, \] where \(f_k\) is the density of \(X\mid Y=k\). Each Gaussian density has the same determinant factor and the same quadratic term in \(x\), apart from its class mean. Taking the log makes the cancellation visible.

Theorem: Under the binary LDA assumptions above, the posterior log-odds are \[ \log\frac{P(Y=1\mid X=x)}{P(Y=0\mid X=x)} =\beta_0+x^\mathsf{T}\beta, \] where \[ \beta=\Sigma^{-1}(\mu_1-\mu_0),\qquad \beta_0=\log\frac{\pi_1}{\pi_0} -\frac12\left(\mu_1^\mathsf{T}\Sigma^{-1}\mu_1- \mu_0^\mathsf{T}\Sigma^{-1}\mu_0\right). \] Consequently, with \(\sigma(t)=1/(1+\exp(-t))\), \(P(Y=1\mid X=x)=\sigma(\beta_0+x^\mathsf{T}\beta)\).

Proof. The class-\(k\) density is \[ f_k(x)=(2\pi)^{-p/2}|\Sigma|^{-1/2} \exp\left\{-\frac12(x-\mu_k)^\mathsf{T}Q(x-\mu_k)\right\}. \] The common normalizing factor cancels in the ratio. Therefore, \[ \begin{aligned} \log\frac{P(Y=1\mid X=x)}{P(Y=0\mid X=x)} &=\log\frac{\pi_1}{\pi_0}+\log\frac{f_1(x)}{f_0(x)}\\ &=\log\frac{\pi_1}{\pi_0} -\frac12\left\{(x-\mu_1)^\mathsf{T}Q(x-\mu_1) -(x-\mu_0)^\mathsf{T}Q(x-\mu_0)\right\}. \end{aligned} \] Because \(Q\) is symmetric, expansion gives \[ (x-\mu_k)^\mathsf{T}Q(x-\mu_k) =x^\mathsf{T}Qx-2x^\mathsf{T}Q\mu_k+\mu_k^\mathsf{T}Q\mu_k. \] Subtracting the \(k=0\) expression from the \(k=1\) expression cancels \(x^\mathsf{T}Qx\). The remaining terms yield \[ \log\frac{P(Y=1\mid X=x)}{P(Y=0\mid X=x)} =\log\frac{\pi_1}{\pi_0} +x^\mathsf{T}Q(\mu_1-\mu_0) -\frac12\left(\mu_1^\mathsf{T}Q\mu_1-\mu_0^\mathsf{T}Q\mu_0\right). \] This is the stated affine function, with the stated coefficients. If its value is \(\eta\), the odds equal \(\exp(\eta)\). For a probability \(p\), odds are \(p/(1-p)\), so solving \(p/(1-p)=\exp(\eta)\) gives \(p=1/(1+\exp(-\eta))\). \(\square\)

Reading the Coefficients and the Intercept

The slope vector is the difference in class means, transformed by the inverse covariance. Thus it is not generally just the raw difference \(\mu_1-\mu_0\): shared covariance affects the direction and scale of the linear predictor. The intercept combines the prior log-odds with a term determined by the locations of the two means relative to the covariance geometry.

A useful equivalent expression centers the predictor at the midpoint \(m=(\mu_1+\mu_0)/2\). Since \(Q\) is symmetric, \[ \beta^\mathsf{T}m =\frac12(\mu_1-\mu_0)^\mathsf{T}Q(\mu_1+\mu_0) =\frac12(\mu_1^\mathsf{T}Q\mu_1-\mu_0^\mathsf{T}Q\mu_0). \] Consequently, the linear predictor has the compact form \[ \eta(x)=\log\frac{\pi_1}{\pi_0}+\beta^\mathsf{T}(x-m). \] In particular, at the midpoint the posterior log-odds equal the prior log-odds. This is a check on calculations, not a claim that the two class densities are equal at every point on a geometric midpoint in an arbitrary coordinate-wise sense.

Result: For any real threshold \(c\), the condition \(P(Y=1\mid X=x)>c\), with \(0<c<1\), is equivalent to \[ \beta_0+x^\mathsf{T}\beta>\log\frac{c}{1-c}. \] Indeed, the logistic function is strictly increasing, and its inverse on \((0,1)\) is \(c\mapsto\log\{c/(1-c)\}\). In particular, posterior probability above \(1/2\) corresponds to positive log-odds.

The equivalence follows directly: \(P(Y=1\mid X=x)=\sigma(\eta(x))\), and applying the increasing inverse-logit to both sides preserves the inequality. This connects posterior-probability cutoffs to thresholds on the linear predictor. A classification decision may use a different threshold when the decision rule incorporates unequal costs; that changes the decision cutoff, not the posterior-odds identity.

Worked Example: A One-Dimensional Midpoint Check

Suppose \(Y\in\{0,1\}\), \(X\mid Y=0\sim N(1,1)\), \(X\mid Y=1\sim N(3,1)\), and the priors are \(\pi_0=7/10\) and \(\pi_1=3/10\). Find the log-odds and posterior probability at \(x=2\).

The common variance is \(1\), so \(Q=1\), and the slope is \(\beta=(3-1)/1=2\). The intercept is \[ \beta_0=\log\frac{3/10}{7/10}-\frac12(3^2-1^2) =\log\frac37-4. \] Thus \(\eta(x)=\log(3/7)+2x-4=\log(3/7)+2(x-2)\). At \(x=2\), \(\eta(2)=\log(3/7)\), so the posterior odds are \(3/7\), not \((3/7)\exp(-1)\).

The posterior probability is therefore \[ P(Y=1\mid X=2)=\frac{3/7}{1+3/7}=\frac{3}{10}=0.300. \] This agrees with the density calculation: the two class means are equally far from 2, and the variances are equal, so \(f_1(2)=f_0(2)\). The likelihood ratio is 1; posterior odds equal prior odds.

Worked Example: Computing Multivariate Logistic Coefficients

Let \(\mu_0=(0,0)^\mathsf{T}\), \(\mu_1=(2,1)^\mathsf{T}\), and \(\Sigma=\begin{pmatrix}4&0\\0&1\end{pmatrix}\). Let \(\pi_0=3/4\) and \(\pi_1=1/4\). Find the logistic coefficients and the posterior probability at \(x=(2,0)^\mathsf{T}\).

Here \(Q=\operatorname{diag}(1/4,1)\), so \[ \beta=Q(\mu_1-\mu_0) =\begin{pmatrix}1/4&0\\0&1\end{pmatrix} \begin{pmatrix}2\\1\end{pmatrix} =\begin{pmatrix}1/2\\1\end{pmatrix}. \] Also, \(\mu_1^\mathsf{T}Q\mu_1=2^2/4+1^2=2\), while \(\mu_0^\mathsf{T}Q\mu_0=0\). Therefore \[ \beta_0=\log\frac{1/4}{3/4}-\frac12(2-0) =\log\frac13-1. \] At \(x=(2,0)^\mathsf{T}\), the linear predictor is \[ \eta(x)=\log\frac13-1+\frac12(2)+1(0)=\log\frac13. \] The odds are \(1/3\), and the probability is \( (1/3)/(1+1/3)=1/4=0.25\).

The feature vector lies on the equal-density boundary in this calculation: the log likelihood ratio is \(x^\mathsf{T}\beta-\tfrac12\mu_1^\mathsf{T}Q\mu_1=1-1=0\). Hence its posterior odds are just the prior odds \(1/3\), as obtained from the coefficients.

Worked Example: A Correlated Covariance and Centered Intercept

Suppose \(\mu_0=(1,0)^\mathsf{T}\), \(\mu_1=(3,2)^\mathsf{T}\), \(\Sigma=\begin{pmatrix}2&1\\1&2\end{pmatrix}\), and the two classes have equal prior probabilities. Calculate the coefficients and the posterior probability at the midpoint of the means.

The determinant of \(\Sigma\) is \(4-1=3\), giving \[ Q=\Sigma^{-1}=\frac13\begin{pmatrix}2&-1\\-1&2\end{pmatrix}. \] The mean difference is \((2,2)^\mathsf{T}\); multiplication gives \[ \beta=Q(\mu_1-\mu_0) =\frac13\begin{pmatrix}2&-1\\-1&2\end{pmatrix} \begin{pmatrix}2\\2\end{pmatrix} =\begin{pmatrix}2/3\\2/3\end{pmatrix}. \] For the intercept, \(Q\mu_1=(4/3,1/3)^\mathsf{T}\), so \(\mu_1^\mathsf{T}Q\mu_1=3(4/3)+2(1/3)=14/3\). Also, \(Q\mu_0=(2/3,-1/3)^\mathsf{T}\), so \(\mu_0^\mathsf{T}Q\mu_0=2/3\). The prior log-odds are zero, and hence \[ \beta_0=-\frac12\left(\frac{14}{3}-\frac{2}{3}\right)=-2. \] The midpoint is \(m=(2,1)^\mathsf{T}\). Its linear predictor is \(\eta(m)=-2+(2/3)(2)+(2/3)(1)=0\), so \(P(Y=1\mid X=m)=\sigma(0)=1/2\).

What the Equivalence Does—and Does Not—Say

The derived coefficients are the coefficients of the conditional probability model implied by the Gaussian assumptions. They give an exact logistic regression form when the class-conditional distributions are Gaussian with a common, positive-definite covariance and both priors are positive. If the covariances differ, the log-density ratio generally contains quadratic terms in \(x\); the exact linear-logit conclusion need not hold.

The equivalence does not say that fitting LDA and fitting logistic regression to the same finite training sample must produce identical numerical estimates. LDA estimates class-conditional means, a shared covariance, and class proportions; logistic regression estimates the conditional model through its own likelihood. Their population conditional form can coincide while their estimates, finite-sample behavior, and modeling assumptions differ.

Common Pitfall: Forgetting the Likelihood Ratio

A frequent error is to use the prior odds at a feature value where the class densities are not equal—or, conversely, to add a nonzero likelihood-ratio term at a point where those densities are equal. The posterior odds are not simply the prior odds in general: they are prior odds multiplied by \(f_1(x)/f_0(x)\). For the first example, at \(x=2\) the densities are equal, so that multiplier is exactly 1. The log-odds are \(\log(3/7)\), and the probability is \(0.300\). Multiplying the prior odds by an extra factor such as \(\exp(-1)\) contradicts the density ratio and changes the result.

A second useful check is to calculate the log-likelihood ratio separately: \[ \log\frac{f_1(x)}{f_0(x)} =x^\mathsf{T}\Sigma^{-1}(\mu_1-\mu_0) -\frac12\left(\mu_1^\mathsf{T}\Sigma^{-1}\mu_1- \mu_0^\mathsf{T}\Sigma^{-1}\mu_0\right). \] Then add \(\log(\pi_1/\pi_0)\). Keeping these two contributions distinct makes sign errors in the intercept easier to detect.

Check Your Understanding

Use the shared-covariance Gaussian assumptions unless a question says otherwise.

  1. State the assumptions that ensure the binary LDA posterior log-odds are an affine function of the feature vector.
  2. For given means and covariance \(\Sigma\), what is the logistic slope vector? Why is it generally not just the difference between the means?
  3. At a point where \(f_1(x)=f_0(x)\), how do posterior odds relate to prior odds?
  4. Explain why unequal class covariances can introduce quadratic terms into the log-odds.
  5. Does the exact logistic form imply that fitted LDA and logistic-regression coefficients from a finite sample must agree? Explain.
Clinical Biostats