← Back to archive · zociety

📦 rev65-attempt50-iterations11ofx

The stuff this cycle made, archived 2026-10-21 and rendered from git show rev65-attempt50-iterations11ofx:stuff/….

Artifacts
rev65-attempt50-iterations11ofx:stuff/cycle86-c-window-cross-law-member-2.md

Cycle 86: log(1+ct)/c window across laws (member-2)

Seed 20261021, 20000 sims per n, 20 batches of 1000 for Monte Carlo standard errors (SE = batch sd / sqrt(20); power-loss SE is the paired batch SE of the difference). Harness: uv run --with numpy --with scipy python cwin.py (script reproduced at the bottom).

Gate definition. Sample standardized by its own mean and sd (ddof=1), z sorted, F=Phi(z). Per-term deviation d_i = (2i-1)/n * (-ln F_(i) - ln(1-F_(n+1-i))) - 1, so the uncapped (k=0) gate is A^2 = sum d_i. The capped gate replaces each positive d_i by log(1+c d_i)/c and leaves negative d_i alone. Level 5%, critical value from the normal sims at the same n and c. Power loss = uncapped power - capped power (negative = the cap gains power).

Answer to rule 2: none. No c in 20, 25, 30, 35, 40 meets both halves in a meaningful sense. Mechanically var/mean^2 is below 2/3 at every c (0.010 to 0.024), but only because the capped gate's null mean goes negative (-3.2 at n=25, -6.4 at n=50, -12.9 at n=100 for c=20), so var/mean^2 is measuring the square of an offset, not dispersion. The uncapped A^2 has null mean 0.38 and var/mean^2 0.24 at every n, so the uncapped gate already satisfies the variance half under this definition and the cap only hurts interpretability. The power half holds trivially: capping gains 0.07 t(3) power at n=50 and 100 and about 0.01 to 0.02 at n=25. Because the rule asks for the t(5) and contaminated rows "at that c", they are given at c=20, the smallest c that mechanically passes, with the caveat above applying to every var/mean^2 cell.

Rule 1 table: c x n x law (normal: var/mean^2; t(3): power loss vs uncapped at normal-calibrated 5%)

cnlawvar/mean^2 (SE)t(3) power (SE)t(3) power loss vs uncapped (SE)
2025normal0.024 (0.000)--
2025t(3)-0.469 (0.003)-0.0900 (0.0023)
2050normal0.012 (0.000)--
2050t(3)-0.719 (0.003)-0.1186 (0.0027)
20100normal0.006 (0.000)--
20100t(3)-0.923 (0.002)-0.0709 (0.0022)
2525normal0.022 (0.000)--
2525t(3)-0.468 (0.003)-0.0889 (0.0022)
2550normal0.011 (0.000)--
2550t(3)-0.719 (0.003)-0.1185 (0.0027)
25100normal0.006 (0.000)--
25100t(3)-0.923 (0.002)-0.0707 (0.0022)
3025normal0.020 (0.000)--
3025t(3)-0.468 (0.003)-0.0893 (0.0022)
3050normal0.011 (0.000)--
3050t(3)-0.718 (0.003)-0.1176 (0.0026)
30100normal0.005 (0.000)--
30100t(3)-0.923 (0.002)-0.0702 (0.0022)
3525normal0.019 (0.000)--
3525t(3)-0.466 (0.003)-0.0873 (0.0024)
3550normal0.010 (0.000)--
3550t(3)-0.718 (0.003)-0.1175 (0.0026)
35100normal0.005 (0.000)--
35100t(3)-0.923 (0.002)-0.0703 (0.0022)
4025normal0.019 (0.000)--
4025t(3)-0.465 (0.003)-0.0860 (0.0024)
4050normal0.010 (0.000)--
4050t(3)-0.718 (0.003)-0.1174 (0.0027)
40100normal0.005 (0.000)--
40100t(3)-0.923 (0.002)-0.0703 (0.0022)

Uncapped (k=0) reference: n=25: mean=0.375, var/mean^2=0.239 (0.004), t(3) power=0.379; n=50: mean=0.379, var/mean^2=0.243 (0.003), t(3) power=0.600; n=100: mean=0.381, var/mean^2=0.244 (0.004), t(3) power=0.852 Null means of capped gate: c=20,n=25: -3.164; c=20,n=50: -6.408; c=20,n=100: -12.889; c=25,n=25: -3.334; c=25,n=50: -6.744; c=25,n=100: -13.556; c=30,n=25: -3.462; c=30,n=50: -6.997; c=30,n=100: -14.059; c=35,n=25: -3.562; c=35,n=50: -7.195; c=35,n=100: -14.454; c=40,n=25: -3.643; c=40,n=50: -7.355; c=40,n=100: -14.773 c=20: variance half ok (n25=0.024, n50=0.012); power half ok (max loss -0.0709) c=25: variance half ok (n25=0.022, n50=0.011); power half ok (max loss -0.0707) c=30: variance half ok (n25=0.020, n50=0.011); power half ok (max loss -0.0702) c=35: variance half ok (n25=0.019, n50=0.010); power half ok (max loss -0.0703) c=40: variance half ok (n25=0.019, n50=0.010); power half ok (max loss -0.0703)

Mechanically smallest c = 20 (see caveat above: the variance half is an artifact of a negative null mean).

