5D Library › Affiliate Network Power Laws, Influencer Portfolio Optimization and Incentive Stability Bounds · 中文

Chapter 8. Practice: A Year’s Ledger, Monitoring Concentration and a Pre-Registered Activation Experiment

A year’s ledger: when to pay commission

p14 builds a twelve-month ledger for a single-tier programme: retail sales grow about 4% a month, cost of goods is 20%, shipping 10%, payment fees 3%, commission 50%, and 6% of orders are refunded within thirty days. Two payout rules are compared: pay commission at the sale (and claw it back after a refund, recovering only four tenths), or pay it after the refund window has passed.

Calculation

# Chapter 8. p14: A year's ledger for a single-tier programme. Retail
# sales through affiliates start at RM 200,000 a month and grow 4% a
# month, with noise (sd 10%). Cost of goods 20%, shipping 10%, payment
# fees 3%, commission 50%. 6% of sales are refunded within 30 days. Two
# payout rules: pay commission at once (and try to claw back on refund,
# recovering only 40%), or hold it 30 days past the refund window. Also
# an activation bonus of RM 20 for 120 first sales a month. Seed 87.
import random

if __name__ == "__main__":
    rng = random.Random(87)
    print("   month   sales (RM)   refunds   contribution, pay at once"
          "   hold 30 days")
    tot = [0.0] * 4
    for m in range(1, 13):
        sales = 200000.0 * 1.04 ** (m - 1) * (1 + rng.gauss(0, 0.10))
        refund = 0.06 * sales
        kept = sales - refund
        base = kept * (1 - 0.20 - 0.10) - 0.03 * sales - 120 * 20
        held = base - 0.5 * kept
        at_once = base - 0.5 * sales + 0.4 * 0.5 * refund
        for i, v in enumerate((sales, refund, at_once, held)):
            tot[i] += v
        if m in (1, 6, 12):
            print("   {:5d}   {:10,.0f}   {:7,.0f}   {:25,.0f}   {:12,.0f}"
                  .format(m, sales, refund, at_once, held))
    print("   year    {:10,.0f}   {:7,.0f}   {:25,.0f}   {:12,.0f}"
          .format(*tot))
    print("   commission lost to refunds when paid at once: RM {:,.0f}"
          .format(tot[3] - tot[2]))
    print("   contribution margin (held): {:.3f}".format(tot[3] / tot[0]))
#    month   sales (RM)   refunds   contribution, pay at once   hold 30 days
#        1      207,877    12,473                      26,703         30,445
#        6      264,916    15,895                      34,688         39,457
#       12      326,591    19,595                      43,323         49,201
#    year     2,989,300   179,358                     389,702        443,509
#    commission lost to refunds when paid at once: RM 53,807
#    contribution margin (held): 0.148

Retail sales for the year are 2,989,300 ringgit and refunds 179,358. Paying at the sale, the year’s contribution is 389,702 ringgit; paying after the window, 443,509; the difference of 53,807 is commission paid on orders later refunded and never recovered. With commission held, the contribution margin is 0.148. The commission settlement cycle should end after the refund window; this one rule affects profit more directly than any incentive design.

Monitoring concentration month by month

p15 computes, each month for two thousand five hundred active affiliates, the Herfindahl index (HHI) (Rhoades 1993), the effective number of sellers (the inverse of HHI) and the shares of the top 1 and the top 10.

Calculation

# Chapter 8. p15: Watching concentration month by month. 2,500 active
# affiliates; each has a lasting level 10 x Lomax(1.5) (p02) and a
# monthly lognormal swing (log sd 0.5). Each month: the Herfindahl index
# HHI = sum of squared sales shares, the effective number of sellers
# 1 / HHI, and the shares of the top 1 and top 10. Then the revenue at
# risk if the top 1 or top 10 left. 12 months, seed 87.
import random
from math import exp

if __name__ == "__main__":
    rng = random.Random(87)
    level = [10.0 * ((1 - rng.random()) ** (-1 / 1.5) - 1)
             for _ in range(2500)]
    print("   month   HHI      effective sellers   top 1    top 10")
    rows = []
    for m in range(1, 13):
        s = [x * exp(rng.gauss(-0.125, 0.5)) for x in level]
        tot = sum(s)
        sh = sorted((x / tot for x in s), reverse=True)
        hhi = sum(x * x for x in sh)
        rows.append((hhi, 1 / hhi, sh[0], sum(sh[:10])))
        if m in (1, 4, 8, 12):
            print("   {:5d}   {:.4f}   {:17.0f}   {:.3f}   {:.3f}".format(
                m, *rows[-1]))
    lo = min(r[1] for r in rows)
    hi = max(r[1] for r in rows)
    print("   effective sellers over the year: {:.0f} to {:.0f} of 2,500"
          .format(lo, hi))
    print("   revenue at risk: top 1 leaves {:.3f}, top 10 leave {:.3f}"
          .format(sum(r[2] for r in rows) / 12, sum(r[3] for r in rows) / 12))
#    month   HHI      effective sellers   top 1    top 10
#        1   0.0071                 141   0.060   0.181
#        4   0.0066                 151   0.056   0.183
#        8   0.0066                 152   0.061   0.167
#       12   0.0130                  77   0.095   0.237
#    effective sellers over the year: 76 to 163 of 2,500
#    revenue at risk: top 1 leaves 0.069, top 10 leave 0.202

