Factor Analysis
Factor analysis (predictive power) of the models: whether the tickers that score high on a model, such as the Piotroski F-Score or the Altman Z-Score, go on to return more than those that score low. Per period, the information coefficient (IC) is the Spearman rank correlation between the model score of the tickers at the end of the period and their return over the following horizon: 1 means the score ranks the later returns perfectly, -1 in reverse and 0 that it says nothing about them. The IC measures skill in Grinold and Kahn’s fundamental law of active management, IR ≈ IC × √breadth: a small but consistent IC across many tickers and periods gives a high information ratio.
The summary has a row per model and horizon with the mean IC, its standard deviation, the IC information ratio (mean divided by standard deviation), the t-statistic of the mean with its p-value, the share of periods with a positive IC, the number of periods, the top minus bottom spread (the mean forward return of the highest quantile minus that of the lowest), the mean turnover of the top and bottom quantiles and the mean rank autocorrelation of the score from one period to the next. With detail, it returns one of those parts per period (or per quantile) for a single model.
The models are calculated per statement period and each period’s score applies from the end of the fiscal period, or with point_in_time from the day it was filed, never earlier, so no day uses figures that were not known yet. The returns use the dividend and split adjusted close and start at the close of the period the score belongs to. Each ticker keeps its own history: a ticker without a score or a return in a period is left out of that period only.
Factor Analysis in Python
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_factor_analysis as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["AAPL", "MSFT", "GOOGL", "AMZN", "META", "NVDA", "JPM", "JNJ",
"XOM", "PG", "KO", "WMT", "V", "UNH", "HD", "CVX"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2016-01-01",
end_date="2025-12-31",
)
toolkit.models.get_factor_analysis(
["get_piotroski_score", "get_altman_z_score"], horizons=12
)
Which returns:
| Mean IC | IC Standard Deviation | IC Information Ratio | t-Statistic | p-Value | Positive Share | Observations | Top Minus Bottom | Quantile Turnover | Rank Autocorrelation | |
|---|---|---|---|---|---|---|---|---|---|---|
| (‘get_piotroski_score’, ‘12 Months’) | -0.146 | 0.3791 | -0.3852 | -3.6131 | 0.0005 | 0.2841 | 88 | -0.1812 | 0.0794 | 0.9301 |
| (‘get_altman_z_score’, ‘12 Months’) | 0.1209 | 0.3923 | 0.3082 | 3.0824 | 0.0027 | 0.7 | 100 | 0.1264 | 0.0285 | 0.9941 |
Parameters
get_factor_analysis accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
metrics | str | list[str] | A model method name with one value per ticker and period, e.g. “get_piotroski_score”, a list of them, or a collection: “scores” or “all”. Defaults to “scores”, the Piotroski, Altman Z, Beneish M, Ohlson O, Zmijewski, Springate, Grover, Fulmer H, Dechow F, Montier C and Mohanram G scores. “all” adds the accruals ratio, Tobin’s Q, the sustainable and internal growth rates, the magic formula and the Merton distance to default. The valuation models and the analyses with several components and no score are not in the collections. | |
period | str | The frequency at which the models are evaluated: daily, weekly, monthly, quarterly or yearly. Defaults to “monthly”. | "weekly" |
horizons | list[int] | int | None | The number of periods the forward returns cover. Defaults to None, which uses about a period, a quarter and a year ahead (1, 3 and 12 months for monthly). | None, which uses about a period, a quarter and a year ahead (1, 3 and 12 months for monthly) |
quantiles | int | The number of quantiles the tickers are sorted into per period. Defaults to 5. | [0.05, 0.5, 0.95] |
periods_apart | int | The number of periods between the dates the quantile turnover and the rank autocorrelation compare. Defaults to 1. | 1 |
detail | str | None | Returns one part of the analysis of a single model instead of the summary: “information_coefficient” (per period and horizon), “quantile_returns” (the mean forward return per quantile and horizon), “quantile_turnover” (per period and quantile) or “rank_autocorrelation” (per period). Defaults to None. | None |
column | str | None | The component to use of a model, e.g. “Working Capital to Total Assets” of the Altman Z-Score. Defaults to None, which uses the model’s score (its last row). | "Return" |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the Toolkit’s rounding. **kwargs: Parameters passed to the models that take them, e.g. trailing=4 or diluted=False. | 2 |