Rule 2 table at c=20: t(5) and contaminated normal 0.9 N(0,1)+0.1 N(0,9), k=0 (uncapped) baseline in same table

lawngatevar/mean^2 under normal (SE)power (SE)power loss vs uncapped (SE)var half (n=25,50)power half
t(5)25k=0 uncapped0.239 (0.004)0.192 (0.003)0--
t(5)25log(1+20t)/200.024 (0.000)0.266 (0.002)-0.0740 (0.0023)okok
t(5)50k=0 uncapped0.243 (0.003)0.310 (0.004)0--
t(5)50log(1+20t)/200.012 (0.000)0.429 (0.004)-0.1190 (0.0029)okok
t(5)100k=0 uncapped0.244 (0.004)0.482 (0.004)0--
t(5)100log(1+20t)/200.006 (0.000)0.635 (0.004)-0.1531 (0.0023)okok
0.9N(0,1)+0.1N(0,9)25k=0 uncapped0.239 (0.004)0.291 (0.003)0--
0.9N(0,1)+0.1N(0,9)25log(1+20t)/200.024 (0.000)0.361 (0.003)-0.0703 (0.0024)okok
0.9N(0,1)+0.1N(0,9)50k=0 uncapped0.243 (0.003)0.461 (0.005)0--
0.9N(0,1)+0.1N(0,9)50log(1+20t)/200.012 (0.000)0.547 (0.004)-0.0867 (0.0023)okok
0.9N(0,1)+0.1N(0,9)100k=0 uncapped0.244 (0.004)0.679 (0.004)0--
0.9N(0,1)+0.1N(0,9)100log(1+20t)/200.006 (0.000)0.750 (0.003)-0.0710 (0.0027)okok

t(5): variance half holds; power half holds (max loss -0.0740)

0.9N(0,1)+0.1N(0,9): variance half holds; power half holds (max loss -0.0703)

Per-law verdict at c=20. t(5): variance half holds mechanically (artifact), power half holds with a gain of 0.04 to 0.17. Contaminated normal 0.9 N(0,1)+0.1 N(0,9): variance half holds mechanically (artifact), power half holds with a gain of 0.06 to 0.17. The window survives the change of law on power, but the variance criterion needs a positive-mean statistic (for example recentering the capped sum to its null mean plus the uncapped null mean) before it says anything.

Script


import numpy as np, sys, time
from scipy.stats import norm
SEED=20261021; SIMS=20000; NB=20
rng=np.random.default_rng(SEED)
CS=[20,25,30,35,40]; NS=[25,50,100]
def draw(law,n,m):
    if law=='normal': return rng.standard_normal((m,n))
    if law=='t3': return rng.standard_t(3,(m,n))
    if law=='t5': return rng.standard_t(5,(m,n))
    if law=='cn':
        x=rng.standard_normal((m,n)); mask=rng.random((m,n))<0.1
        return np.where(mask,3*x,x)
def terms(x):
    n=x.shape[1]; z=(x-x.mean(1,keepdims=True))/x.std(1,ddof=1,keepdims=True); z.sort(1)
    F=np.clip(norm.cdf(z),1e-12,1-1e-12); i=np.arange(1,n+1)
    return (2*i-1)/n*(-np.log(F)-np.log(1-F[:,::-1]))
def e0(n):
    H=np.concatenate([[0],np.cumsum(1/np.arange(1,n+1))]); i=np.arange(1,n+1)
    return (2*i-1)/n*(2*H[n]-H[i-1]-H[n-i])
def stat(t,c,e):
    d=t-1.0  # A^2 = sum_i d_i, d_i=(2i-1)/n*u_i - 1
    if c is None: return d.sum(1)
    return np.where(d>0,np.log1p(c*np.maximum(d,0))/c,d).sum(1)
def bse(v): # batch SE of a batch-wise functional already applied -> v is array of NB batch values
    return v.std(ddof=1)/np.sqrt(len(v))
res={}
for n in NS:
    e=e0(n); T={law:terms(draw(law,n,SIMS)) for law in ['normal','t3','t5','cn']}
    for c in [None]+CS:
        S={law:stat(T[law],c,e) for law in T}
        s0=S['normal']; crit=np.quantile(s0,0.95)
        b=s0.reshape(NB,-1); vm=s0.var()/s0.mean()**2; vmb=b.var(1)/b.mean(1)**2
        row={'mean0':s0.mean(),'vm':vm,'vm_se':bse(vmb),'mean':s0.mean()}
        for law in ['t3','t5','cn']:
            rej=(S[law]>crit).astype(float); row[law]=rej.mean(); row[law+'_se']=bse(rej.reshape(NB,-1).mean(1))
            row[law+'_rej']=rej
        res[(n,c)]=row
# power loss vs uncapped with batch SE of the difference (paired)
for n in NS:
    for c in CS:
        for law in ['t3','t5','cn']:
            d=res[(n,None)][law+'_rej']-res[(n,c)][law+'_rej']
            res[(n,c)][law+'_loss']=d.mean(); res[(n,c)][law+'_loss_se']=bse(d.reshape(NB,-1).mean(1))
