Tutorials › Generalized Linear Models › Intercept-Only Logistic Regression

Binary Logistic Regression · Tutorial 350 of 981

Intercept-Only Logistic Regression

Learn why the intercept-only logistic fit reproduces the observed event proportion and how to handle proportions at the boundaries.

Intermediate 10 min read

What You'll Learn

  • Write the Bernoulli likelihood for an intercept-only logistic model
  • Derive the maximum-likelihood estimate from the score equation
  • Express the finite intercept estimate as the logit of the event proportion
  • Calculate the common fitted risk for every observation
  • Distinguish boundary probability estimates from finite logistic coefficient estimates

Why the Intercept-Only Model Has a Simple Fit

A logistic regression model can estimate event probabilities from predictors. In an intercept-only model, there are no predictors: the model assigns the same event probability to every observation. This simple case gives a direct link between maximum likelihood and the observed event proportion. It also makes an important limitation visible: if every observed outcome is the same, the likelihood has no maximizing finite intercept.

The derivation below assumes a fixed sample of \(n\) independent binary outcomes with a common event probability. Independence and a common probability are substantive model assumptions; the algebra does not make them true for a particular data set.

Definition: Let \(Y_1,\ldots,Y_n\) be independent Bernoulli random variables with \(P(Y_i=1)=p\) for every \(i\), where \(0<p<1\). The intercept-only logistic model specifies \( \operatorname{logit}(p)=\beta_0 \), where \( \operatorname{logit}(p)=\log\{p/(1-p)\} \). Equivalently, \( p=\exp(\beta_0)/\{1+\exp(\beta_0)\} \). The observed event count is \(y=\sum_{i=1}^n y_i\), and the observed event proportion is \(\bar y=y/n\).

For any finite value of \(\beta_0\), the logistic function gives \(0<p<1\). The coefficient \(\beta_0\) is therefore a convenient one-to-one parameterization of the possible probabilities strictly inside the unit interval. The intercept-only fit is the maximum-likelihood choice of this common probability, expressed on the logit scale.

Likelihood and the Interior Maximum

For a realized outcome \(y_i\in\{0,1\}\), its Bernoulli probability is \(p^{y_i}(1-p)^{1-y_i}\). Independence makes the joint likelihood the product of these contributions. Since the sum of the \(y_i\)'s is \(y\), the likelihood can be written using only the event count:

$$ L(\beta_0) =\prod_{i=1}^n p^{y_i}(1-p)^{1-y_i} =p^y(1-p)^{n-y} =\frac{\exp(y\beta_0)}{\{1+\exp(\beta_0)\}^n}. $$

The log-likelihood is \( \ell(\beta_0)=y\beta_0-n\log\{1+\exp(\beta_0)\} \). Differentiating with respect to the intercept gives the score. The second derivative shows that the log-likelihood is strictly concave for every finite \(\beta_0\):

$$ \frac{d\ell}{d\beta_0}=y-np, \qquad \frac{d^2\ell}{d\beta_0^2}=-np(1-p)<0. $$
Theorem: If \(0<y<n\), the intercept-only logistic likelihood has a unique finite maximum-likelihood estimate. It is \( \hat p=y/n \) and \( \hat\beta_0=\log\{y/(n-y)\}=\operatorname{logit}(y/n) \).

Proof. Under \(0<y<n\), the score equation \(y-np=0\) has the solution \(p=y/n\), which lies strictly between zero and one. Because the logistic map takes each finite \(\beta_0\) to exactly one such \(p\), this probability corresponds to the finite value \( \hat\beta_0=\log\{(y/n)/(1-y/n)\}=\log\{y/(n-y)\} \). At that value the first derivative is zero. The second derivative is strictly negative at every finite \(\beta_0\), so the log-likelihood is strictly concave and its stationary point is its unique global maximum. Thus the likelihood maximum is attained at the stated estimates. \(\square\)

The same conclusion can be checked directly on the probability scale. For \(0<p<1\), the log-likelihood, omitting no parameter-dependent terms, is \( \ell(p)=y\log(p)+(n-y)\log(1-p) \). Its derivative is \(y/p-(n-y)/(1-p)\). Setting this equal to zero yields \(y(1-p)=(n-y)p\), and hence \(p=y/n\). This alternative calculation gives the same estimate without first using the logit parameterization.

Worked Example: Likelihood and the Estimated Intercept

Suppose \(n=12\) independent patients each have a binary outcome, with \(y=7\) events and 5 non-events. Under the common-probability model, the likelihood for the observed individual outcomes is \(L(p)=p^7(1-p)^5\). Its log-likelihood is \( \ell(p)=7\log(p)+5\log(1-p) \).

Differentiate and solve the likelihood equation: \( d\ell/dp=7/p-5/(1-p)=0 \). Multiplying by the positive quantity \(p(1-p)\) gives \(7(1-p)-5p=0\), so \(7=12p\) and \( \hat p=7/12\approx0.5833 \).

The maximum-likelihood intercept is \( \hat\beta_0=\log\{(7/12)/(5/12)\}=\log(7/5)\approx0.3365 \). Substituting the estimate into the likelihood gives \( L(\hat p)=(7/12)^7(5/12)^5\approx0.000289 \). This likelihood value is the probability of this particular ordered outcome pattern under the fitted model. If the data are represented only by the event count, the binomial likelihood includes the additional factor \(\binom{12}{7}=792\); that factor does not depend on \(p\), so it does not change the maximizing estimate.

What the Fitted Values Look Like

