Espartaco

“Is that to say we are against Free Trade? No, we are for Free Trade, because by Free Trade all economical laws, with their most astounding contradictions, will act upon a larger scale, upon the territory of the whole earth; and because from the uniting of all these contradictions in a single group, where they will stand face to face, will result the struggle which will itself eventuate in the emancipation of the proletariat.”

Karl Heinrich Marx · Marx-Engels Collected Works, Vol. VI, p. 290

25,965 views since December 2020

25,965 visitas desde diciembre de 2020

EnglishEspañol

LOGIT MODEL OR LOGISTIC REGRESSION

Mathematical Statistics · Generalized Linear Models

Logit Model or Logistic Regression

On statistical specification, the logit transformation, and the relation between probabilities, odds, and linear predictors


As Aldrich and Nelson (1984) point out, every statistical inference presupposes some specification of the phenomenon one intends to study. It is therefore not enough to possess a mathematically elegant model, nor to have a computational procedure capable of estimating it. A prior problem remains: determining whether the mathematical properties of the model bear a scientifically defensible correspondence to the properties of the real object under investigation.

This question precedes estimation. Statistical-mathematical theory can tell us what properties an estimator possesses under certain conditions; it cannot, by itself, guarantee that those conditions adequately describe the material, economic, social, or natural process from which the data arise. When specification fails, the inferential properties upon which our conclusions rest may fail as well.

The logit model provides a useful illustration of this general problem. Its usefulness does not simply follow from its popularity, nor from the ease with which statistical software can estimate it. Rather, it derives from the specific relation it establishes between a dichotomous response variable, a conditional probability, and a mathematical function capable of transforming that probability into a quantity representable by means of a linear predictor.

Simplicity is a reasonable starting hypothesis when no knowledge requires us to do otherwise. But where theory or evidence indicates a different structure, simplicity ceases to justify imposing it.

1. The problem with the linear probability model

Suppose that \(Y_i\) is a dichotomous variable that can take only the values zero and one. We may define:

\[ P_i \equiv P(Y_i=1\mid X_i). \]

The conditional expectation of a Bernoulli variable coincides precisely with its probability of success:

\[ E(Y_i\mid X_i)=P_i. \]

One first possibility is to represent that probability through a linear function of the explanatory variables:

\[ P_i = \beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik}. \]

The mathematical problem appears immediately. A probability must satisfy:

\[ 0\leq P_i\leq1, \]

whereas a linear predictor such as \(\beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik}\) does not, in general, possess such bounds. It may produce numbers below zero or above one. A linear probability model can be useful in certain contexts as an approximation and has some interpretive advantages, but this incompatibility between the range of the linear predictor and the range of a probability constitutes a fundamental reason to seek another specification.

We do not need to abandon the linear predictor. What we can do is transform the probability.

2. From probability to odds and the logit

If \(0<P_i<1\), we can construct the ratio:

\[ \frac{P_i}{1-P_i}. \]

This quantity is commonly called the odds. It compares the probability that the event occurs with the probability that it does not.

For example, if \(P_i=0.75\):

\[ \frac{0.75}{1-0.75}=3. \]

The odds are therefore 3 to 1 in favor of the event. This transformation removes the upper bound of the probability, but it does not remove all restrictions:

\[ \frac{P_i}{1-P_i}\in(0,\infty). \]

Odds remain necessarily positive. To obtain a quantity capable of spanning the entire real line, we apply the natural logarithm:

\[ \log\left(\frac{P_i}{1-P_i}\right)\in(-\infty,\infty). \]

This transformation is the logit of the probability:

\[ \operatorname{logit}(P_i) = \log\left(\frac{P_i}{1-P_i}\right). \]

We now have a quantity whose range is compatible with that of a linear predictor. We may therefore specify:

\[ \log\left(\frac{P_i}{1-P_i}\right) = \beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik} \equiv Z_i. \]
Fundamental distinction

The probability \(P_i\) lies in the interval \((0,1)\); the odds \(P_i/(1-P_i)\) lie in \((0,\infty)\); and the log-odds, or logit, range across the entire real line \((-\infty,\infty)\). These are three different scales and should not be confused.

3. The logistic function

Once the preceding relation has been established, we can solve for \(P_i\). We begin from:

\[ \log\left(\frac{P_i}{1-P_i}\right)=Z_i. \]

Applying the exponential function:

\[ \frac{P_i}{1-P_i}=e^{Z_i}. \]

Through algebraic manipulation:

\[ P_i = \frac{e^{Z_i}}{1+e^{Z_i}} = \frac{1}{1+e^{-Z_i}}. \]

We have arrived at the standard logistic function. The transformation solves precisely the problem of interest: \(Z_i\) may take any real value, while the output of the function always lies between zero and one.

01

If \(Z_i\rightarrow-\infty\), then \(P_i\rightarrow0\).

02

If \(Z_i=0\), then \(P_i=0.5\).

03

If \(Z_i\rightarrow+\infty\), then \(P_i\rightarrow1\).

The function is continuous, smooth, and monotonically increasing. Its shape is the familiar sigmoid, or S-shaped curve. The standard logistic function also possesses rotational symmetry around the point \((0,1/2)\).