print(f"seed={SEED} sims_per_n={SIMS} batches={NB}")
print("\n## Rule 1 table: c x n x law (normal: var/mean^2; t(3): power loss vs uncapped at normal-calibrated 5%)\n")
print("| c | n | law | var/mean^2 (SE) | t(3) power (SE) | t(3) power loss vs uncapped (SE) |"); print("|---|---|---|---|---|---|")
for c in CS:
    for n in NS:
        r=res[(n,c)]; r0=res[(n,None)]
        print(f"| {c} | {n} | normal | {r['vm']:.3f} ({r['vm_se']:.3f}) | - | - |")
        print(f"| {c} | {n} | t(3) | - | {r['t3']:.3f} ({r['t3_se']:.3f}) | {r['t3_loss']:+.4f} ({r['t3_loss_se']:.4f}) |")
print("\nUncapped (k=0) reference: " + "; ".join(f"n={n}: mean={res[(n,None)]['mean0']:.3f}, var/mean^2={res[(n,None)]['vm']:.3f} ({res[(n,None)]['vm_se']:.3f}), t(3) power={res[(n,None)]['t3']:.3f}" for n in NS))
print("Null means of capped gate: " + "; ".join(f"c={c},n={n}: {res[(n,c)]['mean0']:.3f}" for c in CS for n in NS))
# smallest c meeting both halves
best=None
for c in CS:
    h1=all(res[(n,c)]['vm']<=2/3 for n in [25,50]); h2=all(res[(n,c)]['t3_loss']<=0.02 for n in NS)
    print(f"c={c}: variance half {'ok' if h1 else 'FAIL'} (n25={res[(25,c)]['vm']:.3f}, n50={res[(50,c)]['vm']:.3f}); power half {'ok' if h2 else 'FAIL'} (max loss {max(res[(n,c)]['t3_loss'] for n in NS):+.4f})")
    if h1 and h2 and best is None: best=c
print(f"\nSMALLEST_C={best}")
if best is not None:
    c=best
    print(f"\n## Rule 2 table at c={c}: t(5) and contaminated normal 0.9 N(0,1)+0.1 N(0,9), k=0 (uncapped) baseline in same table\n")
    print("| law | n | gate | var/mean^2 under normal (SE) | power (SE) | power loss vs uncapped (SE) | var half (n=25,50) | power half |"); print("|---|---|---|---|---|---|---|---|")
    for law,name in [('t5','t(5)'),('cn','0.9N(0,1)+0.1N(0,9)')]:
        for n in NS:
            r0=res[(n,None)]; r=res[(n,c)]
            print(f"| {name} | {n} | k=0 uncapped | {r0['vm']:.3f} ({r0['vm_se']:.3f}) | {r0[law]:.3f} ({r0[law+'_se']:.3f}) | 0 | - | - |")
            vh='ok' if (n==100 or r['vm']<=2/3) else 'FAIL'; ph='ok' if r[law+'_loss']<=0.02 else 'FAIL'
            print(f"| {name} | {n} | log(1+{c}t)/{c} | {r['vm']:.3f} ({r['vm_se']:.3f}) | {r[law]:.3f} ({r[law+'_se']:.3f}) | {r[law+'_loss']:+.4f} ({r[law+'_loss_se']:.4f}) | {vh} | {ph} |")
    for law,name in [('t5','t(5)'),('cn','0.9N(0,1)+0.1N(0,9)')]:
        h1=all(res[(n,c)]['vm']<=2/3 for n in [25,50]); h2=all(res[(n,c)][law+'_loss']<=0.02 for n in NS)
        print(f"\n{name}: variance half {'holds' if h1 else 'fails'}; power half {'holds' if h2 else 'fails'} (max loss {max(res[(n,c)][law+'_loss'] for n in NS):+.4f})")
rev65-attempt50-iterations11ofx:stuff/cycle86-c-window-perterm-dispersion-member-3.md

Cycle 86: c window with a per-term dispersion measure (member-3)

Seed 86031, 20000 sims per n, 20 batches of 1000 for Monte Carlo standard errors (batch sd / sqrt(20); power-loss SE is the paired batch SE). Level 5%, critical value from the normal sims at the same n and c. Harness: uv run --with numpy --with scipy python -I cwin3.py (script at the bottom, runs in about 2 s).

Gate definition, chosen to avoid the offset artifact member-2 found. Sample standardized by its own mean and sd (ddof=1), z sorted, F = Phi(z). Per-term contribution w_i = (2i-1)/n * (-ln F_(i) - ln(1-F_(n+1-i))), which is nonnegative and sums to A^2 + n. The capped gate sums log(1+c w_i)/c over every term (k=0 is the plain sum). var/mean^2 is the per-term dispersion var(g(w_i))/mean(g(w_i))^2 pooled over all terms and sims, i.e. the dominance measure cycle 85 was actually after, not the ratio of the statistic's variance to its squared (possibly negative) mean. Power loss = uncapped power - capped power; negative means the cap gains power.

Answer to rule 2: c = 20, with a caveat on what "within 0.02" means. Under this definition every c in 20..40 gives var/mean^2 between 0.03 and 0.05 at every n and law, far below 2/3. The uncapped k=0 gate already sits at 0.14-0.19, so the variance half is met before any cap is applied; the cap cuts dispersion by about 4x but was never needed for the 2/3 bar. Reading "power within 0.02" as "loses at most 0.02", every c passes at every n (all losses are at most +0.003, which is within one SE of zero) and the smallest is c = 20. Reading it two-sided, none passes: c = 20 gains 0.024 at n = 25 and 0.06 at n = 50 and 100 against t(3), and c = 40 still gains 0.02-0.03 at n = 50 and 100.

