关于「隐藏的体制:熊市能多快被识别,体制感知的凯利能带来什么」,《体制凯利、回撤约束与生命周期杠杆》给出的定量结论是什么?
结论:第三章发现即使知道真实参数,熊市体制也要约两个月才被识别,0.193 的熊市段落被漏掉。
数据口径:书中的模型参数均为示意或合成模型;唯一的历史数字是 1987 年的单日跌幅;全部计算由书中程序生成;本书不是投资、法律或税务建议。 书中以标注框区分已发表的证据、可运行的 Python 计算(16 段程序)、原典与作者的假说。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.193
| bear spells 6376, mean length 12.5 months | |||
| threshold | median delay | missed spells | false alarms/bull mo |
| 0.3 | 2 | 0.155 | 0.071 |
| 0.5 | 2 | 0.193 | 0.037 |
| 0.7 | 3 | 0.224 | 0.017 |
查看完整验算程序
# Chapter 3. p05: How fast can a hidden bear regime be recognized? The
# Hamilton filter of the two-regime market (p02), with the true
# parameters known, updates the chance of "bear" each month from that
# month's excess return. Delay = months from the first bear month
# until the filtered chance first exceeds a threshold; a false alarm
# is a bull month whose filtered chance exceeds it. 400,000 months,
# seed 98.
import random
from math import exp, pi, sqrt
BULL, BEAR = (0.12 / 12, 0.13 / sqrt(12)), (-0.25 / 12, 0.28 / sqrt(12))
STAY = (0.98, 0.92)
def dens(x, m, sd):
return exp(-0.5 * ((x - m) / sd) ** 2) / (sd * sqrt(2 * pi))
def step(p_bear, x):
prior = p_bear * STAY[1] + (1 - p_bear) * (1 - STAY[0])
a = prior * dens(x, *BEAR)
b = (1 - prior) * dens(x, *BULL)
return a / (a + b)
if __name__ == "__main__":
rng = random.Random(98)
s, p, states, probs = 0, 0.2, [], []
for _ in range(400000):
if rng.random() > STAY[s]:
s = 1 - s
x = rng.gauss(*(BULL if s == 0 else BEAR))
p = step(p, x)
states.append(s)
probs.append(p)
starts = [i for i in range(1, len(states))
if states[i] == 1 and states[i - 1] == 0]
lens = []
i = 0
while i < len(states):
if states[i] == 1:
j = i
while j < len(states) and states[j] == 1:
j += 1
lens.append(j - i)
i = j
else:
i += 1
print(" bear spells {}, mean length {:.1f} months".format(
len(lens), sum(lens) / len(lens)))
print(" threshold median delay missed spells false alarms/bull mo")
for th in (0.3, 0.5, 0.7):
delays, missed = [], 0
for st in starts:
k = st
while k < len(states) and states[k] == 1 and probs[k] <= th:
k += 1
if k < len(states) and states[k] == 1:
delays.append(k - st + 1)
else:
missed += 1
delays.sort()
bull = [probs[i] for i in range(len(states)) if states[i] == 0]
print(" {:9.1f} {:12d} {:13.3f} {:20.3f}".format(
th, delays[len(delays) // 2], missed / len(starts),
sum(q > th for q in bull) / len(bull)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《体制转换分数凯利、最大回撤约束与生命周期杠杆配置》第 3 章「隐藏的体制:熊市能多快被识别,体制感知的凯利能带来什么」(版本 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090256
DOI: 10.5281/zenodo.24090256 · 阅读本章所在专著 · 5DL-B-098 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026098,
author = {Fan, Yafu},
title = {Regime-Switching Fractional Kelly, Maximum-Drawdown Constraints and Lifecycle Leverage Allocation},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.24090256},
url = {https://doi.org/10.5281/zenodo.24090256}
}