Carhart Four-Factor Model
Calculate Carhart Four Factor model scores for a set of financial assets.
The Carhart Four Factor model extends the Fama and French Three Factor model with a momentum factor, based on the observation that stocks with high prior returns (winners) tend to keep outperforming stocks with low prior returns (losers) over the medium term:
- Market Risk Premium (Mkt-RF): The excess return of the market over the risk-free rate.
- Size Premium (SMB): The historical excess return of small-cap stocks over large-cap stocks.
- Value Premium (HML): The historical excess return of value stocks over growth stocks.
- Momentum (MOM): The historical excess return of prior winner stocks over prior loser stocks.
The model performs a Multi Linear Regression (ordinary least squares) on all four factors and defines the regression parameters for each asset over time based on its exposure to these factors.
The formula is as follows:
\[\text{Excess Return} = \text{Daily Asset Return} - \text{Daily Risk Free Rate} (\text{RF},\; \text{from the Fama and French dataset})\] \[\text{Excess Return} = \text{Intercept} + \text{Beta1} \cdot \text{Mkt-RF} + \text{Beta2} \cdot \text{SMB} + \text{Beta3} \cdot \text{HML} + \text{Beta4} \cdot \text{MOM} + \text{Residuals},\;\; \text{fitted on the daily returns within each period (e.g. each quarter)}\]For more information about the method, see the following paper:
- Carhart, M.M. (1997). “On Persistence in Mutual Fund Performance.” The Journal of Finance, 52(1), 57-82.
Also known as: Carhart model, four-factor model, momentum-augmented Fama-French model.
Carhart Four-Factor Model in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_carhart_four_factor_model as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["XOM", "HD", "ADBE"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2025-01-01",
end_date="2025-12-31",
)
toolkit.performance.get_carhart_four_factor_model(period="quarterly")["XOM"].drop(
columns="Mean Squared Error (MSE)"
)
Or, after setting up the Finance Toolkit MCP, ask:
What were the Carhart four-factor loadings and R-squared of ExxonMobil in each quarter of 2025?
Which returns:
| Intercept | Mkt-RF Slope | SMB Slope | HML Slope | MOM Slope | R Squared | |
|---|---|---|---|---|---|---|
| 2025Q1 | 0.0021 | 0.7335 | 0.2739 | 0.4818 | -0.7225 | 0.317 |
| 2025Q2 | -0.0002 | 0.8881 | -0.7307 | 1.6062 | -0.7248 | 0.6805 |
| 2025Q3 | 0.0003 | 0.3232 | -0.1805 | 0.6496 | -0.2369 | 0.2179 |
| 2025Q4 | 0.0005 | 0.4852 | -0.2193 | 0.6778 | -0.0933 | 0.1938 |
Parameters
get_carhart_four_factor_model accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
period | str | The period for the calculation (e.g., “weekly”, “monthly”, “quarterly”, “yearly”). Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”. | "monthly" |
region | str | The region whose factors to use: “United States”, “Developed”, “Developed ex US”, “Europe”, “Japan”, “Asia Pacific ex Japan” or “North America” (the factors of Ken French’s library for that region’s stocks). Every region’s factors are U.S. dollar returns with the U.S. one-month Treasury bill as the risk-free rate (RF), so a ticker quoted in another currency is best analysed with its U.S. dollar returns; otherwise the exchange rate’s moves end up in the factor loadings, mostly the market beta. Defaults to “United States”. | "Europe" |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
growth | bool | Whether to calculate the growth of the ratio values. Defaults to False. | True |
lag | int or list of int | The lag to use for the growth calculation. Defaults to 1. | 4 |
standardize | bool | Whether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False. | True |
show_columns | list of str | Restrict the result to these top level columns. Defaults to None, which returns every column. | ["Intercept", "R Squared"] |