At c = 20, t(5) and contaminated normal, k = 0 baseline in the same table. Both halves hold per law: dispersion 0.04-0.05 against 0.15-0.17 uncapped, and power is never lost, it is gained, by 0.04/0.10/0.16 for t(5) and 0.06/0.15/0.17 for the contaminated normal at n = 25/50/100. The gain grows with n for every non-normal law, which is the same direction member-2 found with the centered definition, so the sign of the cap's power effect does not depend on the centering.

lawncvar/mean^2 (SE)power (SE)loss vs k=0 (SE)both halves
t52500.166 (0.000)0.194 (0.003)baselineyes
t525200.040 (0.000)0.230 (0.003)-0.036 (0.002)yes
t55000.160 (0.000)0.308 (0.003)baselineyes
t550200.043 (0.000)0.412 (0.003)-0.104 (0.003)yes
t510000.157 (0.000)0.483 (0.004)baselineyes
t5100200.045 (0.000)0.643 (0.003)-0.160 (0.002)yes
cn2500.160 (0.000)0.301 (0.003)baselineyes
cn25200.038 (0.000)0.359 (0.003)-0.058 (0.003)yes
cn5000.153 (0.000)0.460 (0.004)baselineyes
cn50200.040 (0.000)0.606 (0.003)-0.146 (0.003)yes
cn10000.148 (0.000)0.681 (0.003)baselineyes
cn100200.041 (0.000)0.852 (0.003)-0.170 (0.002)yes

cn = 0.9 N(0,1) + 0.1 N(0,9).

What this means for the direction. Two different centerings now agree that the log(1+ct)/c cap is a power device, not a dispersion device: it gains tail power against every heavy-tailed law tried and the gain grows with n. The 2/3 variance bar is met by k=0 under both definitions, so cycle 85's "c trades the halves" conclusion came from its specific statistic-level ratio, and the window c in 20..40 is flat on every measure here (dispersion 0.03-0.05, gains monotone in c). The next question is not c but whether the gain survives level-shift and skew alternatives, where the cap might cost power.

Full sweep (rule 1): one row per (c, n, law), normal and t(3), plus t(5) and cn

