How do logit and probit differ on the same data?

Fit logit and probit models to the same yes-or-no outcome with statsmodels and compare their coefficients, predicted probabilities and average marginal effects.

After this lesson, you can fit logit and probit models to the same outcome and compare them on one probability scale.

How do logit and probit turn a line into a probability?

Both models compute a straight line in the predictor and turn it into a probability between 0 and 1, logit with the logistic function and probit with the standard normal distribution function. On 15 made-up reports of suspicious trades, the coefficient of the stock’s move is 0.821 in logit and 0.504 in probit, because the two functions use different scales.

\[ z_i = \beta_0 + \beta_1 x_i, \qquad p_i^{\text{logit}} = \frac{1}{1 + e^{-z_i}}, \qquad p_i^{\text{probit}} = \Phi(z_i) \]

Here \(x_i\) is the stock’s abnormal return in the direction of the reported trade, in percentage points, \(p_i\) the probability that report \(i\) is forwarded for investigation, and \(\Phi\) the standard normal distribution function.

smf.logit and smf.probit take the same formula, as in the lesson on logit, and .fit(disp=0) estimates each by maximum likelihood without printing its progress.

The following box builds the reports and fits both models.

import pandas as pd
import statsmodels.formula.api as smf

reports = pd.DataFrame({
    "ticker": ["AAA", "BBB", "CCC"] * 5,
    "move": [-2, -2, -2, -1, -1, -1, 0, 0, 0, 1, 1, 1, 2, 2, 2],
    "forwarded": [0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0],
})
logit = smf.logit("forwarded ~ move", data=reports).fit(disp=0)
probit = smf.probit("forwarded ~ move", data=reports).fit(disp=0)
print(pd.DataFrame({"logit": logit.params, "probit": probit.params}).round(3))
           logit  probit
Intercept -0.534  -0.329
move       0.821   0.504

Both coefficients are positive, so both models link a larger move to a higher chance of forwarding.

Do they give the same probabilities and effects?

On the probability scale, the two models almost agree. A report with a move of 2 gets 75.2% from logit and 75.1% from probit, and the average marginal effects are 0.1510 and 0.1544, about 15 percentage points of probability per percentage point of move.

.predict() gives each report’s probability, and .get_margeff(at="overall").margeff averages the slope of the probability curve over the reports, as in the lesson on logit. .loc[[0, 6, 12]] shows one report of each move −2, 0 and 2.

The following box compares the probabilities and the average marginal effects.

probabilities = pd.DataFrame({"move": reports["move"], "logit": logit.predict(reports), "probit": probit.predict(reports)})
print(probabilities.loc[[0, 6, 12]].round(3))
print(round(logit.get_margeff(at="overall").margeff[0], 4), round(probit.get_margeff(at="overall").margeff[0], 4))
    move  logit  probit
0     -2  0.102   0.091
6      0  0.370   0.371
12     2  0.752   0.751
0.151 0.1544

The two models can differ more in the tails, for reports with extreme moves.

Your turn

For the reports with a move of 1, print the logit probability minus the probit probability in percentage points. You should see 0.21 for each of the three reports.

probabilities["move"] == 1 keeps the three reports, and multiplying by 100 gives percentage points.

one = probabilities[probabilities["move"] == 1]
print(((one["logit"] - one["probit"]) * 100).round(2))
9     0.21
10    0.21
11    0.21
dtype: float64