关于「按节庆对齐的同比:事件时间映射、斋月切分与日期误差」,《马来西亚移动节庆与促销排期》给出的定量结论是什么?
结论:第六章给出按节庆对齐的月度同比,全年平均绝对误差由 0.054 降到 0.017。
数据口径:书中销售序列与提前天数为示意;全部计算由书中程序生成。 第二章量化同比失真:在一家示意门店中,开斋节从四月移入三月,使三月同日同比为加 0.289、四月为减 0.218,而真实增长只有百分之四;用真实节日日期,十二对比较的平均绝对误差为 0.180。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.017, 0.054
| true growth +0.040; month | same-date YoY | aligned YoY |
| Jan | +0.157 | +0.044 |
| Feb | -0.089 | +0.055 |
| Mar | +0.164 | +0.040 |
| Apr | -0.096 | +0.071 |
| May | +0.055 | +0.048 |
| Jun | +0.049 | +0.056 |
| Jul | +0.050 | +0.047 |
| Aug | +0.066 | +0.066 |
| Sep | +0.057 | +0.075 |
| Oct | +0.086 | +0.070 |
| Nov | +0.064 | +0.057 |
| Dec | +0.039 | +0.050 |
| mean abs error: same-date 0.054, aligned 0.017 | ||
| worst month: | same-date 0.136, aligned 0.035 |
查看完整验算程序
# Chapter 6. p61: a festival-aligned calendar map for monthly YoY.
# Model (illustrative): a shop serving all three communities. Daily
# sales = 1000 x (1 + G) per year x weekday factor x (1 + sum of
# weight x (lift - 1)) x lognormal noise (sigma 0.08, fixed seed),
# with the lift profile of p21 around each festival and weights
# CNY 0.5, Aidilfitri 0.6, Deepavali 0.3. Dates: the official 2024
# and 2025 dates. Aligned map: a day within -28..+6 of a festival is
# paired with the same event day last year; any other day is paired
# with the day 364 days earlier (same weekday).
import math
import random
from datetime import date, timedelta
G, SIG, LO, HI = 0.04, 0.08, -28, 6
WEEK = [1.0, 0.95, 0.95, 1.0, 1.1, 1.25, 1.2]
FEST = {"CNY": (0.5, {2024: date(2024, 2, 10), 2025: date(2025, 1, 29)}),
"RAYA": (0.6, {2024: date(2024, 4, 10), 2025: date(2025, 3, 31)}),
"DEEP": (0.3, {2024: date(2024, 10, 31),
2025: date(2025, 10, 20)})}
MON = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split()
def lift(k):
if -21 <= k <= -1:
return 1.0 + 1.2 * (22 + k) / 21
if 0 <= k <= 2:
return 0.35
if 3 <= k <= 6:
return 0.8
return 1.0
def sales(rng):
s, d = {}, date(2023, 12, 1)
while d <= date(2025, 12, 31):
x = [1.0] + [w * (lift((d - t.get(d.year, t[2024])).days) - 1)
for w, t in FEST.values()]
v = 1000.0 * (1 + G) ** (d.year - 2024) * WEEK[d.weekday()]
s[d] = v * math.fsum(x) * math.exp(rng.gauss(0.0, SIG))
d += timedelta(days=1)
return s
def partner(d, fests):
best = None
for name, (w, t) in fests.items():
k = (d - t[d.year]).days
if LO <= k <= HI and (best is None or abs(k) < abs(best[1])):
best = (name, k)
if best is None:
return d - timedelta(days=364)
return fests[best[0]][1][d.year - 1] + timedelta(days=best[1])
if __name__ == "__main__":
s = sales(random.Random(20261113))
print("true growth {:+.3f}; month same-date YoY aligned YoY".format(G))
en, ea = [], []
for m in range(1, 13):
days = [d for d in s if d.year == 2025 and d.month == m]
cur = math.fsum(s[d] for d in days)
old = math.fsum(s[d] for d in s if d.year == 2024 and d.month == m)
ali = math.fsum(s[partner(d, FEST)] for d in days)
en.append(abs(cur / old - 1 - G))
ea.append(abs(cur / ali - 1 - G))
print(" {} {:+.3f} {:+.3f}".format(
MON[m - 1], cur / old - 1, cur / ali - 1))
print("mean abs error: same-date {:.3f}, aligned {:.3f}".format(
math.fsum(en) / 12, math.fsum(ea) / 12))
print("worst month: same-date {:.3f}, aligned {:.3f}".format(
max(en), max(ea)))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《马来西亚多元节庆移动日历叠加、开斋节农历新年屠妖节浮动日期与促销排期对齐母典》第 6 章「按节庆对齐的同比:事件时间映射、斋月切分与日期误差」(版本 1.0.0). 5D Library. DOI 待发布
DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-313 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026313,
author = {Fan, Yafu},
title = {Moving Festival Calendars in Multicultural Malaysia: Overlaps of Hari Raya, Chinese New Year and Deepavali and the Alignment of Promotional Schedules},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
note = {DOI pending}
}