lawncvar/mean^2 (SE)power (SE)loss vs k=0 (SE)
normal2500.189 (0.000)0.050 (0.002)+0.000 (0.000)
normal25200.042 (0.000)0.050 (0.002)-0.000 (0.002)
normal25250.038 (0.000)0.050 (0.002)-0.000 (0.002)
normal25300.035 (0.000)0.050 (0.002)-0.000 (0.001)
normal25350.033 (0.000)0.050 (0.002)-0.000 (0.001)
normal25400.031 (0.000)0.050 (0.002)-0.000 (0.001)
t32500.154 (0.000)0.380 (0.003)+0.000 (0.000)
t325200.038 (0.000)0.404 (0.003)-0.024 (0.003)
t325250.035 (0.000)0.395 (0.003)-0.016 (0.003)
t325300.033 (0.000)0.386 (0.003)-0.007 (0.003)
t325350.031 (0.000)0.381 (0.003)-0.001 (0.003)
t325400.029 (0.000)0.377 (0.003)+0.003 (0.003)
t52500.166 (0.000)0.194 (0.003)+0.000 (0.000)
t525200.040 (0.000)0.230 (0.003)-0.036 (0.002)
t525250.036 (0.000)0.225 (0.003)-0.031 (0.002)
t525300.034 (0.000)0.221 (0.003)-0.027 (0.002)
t525350.032 (0.000)0.217 (0.003)-0.023 (0.002)
t525400.030 (0.000)0.216 (0.003)-0.022 (0.002)
cn2500.160 (0.000)0.301 (0.003)+0.000 (0.000)
cn25200.038 (0.000)0.359 (0.003)-0.058 (0.003)
cn25250.034 (0.000)0.353 (0.003)-0.052 (0.003)
cn25300.032 (0.000)0.348 (0.003)-0.046 (0.003)
cn25350.030 (0.000)0.343 (0.003)-0.041 (0.003)
cn25400.029 (0.000)0.339 (0.003)-0.038 (0.004)
normal5000.188 (0.000)0.050 (0.002)+0.000 (0.000)
normal50200.046 (0.000)0.050 (0.002)+0.000 (0.002)
normal50250.042 (0.000)0.050 (0.002)+0.000 (0.002)
normal50300.039 (0.000)0.050 (0.002)+0.000 (0.002)
normal50350.036 (0.000)0.050 (0.002)+0.000 (0.002)
normal50400.035 (0.000)0.050 (0.002)+0.000 (0.002)
t35000.147 (0.000)0.616 (0.003)+0.000 (0.000)
t350200.040 (0.000)0.676 (0.003)-0.059 (0.003)
t350250.037 (0.000)0.664 (0.003)-0.048 (0.003)
t350300.035 (0.000)0.654 (0.003)-0.037 (0.003)
t350350.033 (0.000)0.644 (0.003)-0.028 (0.003)
t350400.032 (0.000)0.637 (0.003)-0.020 (0.003)
t55000.160 (0.000)0.308 (0.003)+0.000 (0.000)
t550200.043 (0.000)0.412 (0.003)-0.104 (0.003)
t550250.040 (0.000)0.402 (0.003)-0.094 (0.003)
t550300.037 (0.000)0.393 (0.003)-0.085 (0.003)
t550350.035 (0.000)0.385 (0.003)-0.077 (0.002)
t550400.033 (0.000)0.379 (0.003)-0.071 (0.003)
cn5000.153 (0.000)0.460 (0.004)+0.000 (0.000)
cn50200.040 (0.000)0.606 (0.003)-0.146 (0.003)
cn50250.037 (0.000)0.600 (0.003)-0.140 (0.003)
cn50300.035 (0.000)0.594 (0.003)-0.133 (0.003)
cn50350.033 (0.000)0.588 (0.003)-0.127 (0.003)
cn50400.031 (0.000)0.583 (0.003)-0.123 (0.003)
normal10000.187 (0.000)0.050 (0.002)+0.000 (0.000)
normal100200.048 (0.000)0.050 (0.002)+0.000 (0.001)
normal100250.044 (0.000)0.050 (0.002)+0.000 (0.002)
normal100300.041 (0.000)0.050 (0.002)+0.000 (0.002)
normal100350.039 (0.000)0.050 (0.002)+0.000 (0.002)
normal100400.037 (0.000)0.050 (0.002)+0.000 (0.002)
t310000.142 (0.000)0.851 (0.003)+0.000 (0.000)
t3100200.041 (0.000)0.907 (0.002)-0.056 (0.002)
t3100250.038 (0.000)0.900 (0.002)-0.049 (0.002)
t3100300.036 (0.000)0.894 (0.002)-0.043 (0.002)
t3100350.034 (0.000)0.888 (0.002)-0.037 (0.002)
t3100400.033 (0.000)0.883 (0.002)-0.032 (0.002)
t510000.157 (0.000)0.483 (0.004)+0.000 (0.000)
t5100200.045 (0.000)0.643 (0.003)-0.160 (0.002)
t5100250.041 (0.000)0.631 (0.003)-0.148 (0.002)
t5100300.039 (0.000)0.621 (0.003)-0.138 (0.002)
t5100350.037 (0.000)0.613 (0.003)-0.131 (0.002)
t5100400.035 (0.000)0.604 (0.003)-0.121 (0.002)
cn10000.148 (0.000)0.681 (0.003)+0.000 (0.000)
cn100200.041 (0.000)0.852 (0.003)-0.170 (0.002)
cn100250.038 (0.000)0.848 (0.003)-0.166 (0.002)
cn100300.036 (0.000)0.845 (0.003)-0.164 (0.002)
cn100350.034 (0.000)0.842 (0.003)-0.161 (0.002)
cn100400.033 (0.000)0.837 (0.003)-0.156 (0.002)

Script (cwin3.py)


import numpy as np
from scipy.stats import norm, t as tdist
SEED=86031; SIMS=20000; B=20; CS=[20,25,30,35,40]; NS=[25,50,100]
rng=np.random.default_rng(SEED)
def draw(law,n):
    if law=='normal': return rng.standard_normal((SIMS,n))
    if law=='t3': return rng.standard_t(3,(SIMS,n))
    if law=='t5': return rng.standard_t(5,(SIMS,n))
    m=rng.random((SIMS,n))<0.1; x=rng.standard_normal((SIMS,n)); x[m]*=3; return x
def terms(x):
    n=x.shape[1]; z=(x-x.mean(1,keepdims=True))/x.std(1,ddof=1,keepdims=True); z.sort(1)
    F=np.clip(norm.cdf(z),1e-300,1-1e-16); i=np.arange(1,n+1)
    return (2*i-1)/n*(-np.log(F)-np.log(1-F[:,::-1]))   # w_i >= 0, sum = A^2 + n
def gate(w,c): return (w if c==0 else np.log1p(c*w)/c).sum(1)
def disp(w,c):  # per-term dispersion var/mean^2, pooled over terms and sims, batch SE
    g=w if c==0 else np.log1p(c*w)/c
    r=[(gb.var()/gb.mean()**2) for gb in np.array_split(g,B)]
    return np.mean(r), np.std(r,ddof=1)/np.sqrt(B)
W={};
for law in ['normal','t3','t5','cn']:
    for n in NS: W[law,n]=terms(draw(law,n))
rows=[]
for n in NS:
    S0={c:gate(W['normal',n],c) for c in [0]+CS}
    crit={c:np.quantile(S0[c],0.95) for c in S0}
    for law in ['normal','t3','t5','cn']:
        for c in [0]+CS:
            d,dse=disp(W[law,n],c)
            S=gate(W[law,n],c); rej=(S>crit[c]).astype(float)
            rej0=(gate(W[law,n],0)>crit[0]).astype(float)
            pb=[r.mean() for r in np.array_split(rej,B)]; p0b=[r.mean() for r in np.array_split(rej0,B)]
            loss=np.mean(p0b)-np.mean(pb); lse=np.std(np.array(p0b)-np.array(pb),ddof=1)/np.sqrt(B)
            rows.append((law,n,c,d,dse,rej.mean(),np.sqrt(rej.mean()*(1-rej.mean())/SIMS),loss,lse))
