Fit a Probit Regression of whether dependent_ticker’s return is positive on independent_tickers.

Also known as: probit model.

For more information about the method, see regression_model.get_probit_regression.

Probit Regression in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_probit_regression as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "MSFT"], api_key="FINANCIAL_MODELING_PREP_KEY")

# AAPL (the first ticker) is dependent; MSFT and Benchmark are independent
toolkit.econometrics.get_probit_regression(
    independent_tickers=["MSFT", "Benchmark"], period="weekly"
)

Which returns:

  Coefficient Std. Error z-Statistic P-Value
Intercept 0.0498 0.1266 0.3935 0.694
MSFT 15.7063 5.7385 2.737 0.0062
Benchmark 35.3471 8.1355 4.3448 0

Parameters

The function accepts the following parameters:

  • dependent_ticker (str | None, optional): The dependent asset (whose up/down direction is predicted). Defaults to None, meaning the Toolkit instance’s first ticker.
  • independent_tickers (str | list[str] | None, optional): The independent (predictor) asset(s). Defaults to None, meaning every other ticker in the Toolkit instance besides dependent_ticker.
  • include_benchmark (bool, optional): Whether to include “Benchmark” in the default independent ticker(s) (has no effect when independent_tickers is given explicitly). Defaults to False.
  • period (str, optional): The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “daily”.
  • column (str, optional): The historical data column to derive returns from. Defaults to “Return”.
  • add_constant (bool, optional): Whether to include an intercept. Defaults to True.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.
Share