Market Timing Model

Calculate a market timing model for each asset: whether the manager raised the exposure to the market before it rose and lowered it before it fell, with the Treynor-Mazuy or the Henriksson-Merton model.

Jensen’s Alpha and Beta from a plain CAPM regression cannot distinguish stock-picking skill (selectivity) from market-timing skill (shifting exposure ahead of market moves). Both models add a timing term in the benchmark excess return to the regression.

The Treynor-Mazuy model adds a quadratic term: a manager who successfully increases (decreases) market exposure ahead of up (down) markets will show a return profile that curves upward as a function of the benchmark return, captured by a positive quadratic coefficient (Gamma). The formula is as follows:

\[\text{Excess Return} = \text{Alpha} + \text{Beta} \cdot \text{Benchmark Excess Return} + \Gamma \cdot \text{Benchmark Excess Return}^{2} + \text{Residuals}\]

Gamma > 0 indicates positive market-timing ability; Gamma <= 0 indicates no timing ability.

The Henriksson-Merton model models timing as a piecewise (rather than quadratic) change in Beta: a “down-market” Beta and an “up-market” Beta. The formula is as follows:

\[\text{Excess Return} = \text{Alpha} + \text{Beta} \cdot \text{Benchmark Excess Return} + \text{Up Market Beta} \cdot \max(\text{Benchmark Excess Return},\; 0) + \text{Residuals}\]

Beta is the “down-market” Beta (the portfolio’s market exposure when the benchmark excess return is negative), and Beta + Up Market Beta is the “up-market” Beta. Up Market Beta > 0 indicates positive market-timing ability; Up Market Beta <= 0 indicates no timing ability.

Also known as: Treynor-Mazuy quadratic timing model, TM model, Henriksson-Merton piecewise timing model, HM model, market timing regression.

Example · ARKK, JEPI · 2021 to 2025

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

from financetoolkit import Toolkit

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

toolkit.performance.get_market_timing_model().xs("ARKK", level=0, axis=1)

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

Did ARK Innovation (ARKK) time the market in each year from 2021 to 2025, according to the Treynor-Mazuy model?

Which returns:

Parameters

get_market_timing_model accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe period to use for the calculation. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”."quarterly"
methodstrThe timing model. Options are: “treynor_mazuy” (the quadratic timing term, Gamma), “henriksson_merton” (the piecewise timing term, Up Market Beta). Defaults to “treynor_mazuy”."treynor_mazuy"
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the ratios. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether 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_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 Treynor, J., & Mazuy, K. (1966). “Can Mutual Funds Outguess the Market?” Harvard Business Review, 44(4), 131-136.
  • Paper Henriksson, R.D., & Merton, R.C. (1981). “On Market Timing and Investment Performance II: Statistical Procedures for Evaluating Forecasting Skills.” Journal of Business, 54(4), 513-533.
  • Library Shares similar logic as PerformanceAnalytics (R)’s MarketTiming (TM)
  • Library Shares similar logic as PerformanceAnalytics (R)’s MarketTiming (HM)
Share