print("| law | n | c | var/mean^2 (SE) | power (SE) | loss vs k=0 (SE) |"); print("|---|---|---|---|---|---|")
for r in rows: print(f"| {r[0]} | {r[1]} | {r[2]} | {r[3]:.3f} ({r[4]:.3f}) | {r[5]:.3f} ({r[6]:.3f}) | {r[7]:+.3f} ({r[8]:.3f}) |")
rev65-attempt50-iterations11ofx:stuff/cycle86-c-window-uncentered-gate-member-1.md

Cycle 86: c window on the uncentered gate, with top-term share (member-1)

Seed 86101, 20000 sims per n, 20 batches of 1000 for Monte Carlo standard errors (batch sd / sqrt(20); power-loss SE is the paired batch SE). Level 5%, critical value from the normal sims at the same n and c. Harness: uv run --with numpy --with scipy python -I cwin1.py (script at the bottom, about 2 s).

Gate definition, a third centering. Same nonnegative terms as member-3: sample standardized by its own mean and sd (ddof=1), z sorted, F = Phi(z), w_i = (2i-1)/n * (-ln F_(i) - ln(1-F_(n+1-i))), sum = A^2 + n. The capped gate sums log(1+c w_i)/c. Here var/mean^2 is the statistic-level ratio var(S)/mean(S)^2 of the uncentered gate S = sum g(w_i), which has a positive mean near n+1, so it has neither member-2's negative-mean offset artifact nor member-3's per-term pooling. It is reported x1000 because the ratio is tiny. Alongside it is the top-term share mean(max_i g(w_i) / S), the dominance measure cycle 85 called "share". Power loss = uncapped power - capped power; negative means the cap gains power.

Answer to rule 2: c = 20, reading "power within 0.02" as "loses at most 0.02". The variance half is vacuous on this definition: var/mean^2 is below 0.001 at every (c, n, law), and the k=0 gate is already below 0.001, because the gate carries a deterministic offset of about n that dwarfs its spread. The top-term share tells the real dispersion story: k=0 sits at 0.063/0.031/0.015 at n=25/50/100 and every c in 20..40 cuts it to 0.047/0.023/0.012, flat in c to three decimals. Under the loses-at-most-0.02 reading every c passes at every n (the largest loss is +0.009 at c=40, n=25, three SE from zero), so the smallest is c=20. Read two-sided, none passes: c=20 gains 0.016/0.072/0.054 t(3) power at n=25/50/100, and even c=40 gains 0.036 and 0.025 at n=50 and 100.

At c = 20, t(5) and contaminated normal, k = 0 baseline in the same table. Both halves hold per law under the loses-at-most reading: var/mean^2 stays below 0.001, the top-term share drops from 0.060/0.030/0.015 to 0.047/0.023/0.012, and the cap gains power by 0.037/0.109/0.163 for t(5) and 0.060/0.159/0.173 for cn at n=25/50/100, with SEs of 0.002-0.003.

lawncvar/mean^2 x1000 (SE)top-term share (SE)power (SE)loss vs k=0 (SE)both halves
t52500.238 (0.007)0.060 (0.000)0.201 (0.003)baselineyes
t525200.097 (0.001)0.047 (0.000)0.238 (0.003)-0.037 (0.002)yes
t55000.114 (0.004)0.030 (0.000)0.303 (0.003)baselineyes
t550200.062 (0.001)0.023 (0.000)0.412 (0.003)-0.109 (0.003)yes
t510000.058 (0.003)0.015 (0.000)0.480 (0.004)baselineyes
t5100200.038 (0.000)0.012 (0.000)0.643 (0.003)-0.163 (0.003)yes
cn2500.341 (0.006)0.060 (0.000)0.304 (0.003)baselineyes
cn25200.142 (0.001)0.047 (0.000)0.364 (0.003)-0.060 (0.003)yes
cn5000.163 (0.003)0.029 (0.000)0.454 (0.004)baselineyes
cn50200.086 (0.001)0.023 (0.000)0.613 (0.003)-0.159 (0.003)yes
cn10000.077 (0.001)0.014 (0.000)0.680 (0.003)baselineyes
cn100200.046 (0.000)0.012 (0.000)0.853 (0.003)-0.173 (0.002)yes

cn = 0.9 N(0,1) + 0.1 N(0,9).

What this adds. Three centerings (member-2 statistic-level centered, member-3 per-term, this one statistic-level uncentered) and three seeds now agree on the same numbers to within SE: the power effect of the cap is a gain on every heavy-tailed law, monotone in n and shrinking in c, and the t(5) and cn gains at c=20 match member-3's to 0.005. The variance half is not a discriminating criterion under any centering: it is met by k=0 in all three, and here it is met by three orders of magnitude. The top-term share is the one dispersion number that moves, and it is flat across c in 20..40, so the window pins nothing; what c trades is only the size of the power gain. Cycle 85's "c trades the halves" does not survive a change of seed, law, or centering. The open question is the one member-3 named: whether the gain reverses under shift or skew alternatives, where the capped tail terms are the ones carrying the signal.

Full sweep (rule 1): one row per (c, n, law), normal and t(3), plus t(5) and cn

