5D Library › Regime-Switching Fractional Kelly, Maximum-Drawdown Constraints and Lifecycle Leverage Allocation · 中文
Chapter 1. Full Kelly and the Optimistic Drift: Why a Good Year Breeds Overbetting
The growth curve
The Kelly criterion chooses the fraction of wealth to bet so that wealth grows fastest in the long run (Kelly 1956). For an asset whose excess return over cash is with volatility , and a portfolio rebalanced continuously, the growth-optimal leverage is (Thorp 2006). Betting times gives an excess log growth of , where is the Sharpe ratio. The curve is a parabola: it peaks at , is back at zero at and is negative beyond.
What matters in practice is that is not chosen directly. The investor chooses a believed excess return and computes from it; if the belief is twice the truth, the bet is twice Kelly. p01 takes an excess return of 0.05 a year with volatility 0.16.
Calculation
# Chapter 1. p01: The Kelly growth curve and what an optimistic drift
# does to it. Excess return mu - r = 0.05 a year, volatility 0.16, so
# full Kelly f* = (mu - r) / sigma^2. An investor who believes the
# excess return is m instead of 0.05 bets c = m / 0.05 times Kelly.
# Excess log growth of wealth: S^2 (c - c^2 / 2), S = Sharpe ratio.
EX, SIG = 0.05, 0.16
if __name__ == "__main__":
f_star = EX / SIG ** 2
s2 = (EX / SIG) ** 2
print(" full Kelly leverage f* = {:.3f}; Sharpe {:.4f}".format(
f_star, EX / SIG))
print(" believed excess multiple c leverage wealth vol growth")
for m in (0.0125, 0.025, 0.05, 0.075, 0.10, 0.125, 0.15):
c = m / EX
g = s2 * (c - c * c / 2)
print(" {:15.4f} {:10.2f} {:8.2f} {:10.3f} {:+.4f}".format(
m, c, c * f_star, c * EX / SIG, g))
print(" growth at half Kelly / full Kelly: {:.2f}".format(
(0.5 - 0.125) / 0.5))
print(" wealth vol at half Kelly / full Kelly: {:.2f}".format(0.5))
# full Kelly leverage f* = 1.953; Sharpe 0.3125
# believed excess multiple c leverage wealth vol growth
# 0.0125 0.25 0.49 0.078 +0.0214
# 0.0250 0.50 0.98 0.156 +0.0366
# 0.0500 1.00 1.95 0.312 +0.0488
# 0.0750 1.50 2.93 0.469 +0.0366
# 0.1000 2.00 3.91 0.625 +0.0000
# 0.1250 2.50 4.88 0.781 -0.0610
# 0.1500 3.00 5.86 0.938 -0.1465
# growth at half Kelly / full Kelly: 0.75
# wealth vol at half Kelly / full Kelly: 0.50Full Kelly here means a leverage of 1.953 with wealth volatility 0.312; its excess growth is 0.0488 a year. An investor who believes the excess return is 0.10 bets 3.91 times wealth and has an excess growth of exactly zero, with wealth volatility 0.625; one who believes 0.15 bets 5.86 and loses 0.1465 a year in log terms. Half Kelly keeps 0.75 of the growth with 0.50 of the volatility, which is why careful practitioners bet fractions of Kelly (MacLean et al. 2011).
How well can the drift be known
The volatility of a market can be estimated well from a few years of data; its mean cannot. The standard error of an average excess return measured over years is , and part (a) of p02 shows what that means. Part (b) adds a market with two hidden regimes: a bull regime with excess return 0.12 a year and volatility 0.13, and a bear regime with -0.25 and 0.28, switching as a Markov chain (Hamilton 1989).
Calculation
# Chapter 1. p02: How well can the drift be estimated, and what does a
# "tailwind" sample do? (a) i.i.d. world of p01: the standard error of
# a mean excess return estimated from T years is 0.16 / sqrt(T).
# (b) A two-regime market, monthly: bull excess 0.12 a year (vol 0.13),
# bear -0.25 (vol 0.28); a bull month stays bull with chance 0.98, a
# bear month stays bear with 0.92. An investor estimates mean and
# variance from the last 60 months, either at random dates or only
# when a bull run has lasted 36 months or more. Seed 98.
import random
from math import sqrt
from statistics import NormalDist
BULL, BEAR = (0.12 / 12, 0.13 / sqrt(12)), (-0.25 / 12, 0.28 / sqrt(12))
STAY = (0.98, 0.92)
def chain(rng, n):
s, run, out = 0, 0, []
for _ in range(n):
if rng.random() > STAY[s]:
s, run = 1 - s, 0
run += 1
m, sd = BULL if s == 0 else BEAR
out.append((s, run, rng.gauss(m, sd)))
return out
def kelly(xs):
m = sum(xs) / len(xs)
v = sum((x - m) ** 2 for x in xs) / (len(xs) - 1)
return m * 12, v * 12, m / v
if __name__ == "__main__":
z = NormalDist()
print(" (a) years std error P(estimate >= 2 x true)")
for t in (5, 10, 30, 100):
se = 0.16 / sqrt(t)
print(" {:9d} {:9.4f} {:23.3f}".format(
t, se, 1 - z.cdf(0.05 / se)))
rng = random.Random(98)
xs = chain(rng, 600000)
allx = [x for _, _, x in xs]
m_all, v_all, f_all = kelly(allx)
print(" (b) whole history: excess {:.4f}, vol {:.4f}, Kelly {:.2f}"
.format(m_all, sqrt(v_all), f_all))
for name, cond in (("random dates", lambda s, r: True),
("bull run >= 36 months", lambda s, r: s == 0
and r >= 36)):
fs = []
for i in range(60, len(xs), 7):
s, r, _ = xs[i - 1]
if cond(s, r):
fs.append(kelly(allx[i - 60:i])[2])
fs.sort()
q = lambda a: fs[int(a * (len(fs) - 1))]
print(" {:<22} n {:5d} median f {:5.2f} 10%-90% {:5.2f} to "
"{:5.2f}".format(name, len(fs), q(0.5), q(0.1), q(0.9)))
print(" {:<22} share with f >= 2 x whole-history Kelly: {:.3f}"
.format("", sum(f >= 2 * f_all for f in fs) / len(fs)))
# (a) years std error P(estimate >= 2 x true)
# 5 0.0716 0.242
# 10 0.0506 0.162
# 30 0.0292 0.043
# 100 0.0160 0.001
# (b) whole history: excess 0.0452, vol 0.1759, Kelly 1.46
# random dates n 85706 median f 2.42 10%-90% -2.27 to 9.24
# share with f >= 2 x whole-history Kelly: 0.460
# bull run >= 36 months n 34037 median f 5.69 10%-90% 0.41 to 11.32
# share with f >= 2 x whole-history Kelly: 0.740With ten years of data the standard error is 0.0506, as large as the excess return itself, so an honest estimate is at least twice the truth with chance 0.162; with five years 0.242. Only after a century of data does the chance fall to 0.001.
In the two-regime market the whole-history excess return is 0.0452 with volatility 0.1759, so the single-regime Kelly leverage is 1.46. An investor who estimates from the last sixty months at a random date gets a median of 2.42, because most sixty-month windows are mostly bull months; 0.460 of them come out at twice the whole-history Kelly or more. An investor who estimates only after a bull run has lasted three years, the usual moment when people raise their leverage, gets a median of 5.69, and 0.740 of them land at twice Kelly or more. Overbetting is not a personality flaw that some investors have; it is what the data of a long tailwind produce.
Hypothesis · not established
The author’s interpretation (not yet tested): the leverage that retail investors take on rises with the length of the preceding bull run, roughly as an estimate from a trailing window would. What would show it wrong: in broker or margin-debt data covering several cycles, margin use relative to equity does not rise with the length of the preceding advance, or rises less than the change in a trailing five-year Kelly estimate would imply.
Summary
The Kelly growth curve forgives underbetting and punishes overbetting: at twice Kelly the growth is gone. The drift that sets Kelly cannot be measured to better than about 0.05 a year with a decade of data, and a sample taken during a long bull run overstates it, so a “full Kelly” computed in good times is typically a multiple of the true one.
References
Fan, Y. (2026). Regime-Switching Fractional Kelly, Maximum-Drawdown Constraints and Lifecycle Leverage Allocation: Cyclical Drift Estimation Errors, Ruin-Bounded Bet Sizing and Human-Capital Amortization [体制转换分数凯利、最大回撤约束与生命周期杠杆配置] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090256 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).