A more general expression of the logistic function is:

\[ f(x) = \frac{L}{1+e^{-k(x-x_0)}}, \]

where \(L\) determines the upper limit, \(k\) regulates the rate of growth, and \(x_0\) determines the position of the midpoint. The standard logistic function commonly used to transform a linear predictor into a probability corresponds to:

\[ L=1,\qquad k=1,\qquad x_0=0. \]

It is also important to distinguish the logistic function used here as the inverse of the link function from the logistic distribution. The two objects are related, but they are not synonymous.

4. Why a logistic function?

Finding a mathematically convenient function does not, by itself, settle the problem of specification. As Aldrich and Nelson (1984) observe, many functions can transform an unrestricted predictor into a probability. The logistic function is not the only possibility.

Among the best-known alternatives is the probit model, which uses the standard normal cumulative distribution function as the inverse link. Another possibility is the complementary log-log link. Each choice imposes a different mathematical structure on the relationship between the predictor and the probability.

Model Link function Main feature
Logit \(\log[p/(1-p)]\) Natural interpretation through odds and odds ratios.
Probit \(\Phi^{-1}(p)\) Uses the cumulative normal distribution.
Complementary log-log \(\log[-\log(1-p)]\) Introduces an asymmetric probability response.

Logit and probit often produce very similar empirical results in a wide range of applications, particularly in the central regions of their respective curves. This does not mean that they are mathematically identical, nor that the choice between them can always be treated as irrelevant. The proper criterion remains substantive and statistical: what structure is justifiable for the phenomenon, what inferential properties are needed, and what aspects of the response one wishes to represent.

The availability of a statistical model does not constitute evidence that the model corresponds to the object. Choosing a link function is itself a hypothesis about the mathematical form of the relationship under study.

5. The statistical model

Up to this point we have examined mainly the geometry of the transformation. But logistic regression is not merely the drawing of an S-shaped curve. It is a probabilistic model.

When each observation represents an individual dichotomous outcome, the natural formulation is:

\[ Y_i\mid X_i \sim \operatorname{Bernoulli}(P_i), \]

with:

\[ P_i = \frac{1} {1+\exp[-(\beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik})]}. \]

If, by contrast, observations are grouped and we record \(Y_i\) successes out of \(n_i\) trials, we may write:

\[ Y_i\mid X_i \sim \operatorname{Binomial}(n_i,P_i). \]

This distinction matters. It is not precise simply to say that “the data set follows a binomial distribution.” The probability distribution is specified for the response variable conditional on the covariates and depends on the observational structure of the data.

In the language of generalized linear models, logistic regression combines three elements:

I

Random component: a Bernoulli or binomial response.

II

Systematic component: the linear predictor \(X_i\beta\).

III

Link function: \(g(P_i)=\log[P_i/(1-P_i)]\).

The logistic function \(g^{-1}(Z)=1/(1+e^{-Z})\) is therefore the inverse of this link.

6. Estimation by maximum likelihood

The coefficients of a logistic regression are not usually obtained by minimizing the sum of squared residuals as in ordinary linear regression. They are estimated by maximum likelihood.

For conditionally independent Bernoulli observations, the contribution of each observation to the likelihood can be written as:

\[ P_i^{Y_i}(1-P_i)^{1-Y_i}. \]

For \(n\) observations:

\[ L(\beta) = \prod_{i=1}^{n} P_i^{Y_i}(1-P_i)^{1-Y_i}. \]

The procedure searches for the parameter values \(\beta\) that make the actually observed outcomes most likely under the specified model. In practice, one normally maximizes the logarithm of the likelihood:

\[ \ell(\beta) = \sum_{i=1}^{n} \left[ Y_i\log(P_i) +(1-Y_i)\log(1-P_i) \right]. \]

In general there is no closed-form expression analogous to the ordinary least squares formula for obtaining the coefficients. The solution is found through iterative numerical procedures.

7. How to interpret the coefficients

This is one of the points that most often generates confusion when moving from linear to logistic regression. If:

\[ \log\left(\frac{P_i}{1-P_i}\right) = \beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik}, \]

then \(\beta_j\) does not directly represent the change in probability produced by a one-unit increase in \(X_j\). It represents the change in the log-odds, holding the other variables in the predictor constant.

Exponentiating the coefficient gives a more intuitive interpretation:

\[ e^{\beta_j}. \]

This is the factor by which the odds are multiplied when \(X_j\) increases by one unit, ceteris paribus.

Example

If \(\beta_j=0.5\), then:

\[ e^{0.5}\approx1.65. \]

A one-unit increase in \(X_j\) multiplies the odds by approximately 1.65, that is, increases them by approximately 65%, holding the other variables constant. This does not mean that the probability rises by 0.5 or by 50 percentage points.

The effect on probability is not constant

The reason is that the relationship between \(Z_i=X_i\beta\) and \(P_i\) is nonlinear. For a continuous variable \(X_j\), under the simple additive specification, the marginal effect is:

\[ \frac{\partial P_i}{\partial X_{ij}} = \beta_jP_i(1-P_i). \]