The effective number of sellers moves between 76 and 163 over the year: in concentration, two thousand five hundred active sellers are equivalent to a hundred or so. If the largest seller left, the average loss would be 0.069 of revenue; if the top ten left, 0.202. In month twelve the HHI jumps simply because one top seller had an especially good month: a heavy tail means that concentration itself jumps a lot, and a single month’s reading cannot be taken as a trend.

Note

Monitoring rules: report the effective number of sellers and the top-ten share monthly, and judge trends on a three-month moving average; build a retention plan for each of the top ten; whenever any single affiliate’s share exceeds one tenth, check for fake orders or self-purchase.

A pre-registered activation experiment

The hypothesis of Chapter 2 needs an experiment: new affiliates are assigned at random to no bonus or to a 20-ringgit first-sale bonus. p16 computes the sample size from the cohort settings of Chapter 2.

Calculation

# Chapter 8. p16: Sample size for a pre-registered test of the RM 20
# activation bonus of p03. Primary end point: the 30-day activation
# rate, compared as two proportions. Secondary end point: 12-month
# margin per recruit, whose spread is large because most recruits bring
# nothing and a few bring a lot. Both sized for a two-sided alpha of 0.05
# and power 0.80, using p03's cohort (seed 87) for the inputs:
# n = (1.96 sqrt(2 pb qb) + 0.84 sqrt(p1 q1 + p2 q2))^2 / d^2 per arm
# for rates, and n = 2 (1.96 + 0.84)^2 sd^2 / d^2 per arm for means.
import importlib.util
import random
from math import ceil, exp, sqrt

def load(name):
    spec = importlib.util.spec_from_file_location(name, name + ".py")
    m = importlib.util.module_from_spec(spec)
    spec.loader.exec_module(m)
    return m

p03 = load("p03_activation_bonus")

def margins(people, bonus):
    out = []
    for z, u in people:
        on = u < p03.logistic(-1.5 + z + 0.01 * bonus)
        out.append(120.0 * exp(0.8 * z - 0.32) if on else 0.0)
    return out

if __name__ == "__main__":
    people = p03.cohort(random.Random(87))
    a, b = margins(people, 0), margins(people, 20)
    p1 = sum(1 for x in a if x) / len(a)
    p2 = sum(1 for x in b if x) / len(b)
    pb = (p1 + p2) / 2
    n_rate = ceil((1.96 * sqrt(2 * pb * (1 - pb)) + 0.84 * sqrt(
        p1 * (1 - p1) + p2 * (1 - p2))) ** 2 / (p2 - p1) ** 2)
    m1, m2 = sum(a) / len(a), sum(b) / len(b)
    sd = sqrt(sum((x - m1) ** 2 for x in a) / (len(a) - 1))
    n_mean = ceil(2 * (1.96 + 0.84) ** 2 * sd ** 2 / (m2 - m1) ** 2)
    print("   activation: {:.3f} vs {:.3f}; recruits per arm {:,d}".format(
        p1, p2, n_rate))
    print("   margin per recruit (RM): {:.1f} vs {:.1f}, sd {:.1f};"
          " recruits per arm {:,d}".format(m1, m2, sd, n_mean))
    print("   ratio of sample sizes: {:.1f}".format(n_mean / n_rate))
#    activation: 0.220 vs 0.253; recruits per arm 2,506
#    margin per recruit (RM): 44.3 vs 49.3, sd 115.2; recruits per arm 8,303
#    ratio of sample sizes: 3.3

With the thirty-day activation rate as primary end point (0.220 against 0.253), each arm needs 2,506 people; with twelve-month margin per recruit as end point (44.3 against 49.3 ringgit, standard deviation 115.2), each arm needs 8,303, 3.3 times as many. The reason is that margin is heavy-tailed: most people contribute nothing and a few contribute a lot. The registered protocol should take activation as the primary end point and margin as secondary, and state in advance that no conclusion about profit will be drawn unless the sample for the margin end point is also reached.

Hypothesis · not established

The author’s interpretation (not yet tested): a 20-ringgit first-sale bonus raises the thirty-day activation rate by about three percentage points, but twelve-month margin after bonus costs does not differ significantly from the no-bonus group. What would show it wrong: the pre-registered experiment shows no significant rise in activation, or margin after bonus costs that is significantly higher (or lower) than in the no-bonus group.

Summary

Paying commission after the refund window keeps more than fifty thousand ringgit a year in the illustrative ledger; concentration should be monitored monthly and judged quarterly, with separate retention plans for the top affiliates; an activation-bonus experiment with activation as its primary end point needs only about a third of the sample that a margin end point would.

References

Rhoades, Stephen A. 1993. “The Herfindahl-Hirschman Index.” Federal Reserve Bulletin 79 (3): 188 to 189.

Fan, Y. (2026). Affiliate Network Power Laws, Influencer Portfolio Optimization and Incentive Stability Bounds: Heavy-Tailed Productivity, Markowitz Traffic Allocation and Single-Tier Commission Equilibria [分销网络幂律激活、网红矩阵组合优化与激励稳定边界] (Version 1.0.0). 5D Library. https://doi.org/10.5281/zenodo.24090229 · Licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0).