Tutorials › Econometrics (Graduate) › Bernoulli Likelihood Scores for Logit and Probit

Binary Choice Models · Tutorial 458 of 952

Bernoulli Likelihood Scores for Logit and Probit

Learn to construct and differentiate the Bernoulli likelihood for logit and probit models, then interpret the resulting score equations in maximum-likelihood estimation.

Intermediate 10 min read

What You'll Learn

  • Write an observation’s Bernoulli log-likelihood and combine contributions across independent observations.
  • Derive the general score contribution from a binary-response probability.
  • Simplify the score for logit and express it for probit.
  • Calculate observation-level and sample-level score contributions.
  • Explain how score equations enter maximum-likelihood estimation and why a score root needs verification.

Why Work With Observation-Level Scores?

A binary-response model assigns a conditional probability to each observed outcome. Maximum-likelihood estimation chooses parameters that make the observed outcomes collectively more likely under the model. The key calculation is therefore the contribution each observation makes to the log-likelihood, and how that contribution changes as the parameters change. Those derivatives are the observation-level score contributions.

Keeping the contributions separate is useful for understanding the total score, checking a gradient, and seeing which observations push an estimate in which direction. Logit and probit use different probability functions, but both begin with the same Bernoulli likelihood structure.

Model and Bernoulli Log-Likelihood

For observation \(i\), let \(Y_i\) be a binary outcome taking values 0 or 1, and let \(\boldsymbol{x}_i\) be a \(k\)-component vector of observed covariates, including an intercept if the model specifies one. Write \(\boldsymbol{\beta}\) for the \(k\)-component parameter vector and \(\eta_i=\boldsymbol{x}_i^\mathsf{T}\boldsymbol{\beta}\) for the index. Conditional on the covariates, assume \(Y_i\) is Bernoulli with success probability \(p_i\), determined by the chosen link. For the likelihood across observations, assume the outcomes are conditionally independent given their covariates and the parameters.

Definition: For a binary observation \(y_i\in\{0,1\}\) with modeled probability \(p_i=P(Y_i=1\mid\boldsymbol{x}_i)\), its Bernoulli likelihood contribution is \(p_i^{y_i}(1-p_i)^{1-y_i}\). Its log-likelihood contribution is \(\ell_i(\boldsymbol{\beta})=y_i\log p_i+(1-y_i)\log(1-p_i)\).

If \(y_i=1\), the contribution is \(\log p_i\); if \(y_i=0\), it is \(\log(1-p_i)\). Conditional independence means the sample likelihood is the product of the individual contributions. Taking logarithms turns that product into a sum:

$$ L(\boldsymbol{\beta})=\prod_{i=1}^{n}p_i^{y_i}(1-p_i)^{1-y_i}, \qquad \ell(\boldsymbol{\beta})=\sum_{i=1}^{n}\ell_i(\boldsymbol{\beta}). $$

Here \(L\) denotes the likelihood and \(\ell\) the log-likelihood. In both models, \(p_i=F(\eta_i)\), where \(F\) is the specified response function. For logit, \(F(\eta)=1/(1+\exp(-\eta))\); for probit, \(F(\eta)=\Phi(\eta)\), the standard normal cumulative distribution function. In the probit score, \(\phi\) denotes the standard normal density.

Deriving the General Score Contribution

The observation-level score is the vector of derivatives of \(\ell_i\) with respect to \(\boldsymbol{\beta}\). First differentiate with respect to \(p_i\), then use the chain rule through \(p_i=F(\eta_i)\) and \(\eta_i=\boldsymbol{x}_i^\mathsf{T}\boldsymbol{\beta}\). The derivative of \(\eta_i\) with respect to \(\boldsymbol{\beta}\) is \(\boldsymbol{x}_i\).

$$ \frac{\partial \ell_i}{\partial p_i} =\frac{y_i}{p_i}-\frac{1-y_i}{1-p_i} =\frac{y_i-p_i}{p_i(1-p_i)}. $$