Thus, the same coefficient \(\beta_j\) may correspond to different changes in probability depending on the point of the curve at which each observation lies. The response is more sensitive in the central region of the logistic function and less sensitive near its extremes.

This is not an accidental difficulty of the model. It is a direct consequence of the mathematical structure we have chosen to use.

8. Evaluation and diagnostics

Estimating a set of coefficients does not settle the problem. We must ask whether the model adequately describes the information we seek to explain and, above all, whether the inferences we wish to draw from it are defensible.

Likelihood-ratio test

A classical comparison contrasts a model containing explanatory variables with a model containing only the intercept. The likelihood-ratio statistic can be written as:

\[ LR = 2\left[ \ell(\widehat{\beta}_{\text{model}}) – \ell(\widehat{\beta}_{\text{restricted}}) \right], \]

and, under regularity conditions, it approximately follows a chi-squared distribution with degrees of freedom corresponding to the number of restrictions being tested.

This test can indicate whether the set of predictors improves fit relative to a more restricted model. It should not, however, be confused with a complete evaluation of the model’s scientific usefulness.

Statistical significance is not enough

Depending on the purpose of the investigation, one should also examine aspects such as:

  • the calibration of estimated probabilities;
  • the ability to discriminate between outcomes;
  • deviance and residuals appropriate to generalized linear models;
  • the stability of the coefficients;
  • the presence of influential observations;
  • out-of-sample performance when the objective is predictive;
  • and, above all, the adequacy of the functional form and assumptions to the scientific problem.

9. Specification returns to the center

We thus return to the problem with which we began. Logistic regression elegantly solves a mathematical difficulty: it allows an unrestricted predictor to be related to a probability necessarily bounded between zero and one. But this mathematical virtue does not make the logit an automatic choice for every dichotomous phenomenon.

Its use presupposes a particular structure. Among other things, one should examine whether the linear predictor is an adequate representation of the log-odds, whether dependence among observations has been modeled correctly, whether relevant interactions or nonlinearities are present, and whether complete or quasi-complete separation occurs, a circumstance capable of producing problematic or non-finite maximum-likelihood estimates.

Some questions prior to inference
  • Is there a scientific justification for the variables included and for the way in which they enter the predictor?
  • Does the approximately linear relationship assumed actually hold for the log-odds, or are transformations, nonlinear terms, or interactions required?
  • Is the dependence structure among observations represented adequately?
  • Is there enough information in the data to identify the parameters?
  • Is the purpose explanatory, predictive, descriptive, or causal?

The last question deserves particular attention. An association obtained through logistic regression does not become causal merely because it has been expressed through coefficients, probabilities, or odds ratios. Causality requires assumptions and a design capable of justifying such an interpretation.

Likewise, a model may be a useful approximation without being a literally exact description of the data-generating process. The scientific problem is then to determine which properties of that approximation are sufficiently robust for the specific inferential purpose.

· · ·

The broader lesson therefore extends beyond logistic regression. A statistical model is a mathematical instrument containing a specific structure: a space of possible outcomes, a probability distribution, a functional form, parameters, and assumptions concerning the relationships among magnitudes. To apply it is to affirm—explicitly or implicitly—that these properties bear some relevant correspondence to the phenomenon under study.

From this standpoint, the problem of specification has a genuinely epistemological content. Mathematics is not a decoration subsequently placed upon the data. Nor do the data, by themselves, determine which model must be used. Between the real object and the mathematical expression there is a theoretical mediation that must be examined, criticized, and tested.

The logit constitutes a particularly elegant solution because it transforms a restricted probability into an unrestricted quantity and subsequently allows a valid probability to be recovered through the logistic function:

\[ \boxed{ \log\left(\frac{P_i}{1-P_i}\right)=X_i\beta \quad\Longleftrightarrow\quad P_i=\frac{1}{1+e^{-X_i\beta}} }. \]

But the elegance of the transformation does not replace the investigation of the object. Precisely because the model possesses determinate mathematical properties, we must ask when those properties are pertinent. There lies the point of contact between statistics, mathematics, and scientific knowledge.

Terminological note
In this text, logit denotes the link function \(\log[p/(1-p)]\), while logistic function denotes its inverse \(1/(1+e^{-z})\). In applications with individual binary responses, a Bernoulli distribution conditional on the covariates is used; with grouped counts of successes, a binomial distribution may be used.

References

Aldrich, J. H., & Nelson, F. D. (1984). Linear Probability, Logit, and Probit Models. Beverly Hills: Sage University Papers Series, Quantitative Applications in the Social Sciences.

Liao, T. F. (1994). Interpreting Probability Models: Logit, Probit, and Other Generalized Linear Models. Sage University Papers Series, Quantitative Applications in the Social Sciences.

McCullagh, P., & Nelder, J. A. (1989). Generalized Linear Models (2nd ed.). London: Chapman & Hall.


Discover more from Marxist Philosophy of Science

Subscribe to get the latest posts sent to your email.

Follow the blogSeguí al blog

Comments

Leave a Comment/Deja un Comentario

Discover more from Marxist Philosophy of Science

Subscribe now to keep reading and get access to the full archive.

Continue reading