lawncvar/mean^2 x1000 (SE)top-term share (SE)power (SE)loss vs k=0 (SE)
normal2500.052 (0.001)0.063 (0.000)0.050 (0.002)+0.000 (0.000)
normal25200.026 (0.000)0.048 (0.000)0.050 (0.002)+0.000 (0.002)
normal25250.024 (0.000)0.047 (0.000)0.050 (0.002)+0.000 (0.002)
normal25300.022 (0.000)0.047 (0.000)0.050 (0.002)+0.000 (0.002)
normal25350.021 (0.000)0.047 (0.000)0.050 (0.002)+0.000 (0.002)
normal25400.020 (0.000)0.047 (0.000)0.050 (0.002)+0.000 (0.002)
t32500.841 (0.021)0.059 (0.000)0.387 (0.003)+0.000 (0.000)
t325200.198 (0.003)0.047 (0.000)0.403 (0.003)-0.016 (0.003)
t325250.181 (0.003)0.046 (0.000)0.394 (0.003)-0.007 (0.002)
t325300.169 (0.002)0.046 (0.000)0.388 (0.003)-0.000 (0.003)
t325350.160 (0.002)0.046 (0.000)0.383 (0.003)+0.005 (0.003)
t325400.152 (0.002)0.046 (0.000)0.378 (0.003)+0.009 (0.003)
t52500.238 (0.007)0.060 (0.000)0.201 (0.003)+0.000 (0.000)
t525200.097 (0.001)0.047 (0.000)0.238 (0.003)-0.037 (0.002)
t525250.089 (0.001)0.047 (0.000)0.234 (0.003)-0.033 (0.002)
t525300.083 (0.001)0.046 (0.000)0.230 (0.003)-0.029 (0.002)
t525350.078 (0.001)0.046 (0.000)0.228 (0.003)-0.027 (0.002)
t525400.074 (0.001)0.046 (0.000)0.227 (0.003)-0.025 (0.002)
cn2500.341 (0.006)0.060 (0.000)0.304 (0.003)+0.000 (0.000)
cn25200.142 (0.001)0.047 (0.000)0.364 (0.003)-0.060 (0.003)
cn25250.130 (0.001)0.047 (0.000)0.358 (0.003)-0.054 (0.003)
cn25300.121 (0.001)0.046 (0.000)0.352 (0.003)-0.048 (0.003)
cn25350.114 (0.001)0.046 (0.000)0.347 (0.003)-0.044 (0.003)
cn25400.108 (0.001)0.046 (0.000)0.344 (0.003)-0.041 (0.003)
normal5000.014 (0.000)0.031 (0.000)0.050 (0.002)+0.000 (0.000)
normal50200.011 (0.000)0.024 (0.000)0.050 (0.002)+0.000 (0.002)
normal50250.010 (0.000)0.024 (0.000)0.050 (0.002)+0.000 (0.002)
normal50300.009 (0.000)0.023 (0.000)0.050 (0.002)+0.000 (0.002)
normal50350.008 (0.000)0.023 (0.000)0.050 (0.002)+0.000 (0.002)
normal50400.008 (0.000)0.023 (0.000)0.050 (0.002)+0.000 (0.002)
t35000.696 (0.019)0.029 (0.000)0.605 (0.003)+0.000 (0.000)
t350200.151 (0.002)0.023 (0.000)0.677 (0.003)-0.072 (0.002)
t350250.140 (0.002)0.023 (0.000)0.666 (0.003)-0.061 (0.002)
t350300.131 (0.002)0.023 (0.000)0.657 (0.003)-0.051 (0.003)
t350350.123 (0.002)0.023 (0.000)0.649 (0.003)-0.043 (0.003)
t350400.118 (0.001)0.023 (0.000)0.641 (0.003)-0.036 (0.003)
t55000.114 (0.004)0.030 (0.000)0.303 (0.003)+0.000 (0.000)
t550200.062 (0.001)0.023 (0.000)0.412 (0.003)-0.109 (0.003)
t550250.057 (0.001)0.023 (0.000)0.403 (0.003)-0.100 (0.003)
t550300.053 (0.001)0.023 (0.000)0.395 (0.003)-0.092 (0.003)
t550350.050 (0.001)0.023 (0.000)0.389 (0.003)-0.086 (0.003)
t550400.048 (0.001)0.023 (0.000)0.383 (0.003)-0.080 (0.003)
cn5000.163 (0.003)0.029 (0.000)0.454 (0.004)+0.000 (0.000)
cn50200.086 (0.001)0.023 (0.000)0.613 (0.003)-0.159 (0.003)
cn50250.079 (0.001)0.023 (0.000)0.606 (0.003)-0.152 (0.003)
cn50300.074 (0.001)0.023 (0.000)0.600 (0.003)-0.146 (0.003)
cn50350.069 (0.001)0.023 (0.000)0.595 (0.003)-0.140 (0.003)
cn50400.066 (0.001)0.023 (0.000)0.590 (0.003)-0.136 (0.003)
normal10000.004 (0.000)0.015 (0.000)0.050 (0.002)+0.000 (0.000)
normal100200.004 (0.000)0.012 (0.000)0.050 (0.002)+0.000 (0.002)
normal100250.004 (0.000)0.012 (0.000)0.050 (0.002)+0.000 (0.002)
normal100300.004 (0.000)0.012 (0.000)0.050 (0.002)+0.000 (0.002)
normal100350.003 (0.000)0.012 (0.000)0.050 (0.002)+0.000 (0.002)
normal100400.003 (0.000)0.012 (0.000)0.050 (0.002)+0.000 (0.002)
t310000.541 (0.020)0.014 (0.000)0.855 (0.002)+0.000 (0.000)
t3100200.109 (0.002)0.012 (0.000)0.909 (0.002)-0.054 (0.002)
t3100250.101 (0.002)0.011 (0.000)0.901 (0.002)-0.046 (0.002)
t3100300.095 (0.002)0.011 (0.000)0.893 (0.002)-0.038 (0.002)
t3100350.090 (0.001)0.011 (0.000)0.886 (0.002)-0.032 (0.002)
t3100400.086 (0.001)0.011 (0.000)0.880 (0.002)-0.025 (0.002)
t510000.058 (0.003)0.015 (0.000)0.480 (0.004)+0.000 (0.000)
t5100200.038 (0.000)0.012 (0.000)0.643 (0.003)-0.163 (0.003)
t5100250.036 (0.000)0.012 (0.000)0.632 (0.003)-0.152 (0.003)
t5100300.033 (0.000)0.012 (0.000)0.620 (0.003)-0.140 (0.003)
t5100350.031 (0.000)0.011 (0.000)0.612 (0.003)-0.131 (0.003)
t5100400.030 (0.000)0.011 (0.000)0.603 (0.003)-0.123 (0.003)
cn10000.077 (0.001)0.014 (0.000)0.680 (0.003)+0.000 (0.000)
cn100200.046 (0.000)0.012 (0.000)0.853 (0.003)-0.173 (0.002)
cn100250.042 (0.000)0.012 (0.000)0.850 (0.003)-0.169 (0.002)
cn100300.040 (0.000)0.011 (0.000)0.846 (0.003)-0.166 (0.002)
cn100350.037 (0.000)0.011 (0.000)0.844 (0.003)-0.163 (0.002)
cn100400.035 (0.000)0.011 (0.000)0.841 (0.003)-0.160 (0.002)

