rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
TYEclipse/dsh-probstat
Deterministic probability & statistical inference math for DeepSeek Harness: distribution calculator, z-table math, confidence intervals (z/t/Wilson), event-probability identities, one-sample hypothesis tests (z/t/proportion) and sample-size planning — zero runtime dependencies
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:TYEclipse/dsh-probstat
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
Deterministic probability & statistical-inference math for DeepSeek Harness (dsh). Nine zero-runtime-dependency tools that replace the math agents get wrong most often: hallucinated z-table values, distribution cdf/quantile errors, wrong critical values, sloppy compound-event identities, mis-recalled test decisions, guessed study sizes, hand-waved A/B comparisons, "the variances look close enough" and "the effect is big" said without a number.
中文简介:DeepSeek Harness 概率与统计推断数学工具箱——分布计算(正态/二项/泊松/指数/均匀/几何的 pdf/cdf/生存函数/分位数/统计量)、标准正态 z 表换算、置信区间(均值 z/t + 比例 Wilson)、事件概率恒等式(并/交/条件/贝叶斯)、单样本假设检验(均值 z/t + 比例)、目标误差所需样本量(Wald / Wilson)、双样本检验(均值 z/Welch/合并方差 + 双比例)、方差比 F 检验(该走 Welch 还是合并方差)、效应量(Cohen's d + 区间 + CLES + TOST 等效性检验)。零运行时依赖,纯确定性计算。
dsh plugin --profile web add github:TYEclipse/dsh-probstat
| Tool | What it does |
|---|---|
dist_calc |
pdf / cdf / survival / quantile / stats for 6 distributions |
z_score |
standard-normal table math (z ↔ probability) |
confidence_interval |
mean intervals (z or t) and Wilson proportion intervals |
event_probability |
union / intersection / conditional / Bayes / complement / at-least-one |
hypothesis_test |
one-sample z / t / proportion tests with p-values and the decision |
sample_size |
sample size for a target margin of error (mean, proportion) |
two_sample_test |
two-group comparisons: difference of means (z / Welch / pooled) and of proportions |
variance_ratio |
F test on two sample variances — pooled or Welch for the t test? |
effect_size |
Cohen's d, its interval, CLES and a TOST equivalence test |
Distributions: normal (mean, sd — default standard normal), binomial (n, p), poisson (lambda), exponential (rate lambda), uniform (a, b), geometric (p). Operations: pdf, cdf (P(X ≤ x)), survival (P(X > x)), quantile (inverse cdf at probability q), stats (mean / variance / sd).
Examples:
distribution: "normal", x: 1.96 → cdf 0.9750022 (P(Z ≤ 1.96))distribution: "binomial", operation: "quantile", n: 10, p: 0.5, q: 0.95 → 8distribution: "poisson", operation: "survival", lambda: 3, x: 5 → 0.08391794distribution: "geometric", operation: "stats", p: 0.5 → mean 1, variance 2Conventions: the geometric distribution counts failures before the first success (support k ≥ 0, P(X = k) = p·(1−p)^k). Quantiles of discrete distributions return the smallest k with P(X ≤ k) ≥ q.
Modes: to_prob (z → probability + percentile), from_prob (probability → z), two_sided (z → two-tailed p-value), between (z1, z2 → probability between; order is sorted internally).
mode: "between", z1: -1.96, z2: 1.96 → 0.9500043mode: "two_sided", z: 2.5 → p-value 0.01241936Kinds: mean_z (population mean, known sigma), mean_t (population mean, unknown sigma; Student-t with df = n − 1), proportion (Wilson score interval — stays valid for small samples and extreme proportions, unlike the naive Wald interval). Default confidence level 0.95.
kind: "mean_t", mean: 72.5, sd: 8.2, n: 25 → [69.115, 75.885] (t* = 2.0639, df = 24)kind: "proportion", successes: 40, n: 100 → [0.30940, 0.49800]kind: "proportion", successes: 0, n: 50 → [0, 0.07135]Operations: union (P(A or B); independent default true, false treats events as mutually exclusive), intersection (independent events), conditional (P(A|B) = P(A and B)/P(B)), bayes (posterior from prior, true-positive and false-positive rates), complement, at_least_one (1 − (1−p)^n).
operation: "bayes", prior: 0.001, truePositive: 0.99, falsePositive: 0.01 → 0.09016operation: "at_least_one", p: 0.05, n: 20 → 0.64151Kinds: mean_z (known sigma), mean_t (unknown sigma; Student-t with df = n − 1), proportion (against p0, normal approximation). Optional tail (two-sided default, left, right) and alpha (default 0.05). Every run reports the statistic, the standard error, all three p-values, the tail-specific critical value and the decision.
kind: "mean_z", sampleMean: 102, mu0: 100, sigma: 15, n: 36 → z 0.8, two-sided p 0.4237108, critical 1.959964 → do not rejectkind: "mean_t", sampleMean: 5.2, mu0: 5, sd: 1.5, n: 12, tail: "right" → t 0.4618802, df 11, p 0.3265839kind: "proportion", successes: 40, n: 100, p0: 0.5 → z -2, two-sided p 0.0455003 → reject at 0.05The proportion kind warns (in note) when the normal approximation is shaky (n·p0 < 5) rather than quietly returning a p-value.
Kinds: mean_z (n = (z·σ/E)²) and proportion (method: "wald" default: n = z²p(1−p)/E²; method: "wilson": the smallest n whose Wilson half-width meets E). p defaults to 0.5, the conservative worst case.
kind: "mean_z", sigma: 15, marginOfError: 5 → n 35 (exact 34.573129)kind: "proportion", p: 0.5, marginOfError: 0.03 → n 1068 (Wald)kind: "proportion", p: 0.5, marginOfError: 0.03, method: "wilson" → n 1064 (smallest n whose Wilson interval is that narrow)Two independent groups. Kinds: mean_z (difference of means, known population sigmas), mean_welch (unknown sigmas, unequal variances — Welch t with the fractional Welch–Satterthwaite df), mean_pooled (unknown sigmas, equal-variance pooled t with df = n₁ + n₂ − 2) and proportion (difference of two proportions, pooled normal approximation). Optional delta0 (the null-hypothesis difference, default 0), tail and alpha. Every run reports both estimates, the difference, the standard error, the statistic, the df, all three p-values, the tail-specific critical value and the decision.
kind: "mean_z", mean1: 102, mean2: 98, sigma1: 10, sigma2: 12, n1: 40, n2: 50 → z 1.7245225, two-sided p 0.0846135 → do not reject at 0.05kind: "mean_welch", mean1: 5.2, mean2: 4.6, sd1: 1.1, sd2: 0.9, n1: 12, n2: 15 → t 1.5248215, df 21.166825 (fractional by construction), two-sided p 0.1421069kind: "mean_pooled" on the same data → pooled variance 0.986, df 25, t 1.5601529kind: "proportion", successes1: 45, n1: 100, successes2: 32, n2: 90 → pooled p 0.40526316, z 1.3240058, one-sided p 0.0927506Welch is the right default when the variances were not designed to be equal; pick mean_pooled only when equal variances are a stated assumption. The Welch df is reported unrounded — rounding it to an integer silently changes the p-value. The proportion kind flags a shaky approximation (smallest expected cell < 5) instead of hiding it.
The F test on sd1² / sd2² — the check behind the sentence "the variances were about the same, so I used the pooled t test". Give both spreads and both sample sizes (each n >= 2); optional alpha (default 0.05) and tail (two-sided default, left, right). One-sided calls put the whole alpha in one tail, so the critical bound differs from the two-sided one — both are reported.
sd1: 1.1, sd2: 0.9, n1: 12, n2: 15 → F(11, 14) 1.4938272, two-sided p 0.47360638, bounds [0.29772447, 3.0945898] → do not reject equal variancessd1: 2, sd2: 1, n1: 20, n2: 20 → F(19, 19) 4, two-sided p 0.0040359154 → reject; guidance mean_welchguidance names the two-sample t route the data argue for, and it deliberately does not call a non-significant F test proof of equal variances: the F test assumes both samples are normal and has little power at small n, so the note says so and still recommends Welch as the safe default. Use the verdict as "the pooled route is defensible", never as "the variances are equal".
Cohen's d for two independent groups with the interval that says how precise it is — the number a p-value cannot give you. Give mean1, mean2, sd1, sd2, n1, n2 (each n >= 2); optional conf (default 0.95), and equivalenceMargin (positive, in the units of the means) plus alpha (default 0.05) to run an equivalence test. Returns the raw difference, the pooled sd, d, Hedges g (small-sample correction), the d interval, the common-language effect size (probability that a random draw from group 1 exceeds one from group 2) and Cohen's conventional magnitude label.
mean1: 5.2, mean2: 4.6, sd1: 1.1, sd2: 0.9, n1: 12, n2: 15 → d 0.60424462, Hedges g 0.58593418, 95% interval [-0.1717658, 1.380255], CLES 0.66540697, magnitude medium — note that the interval still spans 0, i.e. "medium-sized but imprecise", not "significant"mean1: 0.05, mean2: 0, sd1: 1, sd2: 1, n1: 50, n2: 50, equivalenceMargin: 0.5 → TOST p 0.013342614 (lower 0.003548887, upper 0.013342614) → equivalent at 0.05mean1: 0.6, mean2: 0, sd1: 1, sd2: 1, n1: 12, n2: 15, equivalenceMargin: 0.5 → the same margin is not established (p 0.60081641)Two boundaries worth knowing: a small p-value answers "is there an effect", while d answers "how big", and neither answers "is it big enough to ignore" — that is the equivalence test's job, and it needs a margin you choose. The interval around d is the large-sample normal approximation, so it is optimistic at small n; the TOST is run on the raw mean difference, so equivalenceMargin is in the units of the means, not in d.
P(F ≤ x) = I_y(df1/2, df2/2) with y = df1·x/(df1·x + df2), i.e. the same regularized incomplete beta the t distribution uses; critical values by bisection. Cross-checked against published F-table values (F(0.95; 2, 10) = 4.102821, F(0.95; 5, 20) = 2.710890, F(0.95; 1, 1) = 161.4476).SE(d) = √((n1+n2)/(n1·n2) + d²/(2(n1+n2)))), Hedges g applies the 1 − 3/(4·df − 1) correction, and the equivalence test is a TOST on the raw difference with two one-sided t-tests at the pooled df.valid: false with an explanatory error string; no tool ever throws on bad numeric input.pnpm install
pnpm build
pnpm test # 70 tests; anchors from test/oracle/anchors.py (independent Python oracle)
pnpm lint
MIT
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek-harness。