Let \(f(\eta)=F'(\eta)\). Since \(\partial p_i/\partial\boldsymbol{\beta}=f(\eta_i)\boldsymbol{x}_i\), the chain rule gives the general result:

$$ \boldsymbol{s}_i(\boldsymbol{\beta}) =\frac{\partial\ell_i}{\partial\boldsymbol{\beta}} =\boldsymbol{x}_i\, \frac{f(\eta_i)(y_i-p_i)}{p_i(1-p_i)}. $$

This expression applies when the modeled probability is differentiable and strictly between 0 and 1. Its scalar factor depends on the observed outcome and the link; the covariate vector determines how that scalar becomes a contribution to each parameter’s score.

Logit and Probit Score Contributions

For logit, \(f(\eta_i)=p_i(1-p_i)\). Those factors cancel in the general score, giving a particularly simple contribution. For probit, \(f(\eta_i)=\phi(\eta_i)\), and the probability terms remain in the denominator.

$$ \begin{aligned} \text{Logit:}\qquad \boldsymbol{s}_i(\boldsymbol{\beta}) &=\boldsymbol{x}_i(y_i-p_i),\\[4pt] \text{Probit:}\qquad \boldsymbol{s}_i(\boldsymbol{\beta}) &=\boldsymbol{x}_i\, \frac{\phi(\eta_i)\{y_i-\Phi(\eta_i)\}} {\Phi(\eta_i)\{1-\Phi(\eta_i)\}}. \end{aligned} $$

In logit, an observation with \(y_i=1\) contributes a positive multiple of \(\boldsymbol{x}_i\) when its fitted probability is below 1; an observation with \(y_i=0\) contributes a negative multiple when its fitted probability is above 0. This sign description concerns the scalar multiplier: individual components also depend on the signs of the covariates. In probit, the same residual \(y_i-p_i\) appears, but the density and probability factors rescale the contribution.

Worked Example: A Logit Score for One Observation

Suppose a hypothetical observation has \(y_i=1\), \(\boldsymbol{x}_i=(1,2)^\mathsf{T}\), and current parameters \(\boldsymbol{\beta}=(0,0.2)^\mathsf{T}\). Then \(\eta_i=0+2(0.2)=0.4\), and the logit probability is \(p_i=1/(1+\exp(-0.4))\approx0.598688\).

The log-likelihood contribution is \(\ell_i=\log(0.598688)\approx-0.5130\). The logit score is \(\boldsymbol{s}_i=\boldsymbol{x}_i(y_i-p_i)\), so substitution gives \((1,2)^\mathsf{T}(1-0.598688)\).

Thus \(\boldsymbol{s}_i\approx(0.401312,0.802624)^\mathsf{T}\). The first component is the contribution to the intercept score and the second is the contribution to the slope score. Both are positive because this observation has \(y_i=1\) and its fitted probability is below 1.

Worked Example: A Probit Score for One Observation

For a hypothetical observation, let \(y_i=0\), \(\boldsymbol{x}_i=(1,2)^\mathsf{T}\), and \(\eta_i=0.4\). Then \(p_i=\Phi(0.4)\approx0.655422\), \(1-p_i\approx0.344578\), and \(\phi(0.4)\approx0.368270\). The observed outcome’s log-likelihood contribution is \(\log(1-p_i)\approx-1.0655\).

For \(y_i=0\), the scalar multiplying \(\boldsymbol{x}_i\) in the probit score is \[ \frac{\phi(0.4)(0-0.655422)} {0.655422(0.344578)} =-\frac{\phi(0.4)}{1-\Phi(0.4)} \approx-1.06876. \]

Therefore \(\boldsymbol{s}_i\approx(-1.06876,-2.13751)^\mathsf{T}\). The negative signs reflect that the observed zero is below the fitted success probability. The two components differ by a factor of 2 because the second covariate is 2 while the intercept covariate is 1.

From Individual Scores to Maximum Likelihood

Because the sample log-likelihood is a sum, its score is also a sum of observation-level score contributions:

$$ \boldsymbol{S}(\boldsymbol{\beta}) =\frac{\partial\ell(\boldsymbol{\beta})}{\partial\boldsymbol{\beta}} =\sum_{i=1}^{n}\boldsymbol{s}_i(\boldsymbol{\beta}). $$

For an interior, finite maximum at which the log-likelihood is differentiable, a necessary first-order condition is \(\boldsymbol{S}(\widehat{\boldsymbol{\beta}})=\boldsymbol{0}\). Maximum-likelihood software typically searches for a parameter vector satisfying this condition, using the score together with curvature information and numerical optimization methods. A zero score alone does not establish that the point is a maximum: it could be a minimum or another stationary point, and numerical convergence should be checked against the likelihood and other diagnostics.

Worked Example: Summed Logit Score and a Newton Update

Consider three hypothetical binary outcomes \(y=(1,1,0)\) with an intercept-only logit model. At the current value \(\beta=0.6667\), all three fitted probabilities are \(p=1/(1+\exp(-0.6667))\approx0.660764\). The individual logit score contributions are \(y_i-p\), so they are approximately \(0.339236\), \(0.339236\), and \(-0.660764\).

Adding them gives the sample score \(S=2-3p\approx2-3(0.660764)=0.01771\). The score is slightly positive, so the likelihood is locally increasing as \(\beta\) increases at this current value.

For this intercept-only example, differentiating the score \(S(\beta)=\sum_i(y_i-p)\) gives \(H(\beta)=-3p(1-p)\). At the stated value, \(H\approx-3(0.660764)(0.339236)=-0.67247\). A Newton update for maximizing the log-likelihood is \(\beta_{\mathrm{new}}=\beta-S/H\), hence \[ \beta_{\mathrm{new}}\approx0.6667-\frac{0.01771}{-0.67247} \approx0.6930. \]

This is one numerical update, not a claim that the updated value is the final estimate. An estimation routine would continue iterating and check convergence. The negative curvature here is consistent with a local maximum in this one-parameter example, but the score equation and curvature must be considered in the fitted model as a whole.

A Useful Score Check and a Common Pitfall

Under the stated model, the score has conditional expectation zero at the true parameter. For a single observation, conditional on \(\boldsymbol{x}_i\), the probability that \(Y_i=1\) is \(p_i\), so \(E(Y_i-p_i\mid\boldsymbol{x}_i)=p_i-p_i=0\). The general score formula therefore has conditional expectation zero as well, provided its probability factors are defined. This is a useful theoretical check on the score expression; it does not mean each realized observation has a zero score.

A common mistake is to use the logit simplification \(\boldsymbol{x}_i(y_i-p_i)\) for probit because both models have a residual \(y_i-p_i\). That drops the probit rescaling factor \(\phi(\eta_i)/[p_i(1-p_i)]\). The correction is to differentiate the specific response function: its derivative cancels the Bernoulli denominator for logit, but not for probit. Another mistake is to treat a small total score as proof of a valid maximum. It is a first-order condition; likelihood behavior and convergence still require checking.

Key takeaway: Each binary observation contributes \(y_i\log p_i+(1-y_i)\log(1-p_i)\) to the log-likelihood. Its score is \(\boldsymbol{x}_i(y_i-p_i)\) for logit, while probit additionally scales that residual by \(\phi(\eta_i)/[p_i(1-p_i)]\). Summing these contributions produces the score used in maximum-likelihood estimation.

Check Your Understanding

Use the definitions and formulas above to answer each question.

  1. Write the Bernoulli log-likelihood contribution when \(y_i=0\), and explain why it reduces to that expression.
  2. For logit, what feature of the response function makes the score simplify to \(\boldsymbol{x}_i(y_i-p_i)\)?
  3. For probit, identify the scalar multiplying \(\boldsymbol{x}_i\) in the observation-level score.
  4. Why does conditional independence allow the sample score to be written as a sum of observation-level scores?
  5. Why does satisfying the score equation not, by itself, prove that an estimate is a maximum of the log-likelihood?
Clinical Biostats