In an intercept-only model, there are no covariates to make fitted probabilities differ across observations. Once \(\hat\beta_0\) is found, every observation receives the same fitted risk, obtained by applying the logistic function to that intercept. For an interior event proportion, this risk equals the observed event proportion.

$$ \hat p_i =\frac{\exp(\hat\beta_0)}{1+\exp(\hat\beta_0)} =\frac{\exp\{\log(y/(n-y))\}}{1+\exp\{\log(y/(n-y))\}} =\frac{y}{n}, \qquad i=1,\ldots,n. $$

Worked Example: Common Fitted Risk

In a sample of 30 patients, 18 experience the event. The observed proportion is \( \bar y=18/30=0.60 \), so the estimated intercept is \( \hat\beta_0=\log\{18/(30-18)\}=\log(1.5)\approx0.4055 \).

For each of the 30 patients, the fitted risk is \( \hat p_i=\exp(0.4055)/\{1+\exp(0.4055)\} \). Using the unrounded value \(\exp(\hat\beta_0)=1.5\), this becomes \(1.5/(1+1.5)=1.5/2.5=0.60\). Every fitted value is therefore \(0.60\); none is individualized, because the model contains no predictors. The fitted expected event count is \(30(0.60)=18\), equal to the observed count.

This equality between the observed and fitted event counts also follows from the score equation: at the interior maximum, \(y-n\hat p=0\). It is a consequence of fitting the intercept by maximum likelihood, not evidence that the model has identified which particular individuals will experience the event.

Boundary Proportions and No Finite Intercept

The formula for the finite intercept contains \(y\) and \(n-y\) in its logarithm. It applies only when there is at least one event and at least one non-event. If \(y=0\) or \(y=n\), the maximizing probability on the closed interval from zero to one is a boundary value, but a finite logistic intercept cannot produce either probability.

Theorem: If \(n>0\) and \(y=0\), the likelihood has supremum \(1\) as \(p\) decreases to zero, but no finite \(\beta_0\) attains it. If \(y=n\), the likelihood has supremum \(1\) as \(p\) increases to one, again with no finite \(\beta_0\) attaining it. Thus there is no finite maximum-likelihood estimate of the intercept in either boundary case.

Proof. If \(y=0\), then \(L(p)=(1-p)^n\). For every allowed \(p\in(0,1)\), \(0<L(p)<1\), while \(L(p)\) tends to 1 as \(p\) decreases to zero. Since the logistic function gives \(p\to0\) only as \(\beta_0\to-\infty\), no finite intercept attains the supremum. If \(y=n\), then \(L(p)=p^n\). For every \(p\in(0,1)\), \(0<L(p)<1\), and \(L(p)\) tends to 1 as \(p\) increases to one. This limit corresponds to \(\beta_0\to+\infty\), not to a finite intercept. In both cases the likelihood can be made arbitrarily close to its supremum, but no finite parameter value maximizes it. \(\square\)

Worked Example: All Outcomes Are Non-Events

Suppose \(n=8\) and all eight observed outcomes are zero, so \(y=0\). The likelihood is \(L(p)=(1-p)^8\). At \(p=0.20\), it is \(0.8^8\approx0.1678\); at \(p=0.05\), it is \(0.95^8\approx0.6634\). Decreasing \(p\) moves the likelihood upward toward 1.

The score with respect to the finite intercept is \(d\ell/d\beta_0=y-np=-8p<0\) for every finite \(\beta_0\), so increasing the intercept decreases the log-likelihood and decreasing it increases the log-likelihood. The likelihood approaches 1 only as \(\beta_0\to-\infty\). Reporting \(\hat p=0\) describes the boundary probability limit, but it is not the logistic fit from a finite estimated intercept.

Common Pitfalls and Practical Meaning

  • Using the interior formula at a boundary. Substituting \(y=0\) into \(\log\{y/(n-y)\}\) does not give a finite estimate. The correct conclusion is that the likelihood supremum occurs as the intercept tends to negative infinity. When \(y=n\), it tends to positive infinity.
  • Confusing an observed proportion with a universal risk. The fitted risk is \(y/n\) under the assumed common-probability model. It need not equal the event probability in another population or in a setting where the model assumptions fail.
  • Thinking the model predicts different individuals differently. With only an intercept, every observation has the same fitted probability. Variation in the observed binary outcomes remains, but the model has no information in predictors with which to assign different risks.
  • Dropping the independence or common-probability assumptions. The likelihood product and its reduction to \(p^y(1-p)^{n-y}\) use those assumptions. Correlated outcomes or differing event probabilities require a different likelihood argument.

This result is useful as a baseline for logistic regression: it shows exactly what maximum likelihood does when there is no predictor information, and it provides a basic check on software output. With both outcomes represented, the fitted probability must match the event proportion, apart from rounding. A reported finite intercept alongside an all-zero or all-one response warrants careful inspection of what model and data were actually fitted.

Check Your Understanding

Use the assumptions and results in this tutorial to answer the following.

  1. For \(n=20\) and \(y=6\), find the fitted probability and finite intercept estimate.
  2. Why does the intercept-only model assign the same fitted risk to every observation?
  3. For \(y=0\), what happens to the likelihood and intercept as \(p\) approaches its maximizing boundary?
  4. In a grouped binomial likelihood, why does including the binomial coefficient not change the maximum-likelihood estimate of \(p\)?
  5. State the independence and common-probability assumptions used to write the likelihood as \(p^y(1-p)^{n-y}\).
Clinical Biostats