关于「去年同日的陷阱:节庆移动下的同比失真」,《马来西亚移动节庆与促销排期》给出的定量结论是什么?
结论:第二章量化同比失真:在一家示意门店中,开斋节从四月移入三月,使三月同日同比为加 0.289、四月为减 0.218,而真实增长只有百分之四;用真实节日日期,十二对比较的平均绝对误差为 0.180。
数据口径:书中销售序列与提前天数为示意;全部计算由书中程序生成。 第二章量化同比失真:在一家示意门店中,开斋节从四月移入三月,使三月同日同比为加 0.289、四月为减 0.218,而真实增长只有百分之四;用真实节日日期,十二对比较的平均绝对误差为 0.180。
对照数据表
下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.289
| true growth 0.040; Aidilfitri 2024-04-10 and 2025-03-31 | |||
| window | 2024 | 2025 | YoY |
| March, same dates | 38086 | 49103 | +0.289 |
| April, same dates | 38949 | 30459 | -0.218 |
| March+April, same dates | 77035 | 79562 | +0.033 |
| aligned day -28 to +6 | 49346 | 50712 | +0.028 |
| aligned day -35 to +13 | 64265 | 66708 | +0.038 |
| 52 weeks later, Mar-Apr | 77035 | 79726 | +0.035 |
查看完整验算程序
# Chapter 2. p21: same-date year-on-year against festival alignment.
# Model (illustrative): daily sales of one shop = 1000 units x true
# growth G per year x weekday factor x festival lift x noise. The
# lift rises linearly over the 21 days before Aidilfitri to 2.2 on
# the eve, falls to 0.35 on the first three days and 0.8 on the
# next four. Noise: lognormal, sigma 0.08, fixed seed. Festival
# dates are the announced ones (p12): 2024-04-10 and 2025-03-31.
# All sums use math.fsum. Standard library only.
import math
import random
from datetime import date, timedelta
G, BASE, SIG = 0.04, 1000.0, 0.08
WEEK = [1.0, 0.95, 0.95, 1.0, 1.1, 1.25, 1.2]
RAYA = {2024: date(2024, 4, 10), 2025: date(2025, 3, 31)}
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 series(rng):
s = {}
for y in (2024, 2025):
d = date(y, 1, 1)
while d.year == y:
k = (d - RAYA[y]).days
v = BASE * (1 + G) ** (y - 2024) * WEEK[d.weekday()]
s[d] = v * lift(k) * math.exp(rng.gauss(0.0, SIG))
d += timedelta(days=1)
return s
def total(s, days):
return math.fsum(s[d] for d in days)
def span(a, b):
return [a + timedelta(days=i) for i in range((b - a).days + 1)]
if __name__ == "__main__":
s = series(random.Random(20261113))
print("true growth {:.3f}; Aidilfitri {} and {}".format(
G, RAYA[2024], RAYA[2025]))
print("{:<26}{:>10}{:>10}{:>9}".format("window", "2024", "2025",
"YoY"))
rows = [("March, same dates", 3, 3), ("April, same dates", 4, 4),
("March+April, same dates", 3, 4)]
for name, m1, m2 in rows:
a = total(s, span(date(2024, m1, 1), date(2024, m2 + 1, 1)
- timedelta(days=1)))
b = total(s, span(date(2025, m1, 1), date(2025, m2 + 1, 1)
- timedelta(days=1)))
print("{:<26}{:>10.0f}{:>10.0f}{:>+9.3f}".format(name, a, b,
b / a - 1))
for lo, hi in ((-28, 6), (-35, 13)):
a = total(s, [RAYA[2024] + timedelta(days=k)
for k in range(lo, hi + 1)])
b = total(s, [RAYA[2025] + timedelta(days=k)
for k in range(lo, hi + 1)])
name = "aligned day {} to {:+d}".format(lo, hi)
print("{:<26}{:>10.0f}{:>10.0f}{:>+9.3f}".format(name, a, b,
b / a - 1))
a = total(s, span(date(2024, 3, 1), date(2024, 4, 30)))
b = total(s, [d + timedelta(days=364) for d in
span(date(2024, 3, 1), date(2024, 4, 30))])
print("{:<26}{:>10.0f}{:>10.0f}{:>+9.3f}".format(
"52 weeks later, Mar-Apr", a, b, b / a - 1))唯一数据源与引用
范雅福(Fan, Y.). (2026). 《马来西亚多元节庆移动日历叠加、开斋节农历新年屠妖节浮动日期与促销排期对齐母典》第 2 章「去年同日的陷阱:节庆移动下的同比失真」(版本 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}
}