Binary response
Logit regression
Logit turns a linear index into a probability and gives coefficients a direct log-odds interpretation.
The task
Task statement
Estimate a binary logit of y_bin_logit on x1 and x2 with an intercept. Report coefficient-scale rows const, x1, and x2 with asymptotic standard errors.
Data
Columns: id, x1, x2, y_lin, y_bin_logit, y_bin_probit.
- Files
- input.csv
Required output
Scored estimates: const, x1, x2.
Reference output
| Term | Reference estimate | Sample size |
|---|---|---|
const | 0.19283848 | 2,000 |
x1 | 0.79162292 | 2,000 |
x2 | -0.40052056 | 2,000 |
A run succeeds when every scored estimate lies within 1 percent or 0.005 of its reference value, whichever is larger. Sample sizes are not scored.
Task success
| Agency condition | Claude Sonnet 4.6 | GPT-5.6 Luna |
|---|---|---|
| Chatbot | 100.0% | 100.0% |
| Self-repair | 100.0% | 100.0% |
| Constrained agent | 100.0% | 100.0% |
- All runs
- 100.0% of 360 runs
- By prompt condition
- Zero-shot 100.0%, One-shot 100.0%
- By software
- Python 100.0%, R 100.0%, Stata 100.0%
A linear model for log odds
Logit models the logarithm of the odds as a linear function. The inverse-logit function keeps every fitted probability between zero and one (Train, 2009).
Increasing $x_j$ by one multiplies the odds by $\exp(\beta_j)$. It does not add a constant amount to the probability.
A numerical odds calculation
Let $\log[p/(1-p)]=-1+0.7x$. The coefficient implies an odds ratio of $\exp(0.7)=2.014$.
| $x$ | Log odds | Odds | Probability |
|---|---|---|---|
| 0 | -1.0 | 0.368 | 0.269 |
| 1 | -0.3 | 0.741 | 0.426 |
| 2 | 0.4 | 1.492 | 0.599 |
The marginal effect is largest near $p=0.5$:
Assumptions and implementation
Maximum likelihood requires a specified conditional mean and independent sampling for its usual covariance formula. Robust or clustered covariance estimates can relax variance and dependence assumptions. Complete separation can send one or more estimates toward infinity.
Equal index steps create unequal probability changes because the logistic curve is S-shaped.
From log odds to probabilities
A coefficient $\beta_j$ gives the change in log odds from a one-unit increase in $x_j$, holding other regressors fixed. Exponentiation gives an odds ratio. Probability changes vary with the starting index because the logistic curve is steepest near one-half. In the numerical example, the odds calculation is exact for the stated covariate shift. It should not be described as the same percentage change in probability for every person.
Report predicted probabilities or average marginal effects beside odds ratios. For a binary regressor, use the average discrete change between its two values. State the covariate distribution used for averaging.
Estimation checks and failure modes
Confirm that the outcome uses two documented values and that the modeled event matches the reported event. Inspect cross-tabulations for complete or quasi-complete separation. Under separation, maximum-likelihood coefficients can diverge even when software returns a large finite number. Penalized likelihood can stabilize estimation, but it changes the estimator and requires disclosure.
Check influential observations, overlap across important groups, and calibration of predicted risks. A correct link function still needs a suitable linear index. Splines or interactions may be needed for continuous predictors. Robust or clustered covariance can change uncertainty without repairing misspecified probabilities. When observations come from a complex sample, incorporate the sampling design in both estimation and variance calculations. Avoid interpreting fitted probabilities far beyond the observed predictor support. (Greene, 2018)
Further reading
Train derives logit from extreme-value random utility and explains odds and substitution patterns (Train, 2009). Stock and Watson compare logit with linear and probit models for binary outcomes in applied work (Stock and Watson, 2019).
Sources and further reading
- Kenneth E. Train. 2009. Discrete Choice Methods with Simulation. Cambridge University Press. doi:10.1017/CBO9780511805271.
- William H. Greene. 2018. Econometric Analysis. Pearson. Source.
- James H. Stock, Mark W. Watson. 2019. Introduction to Econometrics. Pearson. Source.
About this benchmark task
- Method group
- Binary response
- Software
- Stata, R, and Python
- Runs
- 360 runs, ten in each combination of model, software, prompt, and agency condition