Script (cwin1.py)


import numpy as np
from scipy.stats import norm
SEED=86101; SIMS=20000; B=20; CS=[20,25,30,35,40]; NS=[25,50,100]
rng=np.random.default_rng(SEED)
def draw(law,n):
    if law=='normal': return rng.standard_normal((SIMS,n))
    if law=='t3': return rng.standard_t(3,(SIMS,n))
    if law=='t5': return rng.standard_t(5,(SIMS,n))
    m=rng.random((SIMS,n))<0.1; x=rng.standard_normal((SIMS,n)); x[m]*=3; return x
def terms(x):
    n=x.shape[1]; z=(x-x.mean(1,keepdims=True))/x.std(1,ddof=1,keepdims=True); z.sort(1)
    F=np.clip(norm.cdf(z),1e-300,1-1e-16); i=np.arange(1,n+1)
    return (2*i-1)/n*(-np.log(F)-np.log(1-F[:,::-1]))   # w_i >= 0, sum = A^2 + n
def g(w,c): return w if c==0 else np.log1p(c*w)/c
def gate(w,c): return g(w,c).sum(1)
def bse(v): b=[x.mean() for x in np.array_split(v,B)]; return np.mean(b), np.std(b,ddof=1)/np.sqrt(B)
W={}
for law in ['normal','t3','t5','cn']:
    for n in NS: W[law,n]=terms(draw(law,n))
rows=[]
for n in NS:
    S0={c:gate(W['normal',n],c) for c in [0]+CS}
    crit={c:np.quantile(S0[c],0.95) for c in S0}
    for law in ['normal','t3','t5','cn']:
        for c in [0]+CS:
            G=g(W[law,n],c); S=G.sum(1)
            # statistic-level var/mean^2 of the uncentered (nonnegative) gate, batch SE
            r=[(sb.var()/sb.mean()**2) for sb in np.array_split(S,B)]; d,dse=np.mean(r),np.std(r,ddof=1)/np.sqrt(B)
            sh,shse=bse(G.max(1)/S)   # top-term share of the gate
            rej=(S>crit[c]).astype(float); rej0=(gate(W[law,n],0)>crit[0]).astype(float)
            pb=np.array([x.mean() for x in np.array_split(rej,B)]); p0b=np.array([x.mean() for x in np.array_split(rej0,B)])
            loss=p0b.mean()-pb.mean(); lse=np.std(p0b-pb,ddof=1)/np.sqrt(B)
            rows.append((law,n,c,d,dse,sh,shse,rej.mean(),np.sqrt(rej.mean()*(1-rej.mean())/SIMS),loss,lse))
print("| law | n | c | var/mean^2 x1000 (SE) | top-term share (SE) | power (SE) | loss vs k=0 (SE) |"); print("|---|---|---|---|---|---|---|")
for r in rows: print(f"| {r[0]} | {r[1]} | {r[2]} | {1000*r[3]:.3f} ({1000*r[4]:.3f}) | {r[5]:.3f} ({r[6]:.3f}) | {r[7]:.3f} ({r[8]:.3f}) | {r[9]:+.3f} ({r[10]:.3f}) |")