Binary Choice Regression

Fit a binary choice regression: how the probability that the dependent ticker’s return is positive depends on the independent tickers, with the Logistic or the Probit Regression.

The dependent variable is turned into a binary outcome (1 when the return is positive, 0 otherwise) and the model estimates the probability of that outcome through a link function that maps any value onto the 0 to 1 range: the logistic (sigmoid) function for the Logit model and the standard normal cumulative distribution function for the Probit model.

The formula for the Logistic Regression is as follows:

\[y_{t} = 1 \;\text{if the dependent ticker's} \;\text{column} \;(\text{Return by default}) \;\text{is above}\; 0,\;\; \text{else 0}\] \[P(y_{t} = 1 \mid x_{t}) = \frac{1}{1 + \exp(- x_{t}' \beta)},\;\; \text{with } x_{t} \text{ the independent tickers' column plus a constant}\] \[\hat{\beta} = \operatorname*{arg\,max} \sum\left[y_{t} \cdot \ln(p_{t}) + (1 - y_{t}) \cdot \ln(1 - p_{t})\right],\;\; \text{solved by Newton-Raphson (statsmodels Logit)}\] \[\text{Pseudo}\; R^{2} = 1 - \frac{\ln L(\hat{\beta})}{\ln L_{0}} \;(\text{McFadden}),\;\; \text{with } L_{0} \text{ the likelihood of a constant-only model}\]

The formula for the Probit Regression is as follows:

\[y_{t} = 1 \;\text{if the dependent ticker's} \;\text{column} \;(\text{Return by default}) \;\text{is above}\; 0,\;\; \text{else 0}\] \[P(y_{t} = 1 \mid x_{t}) = \Phi(x_{t}' \beta),\;\; \text{with } x_{t} \text{ the independent tickers' column plus a constant}\] \[\hat{\beta} = \operatorname*{arg\,max} \sum\left[y_{t} \cdot \ln(p_{t}) + (1 - y_{t}) \cdot \ln(1 - p_{t})\right],\;\; \text{solved by Newton-Raphson (statsmodels Probit)}\] \[\text{Pseudo}\; R^{2} = 1 - \frac{\ln L(\hat{\beta})}{\ln L_{0}} \;(\text{McFadden}),\;\; \text{with } L_{0} \text{ the likelihood of a constant-only model}\]

Where Φ is the standard normal CDF. Both models are fitted by Maximum Likelihood. Logit coefficients are log-odds: a one-unit increase in an independent ticker changes the log-odds of a positive return by that coefficient, holding the others fixed, so a positive coefficient means a higher probability of a positive return. A positive Probit coefficient also means a higher probability of a positive return, but its size is not a log-odds ratio. In practice Probit and Logit give very similar fitted probabilities; Probit is the convention in parts of the econometrics literature and underlies two-step estimators such as the Heckman selection correction. Both answer “does this asset tend to be up when the others move this way” rather than “by how much”, which is what get_ols estimates.

The coefficients are per unit of the independent ticker’s return, and a unit is a return of 100%: a Logit coefficient of 90 on the benchmark means the log-odds of an up period rise by about 0.9 for every 1% the benchmark moves. With returns of the same period as regressors the model describes co-movement and predicts nothing; a forecast needs regressors known in advance, such as the returns of the previous period.

Also known as: logistic regression, logit model, logit regression, probit regression, probit model, binary response model.

Example · AAPL · 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_binary_choice_regression:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2025-01-01",
    end_date="2025-12-31",
)

# AAPL (the first ticker) is dependent; the Benchmark is independent
toolkit.econometrics.get_binary_choice_regression(include_benchmark=True)

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

How strongly did the S&P 500's daily return predict whether Apple's shares closed up or down in 2025, according to a logit regression?

Which returns:

Using Your Own Data

get_binary_choice_regression runs on any data, not only prices: ratios, economic indicators, yield curves or your own dataset. Pass a DataFrame, a Series or a dictionary of them to Econometrics as data, with the dates in the rows or the columns, and set changes to how its changes are calculated: "percentage", "log", "difference" for rates and ratios, or None when the data are changes already. For example, for the monthly unemployment rates of the United States and Germany:

from financetoolkit import Economics, Econometrics

economics = Economics(start_date="2000-01-01")

unemployment = economics.get_unemployment_rate(
    countries=["United States", "Germany"], period="monthly"
)

econometrics = Econometrics(data=unemployment, changes="difference")

econometrics.get_binary_choice_regression()

Parameters

get_binary_choice_regression accepts the following parameters.

ParameterTypeDescriptionExample
dependent_tickerstr | NoneThe dependent asset (whose up/down direction is predicted). Defaults to None, meaning the Toolkit instance’s first ticker."AAPL"
independent_tickersstr | list[str] | NoneThe independent (predictor) asset(s). Defaults to None, meaning every other ticker in the Toolkit instance besides dependent_ticker.["MSFT", "Benchmark"]
include_benchmarkboolWhether to include “Benchmark” in the default independent ticker(s) (has no effect when independent_tickers is given explicitly). Defaults to False.True
periodstrThe data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”."weekly"
columnstrThe historical data column to derive returns from. Defaults to “Return”."Return"
add_constantboolWhether to include an intercept. Defaults to True.False
methodstrThe link function. Options are: “logit” (Logistic Regression), “probit” (Probit Regression). Defaults to “logit”."logit"
roundingint | NoneThe number of decimals to round the results to. Defaults to None.2
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Berkson, J. (1944). “Application of the Logistic Function to Bio-Assay.” Journal of the American Statistical Association, 39(227), 357-365.
  • Paper Bliss, C.I. (1934). “The Method of Probits.” Science, 79(2037), 38-39.
Share