math-skill 2.1.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. package/README.en-US.md +165 -198
  2. package/README.md +165 -198
  3. package/agents/math-critic.en.md +28 -26
  4. package/agents/math-critic.md +33 -33
  5. package/commands/ask.en.md +10 -0
  6. package/commands/ask.md +3 -10
  7. package/design-patterns/attention/equivariant-attention.en.md +72 -0
  8. package/design-patterns/attention/equivariant-attention.md +72 -0
  9. package/design-patterns/attention/geometry-aware-attention.en.md +73 -0
  10. package/design-patterns/attention/geometry-aware-attention.md +72 -0
  11. package/design-patterns/attention/information-bottleneck-attention.en.md +72 -0
  12. package/design-patterns/attention/information-bottleneck-attention.md +72 -0
  13. package/design-patterns/attention/projection-attention.en.md +68 -0
  14. package/design-patterns/attention/projection-attention.md +68 -0
  15. package/design-patterns/attention/spectral-attention.en.md +71 -0
  16. package/design-patterns/attention/spectral-attention.md +71 -0
  17. package/design-patterns/compression/leverage-score-selection.en.md +71 -0
  18. package/design-patterns/compression/leverage-score-selection.md +71 -0
  19. package/design-patterns/compression/low-rank-kv-cache.en.md +60 -0
  20. package/design-patterns/compression/low-rank-kv-cache.md +60 -0
  21. package/design-patterns/compression/spectral-token-pruning.en.md +61 -0
  22. package/design-patterns/compression/spectral-token-pruning.md +61 -0
  23. package/design-patterns/compression/topology-preserving-compression.en.md +64 -0
  24. package/design-patterns/compression/topology-preserving-compression.md +64 -0
  25. package/design-patterns/loss/constraint-penalty.en.md +67 -0
  26. package/design-patterns/loss/constraint-penalty.md +78 -0
  27. package/design-patterns/loss/contrastive-loss.en.md +59 -0
  28. package/design-patterns/loss/contrastive-loss.md +68 -0
  29. package/design-patterns/loss/information-bottleneck-loss.en.md +69 -0
  30. package/design-patterns/loss/information-bottleneck-loss.md +74 -0
  31. package/design-patterns/loss/orthogonality-loss.en.md +56 -0
  32. package/design-patterns/loss/orthogonality-loss.md +60 -0
  33. package/design-patterns/loss/variational-loss.en.md +61 -0
  34. package/design-patterns/loss/variational-loss.md +71 -0
  35. package/design-patterns/representation/equivariant-split.en.md +87 -0
  36. package/design-patterns/representation/equivariant-split.md +89 -0
  37. package/design-patterns/representation/manifold-representation.en.md +85 -0
  38. package/design-patterns/representation/manifold-representation.md +87 -0
  39. package/design-patterns/representation/shared-private-decomposition.en.md +84 -0
  40. package/design-patterns/representation/shared-private-decomposition.md +86 -0
  41. package/design-patterns/representation/subspace-alignment.en.md +90 -0
  42. package/design-patterns/representation/subspace-alignment.md +92 -0
  43. package/design-patterns/routing/graph-routing.en.md +79 -0
  44. package/design-patterns/routing/graph-routing.md +81 -0
  45. package/design-patterns/routing/moe-routing.en.md +85 -0
  46. package/design-patterns/routing/moe-routing.md +87 -0
  47. package/design-patterns/routing/optimal-transport-routing.en.md +68 -0
  48. package/design-patterns/routing/optimal-transport-routing.md +72 -0
  49. package/design-patterns/routing/spectral-clustering-routing.en.md +88 -0
  50. package/design-patterns/routing/spectral-clustering-routing.md +90 -0
  51. package/knowledge-base/differential-geometry/connection.en.md +51 -0
  52. package/knowledge-base/differential-geometry/connection.md +51 -0
  53. package/knowledge-base/differential-geometry/curvature.en.md +49 -0
  54. package/knowledge-base/differential-geometry/curvature.md +49 -0
  55. package/knowledge-base/differential-geometry/geodesic.en.md +51 -0
  56. package/knowledge-base/differential-geometry/geodesic.md +51 -0
  57. package/knowledge-base/differential-geometry/manifold.en.md +47 -0
  58. package/knowledge-base/differential-geometry/manifold.md +47 -0
  59. package/knowledge-base/differential-geometry/metric-tensor.en.md +50 -0
  60. package/knowledge-base/differential-geometry/metric-tensor.md +50 -0
  61. package/knowledge-base/differential-geometry/tangent-space.en.md +48 -0
  62. package/knowledge-base/differential-geometry/tangent-space.md +48 -0
  63. package/knowledge-base/information-geometry/fisher-metric.en.md +56 -0
  64. package/knowledge-base/information-geometry/fisher-metric.md +56 -0
  65. package/knowledge-base/information-geometry/natural-gradient.en.md +54 -0
  66. package/knowledge-base/information-geometry/natural-gradient.md +54 -0
  67. package/knowledge-base/lie-theory/equivariance.en.md +54 -0
  68. package/knowledge-base/lie-theory/equivariance.md +54 -0
  69. package/knowledge-base/lie-theory/group-action.en.md +51 -0
  70. package/knowledge-base/lie-theory/group-action.md +51 -0
  71. package/knowledge-base/lie-theory/lie-algebra.en.md +51 -0
  72. package/knowledge-base/lie-theory/lie-algebra.md +51 -0
  73. package/knowledge-base/lie-theory/lie-group.en.md +51 -0
  74. package/knowledge-base/lie-theory/lie-group.md +51 -0
  75. package/knowledge-base/lie-theory/representation.en.md +52 -0
  76. package/knowledge-base/lie-theory/representation.md +52 -0
  77. package/knowledge-base/matrix-analysis/low-rank-approximation.en.md +49 -0
  78. package/knowledge-base/matrix-analysis/low-rank-approximation.md +49 -0
  79. package/knowledge-base/matrix-analysis/matrix-perturbation.en.md +49 -0
  80. package/knowledge-base/matrix-analysis/matrix-perturbation.md +49 -0
  81. package/knowledge-base/matrix-analysis/positive-semidefinite.en.md +50 -0
  82. package/knowledge-base/matrix-analysis/positive-semidefinite.md +50 -0
  83. package/knowledge-base/matrix-analysis/projection.en.md +47 -0
  84. package/knowledge-base/matrix-analysis/projection.md +47 -0
  85. package/knowledge-base/matrix-analysis/spectral-decomposition.en.md +48 -0
  86. package/knowledge-base/matrix-analysis/spectral-decomposition.md +48 -0
  87. package/knowledge-base/optimization/constrained-optimization.en.md +53 -0
  88. package/knowledge-base/optimization/constrained-optimization.md +53 -0
  89. package/knowledge-base/optimization/convex-optimization.en.md +50 -0
  90. package/knowledge-base/optimization/convex-optimization.md +50 -0
  91. package/knowledge-base/optimization/lagrangian-duality.en.md +50 -0
  92. package/knowledge-base/optimization/lagrangian-duality.md +50 -0
  93. package/knowledge-base/optimization/proximal-method.en.md +52 -0
  94. package/knowledge-base/optimization/proximal-method.md +52 -0
  95. package/knowledge-base/optimization/riemannian-optimization.en.md +51 -0
  96. package/knowledge-base/optimization/riemannian-optimization.md +51 -0
  97. package/knowledge-base/overview.en.md +29 -218
  98. package/knowledge-base/overview.md +29 -220
  99. package/knowledge-base/probability/concentration-inequality.en.md +45 -0
  100. package/knowledge-base/probability/concentration-inequality.md +45 -0
  101. package/knowledge-base/probability/entropy.en.md +47 -0
  102. package/knowledge-base/probability/entropy.md +47 -0
  103. package/knowledge-base/probability/fisher-information.en.md +48 -0
  104. package/knowledge-base/probability/fisher-information.md +48 -0
  105. package/knowledge-base/probability/information-bottleneck.en.md +49 -0
  106. package/knowledge-base/probability/information-bottleneck.md +49 -0
  107. package/knowledge-base/probability/kl-divergence.en.md +51 -0
  108. package/knowledge-base/probability/kl-divergence.md +51 -0
  109. package/knowledge-base/topology/euler-characteristic.en.md +54 -0
  110. package/knowledge-base/topology/euler-characteristic.md +54 -0
  111. package/knowledge-base/topology/fundamental-group.en.md +52 -0
  112. package/knowledge-base/topology/fundamental-group.md +52 -0
  113. package/knowledge-base/topology/persistent-homology.en.md +54 -0
  114. package/knowledge-base/topology/persistent-homology.md +54 -0
  115. package/lenses/algorithmic.en.md +49 -0
  116. package/lenses/algorithmic.md +49 -0
  117. package/lenses/axiomatization.en.md +48 -0
  118. package/lenses/axiomatization.md +48 -0
  119. package/lenses/categorical.en.md +48 -0
  120. package/lenses/categorical.md +48 -0
  121. package/lenses/causal.en.md +49 -0
  122. package/lenses/causal.md +49 -0
  123. package/lenses/duality.en.md +47 -0
  124. package/lenses/duality.md +47 -0
  125. package/lenses/game.en.md +50 -0
  126. package/lenses/game.md +50 -0
  127. package/lenses/geometric.en.md +53 -0
  128. package/lenses/geometric.md +53 -0
  129. package/lenses/local-to-global.en.md +52 -0
  130. package/lenses/local-to-global.md +52 -0
  131. package/lenses/perturbation.en.md +51 -0
  132. package/lenses/perturbation.md +51 -0
  133. package/lenses/probabilistic.en.md +48 -0
  134. package/lenses/probabilistic.md +48 -0
  135. package/lenses/projection.en.md +50 -0
  136. package/lenses/projection.md +50 -0
  137. package/lenses/spectral.en.md +52 -0
  138. package/lenses/spectral.md +52 -0
  139. package/lenses/symmetry.en.md +49 -0
  140. package/lenses/symmetry.md +49 -0
  141. package/lenses/topological.en.md +48 -0
  142. package/lenses/topological.md +48 -0
  143. package/lenses/variational.en.md +48 -0
  144. package/lenses/variational.md +48 -0
  145. package/package.json +9 -3
  146. package/references/agentic-workflow.en.md +1 -1
  147. package/references/agentic-workflow.md +1 -1
  148. package/references/books/abstract-algebra.en.md +124 -0
  149. package/references/books/abstract-algebra.md +22 -22
  150. package/references/books/algebraic-geometry-rising-sea.en.md +171 -0
  151. package/references/books/algebraic-geometry-rising-sea.md +11 -11
  152. package/references/books/differential-geometry.en.md +140 -0
  153. package/references/books/differential-geometry.md +19 -19
  154. package/references/books/matrix-analysis.en.md +146 -0
  155. package/references/books/matrix-analysis.md +10 -10
  156. package/references/books/micro-lie-theory.en.md +116 -0
  157. package/references/books/micro-lie-theory.md +17 -17
  158. package/references/books/optimization-ml.en.md +163 -0
  159. package/references/books/optimization-ml.md +7 -8
  160. package/references/books/smooth-manifolds.en.md +105 -0
  161. package/references/books/smooth-manifolds.md +14 -14
  162. package/references/gpu-friendly-math.en.md +23 -10
  163. package/references/gpu-friendly-math.md +17 -4
  164. package/references/inspiration.en.md +1 -1
  165. package/references/inspiration.md +2 -2
  166. package/skills/math-research-activator/SKILL.en.md +195 -114
  167. package/skills/math-research-activator/SKILL.md +194 -119
  168. package/skills/math-research-activator/original-texts.en.md +9 -9
  169. package/skills/math-research-activator/original-texts.md +11 -11
  170. package/commands/abstraction.md +0 -11
  171. package/commands/algorithmic-thinking.md +0 -11
  172. package/commands/axiomatization.md +0 -11
  173. package/commands/causal-inference.md +0 -11
  174. package/commands/discrete-combinatorial.md +0 -11
  175. package/commands/game-theory.md +0 -11
  176. package/commands/induction-analogy.md +0 -11
  177. package/commands/information-theory.md +0 -11
  178. package/commands/logic-deduction.md +0 -11
  179. package/commands/modeling.md +0 -11
  180. package/commands/optimization.md +0 -11
  181. package/commands/probability-statistics.md +0 -11
  182. package/commands/symmetry-invariance.md +0 -11
  183. package/commands/topological-thinking.md +0 -11
  184. package/commands/transformation.md +0 -11
  185. package/skills/abstraction/SKILL.en.md +0 -117
  186. package/skills/abstraction/SKILL.md +0 -121
  187. package/skills/abstraction/original-texts.en.md +0 -163
  188. package/skills/abstraction/original-texts.md +0 -175
  189. package/skills/algorithmic-thinking/SKILL.en.md +0 -132
  190. package/skills/algorithmic-thinking/SKILL.md +0 -138
  191. package/skills/algorithmic-thinking/original-texts.en.md +0 -253
  192. package/skills/algorithmic-thinking/original-texts.md +0 -256
  193. package/skills/axiomatization/SKILL.en.md +0 -144
  194. package/skills/axiomatization/SKILL.md +0 -151
  195. package/skills/axiomatization/original-texts.en.md +0 -154
  196. package/skills/axiomatization/original-texts.md +0 -160
  197. package/skills/causal-inference/SKILL.en.md +0 -147
  198. package/skills/causal-inference/SKILL.md +0 -151
  199. package/skills/causal-inference/original-texts.en.md +0 -136
  200. package/skills/causal-inference/original-texts.md +0 -167
  201. package/skills/discrete-combinatorial/SKILL.en.md +0 -124
  202. package/skills/discrete-combinatorial/SKILL.md +0 -131
  203. package/skills/discrete-combinatorial/original-texts.en.md +0 -184
  204. package/skills/discrete-combinatorial/original-texts.md +0 -185
  205. package/skills/game-theory/SKILL.en.md +0 -117
  206. package/skills/game-theory/SKILL.md +0 -123
  207. package/skills/game-theory/original-texts.en.md +0 -131
  208. package/skills/game-theory/original-texts.md +0 -131
  209. package/skills/induction-analogy/SKILL.en.md +0 -145
  210. package/skills/induction-analogy/SKILL.md +0 -152
  211. package/skills/induction-analogy/original-texts.en.md +0 -140
  212. package/skills/induction-analogy/original-texts.md +0 -154
  213. package/skills/information-theory/SKILL.en.md +0 -134
  214. package/skills/information-theory/SKILL.md +0 -140
  215. package/skills/information-theory/original-texts.en.md +0 -127
  216. package/skills/information-theory/original-texts.md +0 -127
  217. package/skills/logic-deduction/SKILL.en.md +0 -130
  218. package/skills/logic-deduction/SKILL.md +0 -135
  219. package/skills/logic-deduction/original-texts.en.md +0 -160
  220. package/skills/logic-deduction/original-texts.md +0 -173
  221. package/skills/modeling/SKILL.en.md +0 -135
  222. package/skills/modeling/SKILL.md +0 -139
  223. package/skills/modeling/original-texts.en.md +0 -162
  224. package/skills/modeling/original-texts.md +0 -165
  225. package/skills/optimization/SKILL.en.md +0 -129
  226. package/skills/optimization/SKILL.md +0 -135
  227. package/skills/optimization/original-texts.en.md +0 -167
  228. package/skills/optimization/original-texts.md +0 -168
  229. package/skills/probability-statistics/SKILL.en.md +0 -146
  230. package/skills/probability-statistics/SKILL.md +0 -151
  231. package/skills/probability-statistics/original-texts.en.md +0 -191
  232. package/skills/probability-statistics/original-texts.md +0 -193
  233. package/skills/symmetry-invariance/SKILL.en.md +0 -135
  234. package/skills/symmetry-invariance/SKILL.md +0 -139
  235. package/skills/symmetry-invariance/original-texts.en.md +0 -206
  236. package/skills/symmetry-invariance/original-texts.md +0 -221
  237. package/skills/topological-thinking/SKILL.en.md +0 -124
  238. package/skills/topological-thinking/SKILL.md +0 -128
  239. package/skills/topological-thinking/original-texts.en.md +0 -134
  240. package/skills/topological-thinking/original-texts.md +0 -164
  241. package/skills/transformation/SKILL.en.md +0 -120
  242. package/skills/transformation/SKILL.md +0 -124
  243. package/skills/transformation/original-texts.en.md +0 -204
  244. package/skills/transformation/original-texts.md +0 -216
@@ -1,146 +0,0 @@
1
- ---
2
- name: probability-statistics
3
- description: |
4
- Trigger when a problem involves quantifying uncertainty, probability distributions, Bayesian inference, hypothesis testing, regression modeling, experimental design, causal effect estimation; or designing probabilistic mechanisms for random algorithms/sampling/quantization/training dynamics.
5
- ---
6
-
7
- # Probability & Statistics
8
-
9
- > "Uncertainty is quantifiable -- probability is not just a mathematical formula, but a way to understand the random world. Quantifying uncertainty, extracting patterns from data, and making rational inferences and decisions."
10
- >
11
- > -- Probability Theory, Mathematical Statistics
12
-
13
- ## Core Principle
14
-
15
- **The world is full of uncertainty. Rational decision-making is not the pursuit of certainty, but the pursuit of expected-value-optimal choices under uncertainty -- probability is quantified belief, and data is quantified evidence.**
16
-
17
- > **Mathematical Formalization**
18
- >
19
- > A probability space $(\Omega, \mathcal{F}, P)$ is defined by the Kolmogorov axioms: (1) **Non-negativity** $P(A) \ge 0$; (2) **Normalization** $P(\Omega) = 1$; (3) **Countable additivity**: for a countable family of mutually disjoint events $A_i$, $P(\cup_i A_i) = \sum_i P(A_i)$. From these follow the complement rule $P(A^c)=1-P(A)$ and the law of total probability $P(B)=\sum_i P(B|A_i)P(A_i)$.
20
- >
21
- > **Bayesian updating**: $P(\theta|D) = P(D|\theta)\cdot P(\theta)/P(D)$; prior -> likelihood -> posterior; the posterior becomes the new prior upon encountering new data.
22
- >
23
- > **Expectation and variance**: $E[X] = \sum x\cdot P(x)$ (discrete) or $\int x\cdot f(x)\,dx$ (continuous); $\text{Var}(X) = E[(X-\mu)^2] = E[X^2] - (E[X])^2$.
24
- >
25
- > **Law of Large Numbers / CLT**: As $n \to \infty$, the sample frequency $f/n \to P(A)$ and the sample mean $\bar{X} \to \mu$ (convergence in probability); $\sqrt{n}\cdot(\bar{X} - \mu)/\sigma \xrightarrow{d} N(0,1)$, so the superposition of many independent small factors tends toward normality.
26
- >
27
- > **Bias-variance trade-off**: Total error $= \text{Bias}^2 + \text{Variance} + \sigma^2$ (irreducible noise).
28
-
29
- ## GPU-Friendliness (Cross-Cutting Check)
30
-
31
- When probabilistic methods are used for **random algorithm / sampling / training dynamics design**, they must pass the eight-dimensional gate in `../../references/gpu-friendly-math.md`:
32
-
33
- - **Batch sampling / Monte Carlo**: i.i.d. sampling is naturally parallelizable and GEMM-friendly (reparameterization trick, Gumbel-Softmax); viable in low precision, but RNG state and cross-device consistency must be managed.
34
- - **MLE / log-likelihood**: Element-wise likelihood is fusible and batchable (friendly); softmax cross-entropy should use logsumexp for numerical stability.
35
- - **Exact Bayesian integration / marginalization**: In high dimensions, the normalization constant $Z=P(D)$ and marginalization of $P(\theta|D)\propto P(D|\theta)P(\theta)$ admit no closed form -- adapt to **MCMC (HMC/NUTS) / variational inference ELBO** (see `../../references/books/optimization-ml.md`).
36
- - **Large posterior tables / covariances**: Incomputable -- use mean-field / low-rank factorized approximations (see `../../references/books/matrix-analysis.md`).
37
- - **Anti-patterns**: Sample-sequential MCMC, exact inference requiring global normalization, "beautiful but incomputable" high-dimensional integrals.
38
-
39
- Eight-dimensional minimum assessment (formal terms): **Tensorization** -- whether samples, particles, and distribution parameters can be batched; **GEMM-mappability** -- whether likelihood, regression, and covariance computations fall into matrix operations; **Complexity** -- number of sampling steps, integration dimension, posterior table size; **Memory & KV-Cache** -- whether particles, covariances, and sufficient statistics can be low-rank / streaming; **Low-precision stability** -- logsumexp, probability normalization, tail probabilities; **Parallelism & communication** -- RNG and cross-device reductions; **Sparse structure** -- whether the graphical model / covariance is structured; **Operator fusion** -- whether sampling, scoring, and normalization can be fused.
40
-
41
- > Cross-reference `../../references/books/optimization-ml.md` (variational / SAA / stochastic optimization) and `../../references/books/matrix-analysis.md` (low-rank covariance).
42
-
43
- ## When NOT to Use
44
-
45
- - **Deterministic problems** (the answer is known or obtainable by deductive reasoning) -- probabilistic tools are unnecessary.
46
- - **Extremely small sample sizes ($n < 5$) that cannot be increased** -- one should report the data itself rather than draw inferences.
47
- - **Purely qualitative descriptive needs** -- data analysis is not required.
48
- - **Causal mechanisms are already well-established and require no probabilistic modeling** -- use deterministic causal chains directly.
49
- - **Data is entirely missing or severely corrupted** -- no meaningful statistical operations can be performed.
50
-
51
- ## When to Use
52
-
53
- - Reviewing whether the statistical methods in a paper / experiment are correct and whether conclusions are significant.
54
- - Experimental data analysis, significance testing, effect-size assessment, regression modeling, and prediction.
55
- - Experimental design and power analysis (randomization, blocking, factorial designs).
56
- - Causal effect estimation (DAG + back-door criterion / do-calculus).
57
- - Bayesian inference and prior-posterior updating, goodness-of-fit tests ($\chi^2$/F).
58
- - **Designing probabilistic mechanisms for random algorithms / sampling / quantization / training dynamics** (Monte Carlo, reparameterization, probabilistic quantization) and evaluating their GPU viability.
59
-
60
- ## Method
61
-
62
- ### Step 1: Define the Random Phenomenon
63
- Identify the **random variable $X$** (the quantity to be measured), the **sample space $\Omega$** (all possible outcomes), the **event space $\mathcal{F}$** ($\sigma$-algebra on $\Omega$: contains $\Omega$, closed under complementation, closed under countable union), and the **probability measure $P$**: $\Omega\to[0,1]$ (satisfying the Kolmogorov axioms). Distinguish between discrete and continuous random variables.
64
-
65
- ### Step 2: Choose the Probability Model
66
- Select a distribution based on data type, sample size, and physical mechanism:
67
-
68
- | Distribution | Use Case | Key Parameters |
69
- |---|---|---|
70
- | Binomial | Number of successes in $N$ independent Bernoulli trials | $n, p$ |
71
- | Poisson | Count of rare events per unit time/space | $\lambda$ (mean rate) |
72
- | Normal | Superposition of many independent small factors (CLT) | $\mu, \sigma^2$ |
73
- | Exponential | Waiting times; memoryless property $P(X>t+s\|X>s)=P(X>t)$ | $\lambda$ (rate) |
74
- | Bayesian | Prior + likelihood -> posterior; incremental belief updating | Prior parameters, likelihood function |
75
- | Student's $t$ | Small-sample mean inference; heavier tails than normal | $df = n - 1$ |
76
- | $\chi^2$ | Goodness-of-fit tests, contingency tables, variance estimation | $df$ |
77
- | $F$ | Comparing two variances, ANOVA | $df_1, df_2$ |
78
- | Uniform | Equally likely events, non-informative default | $a, b$ |
79
-
80
- Selection principles: discrete vs. continuous; large samples tend toward normal (use $t$ for small samples); physical mechanism (Poisson = rare independent events, Exponential = waiting times).
81
-
82
- ### Step 3: Collect Data
83
- Verify that the **sample size** is sufficient (power analysis determines the minimum $n$), check for **sample bias** (selection / survivorship / voluntary response bias), assess **data quality** (measurement error / missing values / outliers), examine the **collection method** (random sampling vs. convenience sampling), and identify **block structure**. Representativeness is more important than volume -- a biased large sample is more dangerous than an unbiased small one.
84
-
85
- ### Step 4: Statistical Inference
86
- **Point estimation / MLE**: $\hat{\theta} = \arg\max_\theta L(\theta;x)$, where $L(\theta;x)=f(x|\theta)$; asymptotically normal and asymptotically efficient for large samples. **Confidence intervals** provide an interval estimate at a given confidence level (e.g., 95%); the frequentist interpretation is that 95% of such intervals from repeated sampling contain the true value. **Hypothesis testing**: $H_0$ vs. $H_1$; p-value $= P(\text{data this extreme or more} \mid H_0)$; reject $H_0$ if $p < \alpha$. **Bayesian updating**: $P(\theta|D) = P(D|\theta)\cdot P(\theta)/P(D)$.
87
-
88
- ### Step 5: Regression Modeling
89
- **Linear regression**: $Y = \beta_0 + \beta_1 X + \varepsilon$, $\varepsilon \sim N(0,\sigma^2)$; least-squares estimate $\hat{\beta} = (X^TX)^{-1}X^TY$; assumptions include linearity, independence, homoscedasticity, and normality of residuals. **Multiple / logistic regression**: $P(Y=1|X) = 1/(1+e^{-(\beta_0+\sum\beta_i X_i)})$; MLE estimation yields output probabilities. **Model selection**: AIC $= -2\ln L + 2k$ (favors predictive fit), BIC $= -2\ln L + k\cdot\ln n$ (favors parsimony), adjusted $R^2 = 1 - (1-R^2)(n-1)/(n-k-1)$. **Bias-variance trade-off**: Total error $= \text{Bias}^2 + \text{Variance} + \sigma^2$; use cross-validation to select complexity.
90
-
91
- ### Step 6: Experimental Design
92
- **Randomization** ensures that treatment and control groups are equal in expectation on all variables (known and unknown). **Blocking** groups similar units together and compares within blocks to reduce confounding variation. **Power analysis**: $\text{Power} = 1 - \beta = P(\text{reject } H_0 \mid H_1 \text{ is true})$; given effect size $\delta$ and $\alpha$, compute the minimum required $n$; low power implies high false-negative rate. **Factorial designs**: $2^k$ designs study $k$ factors and their interactions simultaneously.
93
-
94
- ### Step 7: Causal Inference
95
- **Confounding variables**: $Z$ affects both $X$ and $Y$, so $P(Y|X) \neq P(Y|do(X))$; without adjustment, the estimated effect is biased. **DAGs**: Nodes represent variables, arrows represent direct causal effects; identify back-door and mediating paths. **Do-calculus / back-door criterion**: If $S$ blocks all back-door paths from $X$ to $Y$ and contains no descendants of $X$, then $P(Y|do(X)) = \sum_s P(Y|X,S=s)\cdot P(S=s)$. **Randomization** directly blocks all back-door paths and is the gold standard for causal effect estimation.
96
-
97
- ### Step 8: Interpret Results
98
- Distinguish **statistical significance** from **practical significance** ($p<0.05$ does not mean the effect is large; with large samples, even tiny differences become "significant"). Report **effect sizes**: Cohen's $d = (\mu_1-\mu_2)/\sigma$, odds ratio $= (P_1/(1-P_1))/(P_2/(1-P_2))$. Remember that **correlation does not imply causation** ($P(Y|X) \neq P(Y|do(X))$) and beware of **multiple comparisons** (for $m$ tests, the expected number of false positives is $m\cdot\alpha$; apply Bonferroni $\alpha_{\text{adj}}=\alpha/m$ or BH-FDR correction).
99
-
100
- ### Step 9: Quantify Uncertainty
101
- Provide **confidence intervals** (frequentist: repeated-sampling coverage) or **credible intervals** (Bayesian: the probability that the parameter lies in this interval); state the reliability and statistical power of conclusions; identify sources of residual uncertainty (model assumptions, measurement error, unobserved confounders); report effect-size intervals rather than point estimates alone.
102
-
103
- ## Common Errors
104
-
105
- | Error | Critique | Correct Approach |
106
- |---|---|---|
107
- | Treating the p-value as truth | $p=0.05$ does not mean "95% certainty"; it is the probability of observing this data or more extreme data under $H_0$ | Understand $p = P(\text{data or more extreme} \mid H_0)$ |
108
- | Confusing probability with frequency | Probability is a theoretical quantity $P(A)$; frequency is an empirical quantity $f(A)/n$ | Connect them via the law of large numbers: $f/n \to P$ as $n\to\infty$ |
109
- | Neglecting prior probabilities | Base-rate neglect: focusing only on new evidence while ignoring background probability; especially dangerous for rare-disease screening | Bayesian reasoning: $P(H\|E) = P(E\|H)\cdot P(H)/P(E)$ |
110
- | Survivorship bias | Looking only at survivors truncates the sample space | Consider the full sample space $\Omega$, including failures |
111
- | Small-sample trap | "Patterns" from $n=3$ are unreliable; variance estimates are unstable | Check sample size, compute power, use the $t$-distribution |
112
- | Confusing correlation with causation | Correlation between two variables does not mean one causes the other | Search for confounders; use DAGs + back-door criterion |
113
- | Ignoring regression to the mean | After extreme performance, values tend to regress toward $E[X]$ | Use regression analysis rather than intuitive trend judgment |
114
- | Using the normal distribution instead of $t$ for small samples | For $n<30$, the normal approximation underestimates uncertainty | Use the $t$-distribution with $df=n-1$ for $n<30$ |
115
- | Confusing AIC with BIC | AIC favors predictive fit; BIC favors parsimony | Use AIC for prediction, BIC for explanation |
116
- | Inferring causation from observational data | Without randomization, confounding cannot be eliminated; $P(Y\|X) \neq P(Y\|do(X))$ | Apply DAG + back-door criterion adjustment, or restrict claims to association only |
117
- | Ignoring multiple-comparison corrections | For $m$ tests, the expected number of false positives is $m\cdot\alpha$ | Apply Bonferroni $\alpha/m$ or BH-FDR |
118
- | Ignoring power and effect size | Low power may fail to detect a real effect; reporting only $p$ without effect size is incomplete | Compute required sample size before the study; report Cohen's $d$ / odds ratio |
119
- | Exact integration / large posterior tables are incomputable | High-dimensional normalization $Z=P(D)$ and marginalization have no closed form; sample-sequential MCMC is not parallelizable | Use MCMC / variational ELBO / low-rank approximations; pass the GPU eight-dimensional gate |
120
-
121
- ## Operating Procedure
122
-
123
- When this skill is triggered, the output must include:
124
-
125
- 1. **Random variable definitions**: `[Variable]: [Meaning] [Type: Discrete / Continuous]`, specifying the sample space $\Omega$ and event space $\mathcal{F}$
126
- 2. **Probability model**: `[Distribution]: [Choice] because [Reason]`, noting $df$ or key parameters
127
- 3. **Data assessment**: `[Sample size]: N, [Bias check]: [Result], [Collection method]: [Random / Convenience]`
128
- 4. **Statistical inference**: `[Estimate]: [\hat{\theta}], [Confidence interval]: [a,b], [p-value]: [value], [Method]: [MLE / Bayesian]`
129
- 5. **Regression / experimental design (if applicable)**: `[Model]: [Linear / Logistic] [Coefficients]: [\hat{\beta}] [Criterion]: [AIC / BIC]`; `[Design]: [Randomization / Block / Factorial] [Power]: [Power] [Minimum n]: [n]`
130
- 6. **Causal assessment (if applicable)**: `[DAG]: [Paths], [Confounders]: [List], [Adjustment set]: [S], [Causal effect]: [P(Y|do(X))]`
131
- 7. **Effect size and uncertainty**: Cohen's $d$ / odds ratio with confidence intervals, statistical power, and residual uncertainty
132
- 8. **Bias check**: Systematically review the common-errors table, marking each as "None found" or "Warning: [issue found]"
133
- 9. **[GPU viability]** (if used for random algorithms / sampling / training): Whether inference requires sampling / variational approximation; pass the eight-dimensional gate; label as friendly / amenable to adaptation / anti-pattern, with adaptation recommendations
134
- 10. **Action recommendations**: Explicitly state "Next, I will..."
135
-
136
- **Output must not consist of analysis alone without conclusions.**
137
-
138
- ## Relations to Other Skills
139
-
140
- - **Modeling**: Probabilistic models are essential modeling tools -- uncertainty requires a probabilistic framework.
141
- - **Optimization**: Optimization under uncertainty requires expected-value optimization or robust optimization; stochastic optimization / SAA converts expected objectives to deterministic approximations.
142
- - **Induction and analogy**: Discovering patterns in data is the probabilistic version of inductive reasoning.
143
- - **Logic and deduction**: Classical logic is deterministic; probabilistic logic is its generalization to uncertainty.
144
- - **Causal inference**: $P(Y|X)$ is a statistical association; $P(Y|do(X))$ is a causal effect; causal claims require mechanistic assumptions (DAGs) and cannot be derived from data alone.
145
- - **Information theory**: Entropy $H(X)=-\sum P(x)\ln P(x)$ quantifies uncertainty; information gain $I(X;Y)=H(X)-H(X|Y)$; the maximum-entropy principle selects the distribution that maximizes entropy subject to constraints.
146
- - **Modern mathematics activation**: `../../references/books/optimization-ml.md` (stochastic optimization / SAA, variational inference ELBO), `../../references/books/matrix-analysis.md` (low-rank covariance, factorized approximations).
@@ -1,151 +0,0 @@
1
- ---
2
- name: probability-statistics
3
- description: |
4
- 触发:问题涉及量化不确定性、概率分布、贝叶斯推断、假设检验、回归建模、实验设计、因果效应估计;或为随机算法/采样/量化/训练动力学设计概率机制时调用。
5
- English: Trigger when a problem involves quantifying uncertainty, probability distributions, Bayesian inference, hypothesis testing, regression modeling, experimental design, causal effect estimation; or designing probabilistic mechanisms for random algorithms/sampling/quantization/training dynamics.
6
- ---
7
-
8
- > **语言路由**:若用户消息为英文,请读取并遵循同目录下的 `SKILL.en.md`,按其操作规程以英文输出;中文消息则继续使用本文件。
9
-
10
- # 🎲 概率与统计 / Probability & Statistics
11
-
12
- > "不确定性是可量化的——概率不只是数学公式,而是理解随机世界的方式。量化不确定性,从数据中提取规律,做出理性的推断和决策。"
13
- > "Uncertainty is quantifiable—probability is not just a mathematical formula, but a way to understand the random world. Quantifying uncertainty, extracting patterns from data, and making rational inferences and decisions."
14
- >
15
- > —— 概率论、数理统计
16
- > —— Probability Theory, Mathematical Statistics
17
-
18
- ## 核心原则 / Core Principle
19
-
20
- **世界充满不确定性。理性决策不是追求确定性,而是在不确定性中做出期望值最优的选择——概率是量化的信念,数据是量化的证据。**
21
-
22
- > **数学形式化 / Mathematical Formalization**
23
- >
24
- > 概率空间 (Ω, 𝔽, P) 由 Kolmogorov 三公理定义:① **非负性** P(A) ≥ 0;② **规范性** P(Ω) = 1;③ **可数可加性** 对互不相交的可数事件族 Aᵢ,P(∪ᵢ Aᵢ) = Σᵢ P(Aᵢ)。由此推出互补律 P(Aᶜ)=1−P(A)、全概率公式 P(B)=Σᵢ P(B|Aᵢ)P(Aᵢ)。
25
- >
26
- > **贝叶斯更新**:P(θ|D) = P(D|θ)·P(θ)/P(D);先验 → 似然 → 后验,后验遇新数据成为新先验。
27
- >
28
- > **期望与方差**:E[X] = Σx·P(x)(离散)或 ∫x·f(x)dx(连续);Var(X) = E[(X−μ)²] = E[X²] − (E[X])²。
29
- >
30
- > **大数定律/CLT**:n → ∞ 时样本频率 f/n → P(A)、样本均值 X̄ → μ(依概率收敛);√n·(X̄ − μ)/σ →d N(0,1),故大量独立小因素叠加趋正态。
31
- >
32
- > **偏差-方差权衡**:总误差 = 偏差² + 方差 + σ²(不可约噪声)。
33
-
34
- ## GPU 友好性 / GPU-Friendliness(横切检查)
35
-
36
- 当概率方法用于**随机算法/采样/训练动力学设计**时,须过 `../../references/gpu-friendly-math.md` 八维门:
37
-
38
- - **批量采样/蒙特卡洛**:i.i.d. 采样天然可并行、GEMM 友好(重参数化 Reparam、Gumbel-Softmax);低精度可行,注意 RNG 状态与跨设备一致性。
39
- - **MLE / 对数似然**:逐元素似然可融合、可批量化(友好);softmax 交叉熵用 logsumexp 保数值稳定。
40
- - **精确贝叶斯积分/边缘化**:高维 P(θ|D)∝P(D|θ)P(θ) 的归一化 Z=P(D) 与边缘化不可闭式 → 改造为 **MCMC(HMC/NUTS)/变分推断 ELBO**(见 `../../references/books/optimization-ml.md`)。
41
- - **大表后验/协方差**:不可算 → mean-field / 低秩因子化近似(见 `../../references/books/matrix-analysis.md`)。
42
- - **反模式**:逐样本串行 MCMC、需全局归一化的精确推断、"美但不可算"的高维积分。
43
-
44
- 八维最低判定(正式术语):**张量化**看样本、粒子、分布参数是否批量;**GEMM 可映射**看似然、回归、协方差是否落矩阵运算;**复杂度**看采样步数、积分维度、后验表规模;**显存与 KV-Cache**看粒子、协方差、充分统计是否可低秩/流式;**低精度稳定**检查 logsumexp、概率归一化、尾部概率;**并行与通信**看 RNG 与跨设备归约;**稀疏结构**看图模型/协方差是否结构化;**算子融合**看采样、打分、归一化能否融合。
45
-
46
- > 配合 `../../references/books/optimization-ml.md`(变分/SAA/随机优化)与 `../../references/books/matrix-analysis.md`(协方差低秩)。
47
-
48
- ## 不适用场景 / When NOT to Use
49
-
50
- - **确定性问题**(已知答案或可演绎推理得到)——不需要概率工具。
51
- - **样本量极小(n < 5)且无法增加**——应报告数据本身而非推断。
52
- - **纯粹的定性描述需求**——不需要数据分析。
53
- - **因果机制已明确且无需概率建模**——直接用确定性因果链。
54
- - **数据完全缺失或严重损坏**——无法做有意义的统计操作。
55
-
56
- ## 何时使用 / When to Use
57
-
58
- - 审查论文/实验的统计方法是否正确、结论是否显著。
59
- - 实验数据分析、显著性检验、效应量评估、回归建模与预测。
60
- - 实验设计与功效分析(随机化、区组化、因子设计)。
61
- - 因果效应估计(DAG + 后门准则 / do-演算)。
62
- - 贝叶斯推断与先验-后验更新、拟合优度检验(χ²/F)。
63
- - **为随机算法/采样/量化/训练动力学设计概率机制**(蒙特卡洛、重参数化、概率量化),并评估其 GPU 可行性。
64
-
65
- ## 方法流程 / Method
66
-
67
- ### 第一步:定义随机现象 / Define the Random Phenomenon
68
- 明确**随机变量 X**(要测量的量)、**样本空间 Ω**(所有可能结果)、**事件域 𝔽**(Ω 的 σ-代数:含 Ω、对补封闭、对可数并封闭)、**概率测度 P**: Ω→[0,1](满足 Kolmogorov 三公理)。区分离散与连续随机变量。
69
-
70
- ### 第二步:选择概率模型 / Choose the Probability Model
71
- 根据数据类型、样本量、物理机制选择分布:
72
-
73
- | 分布 / Distribution | 适用场景 / Use Case | 关键参数 / Key Parameters |
74
- |---|---|---|
75
- | 二项 Binomial | N 次独立伯努利试验成功次数 | n, p |
76
- | 泊松 Poisson | 单位时间/空间内稀有事件次数 | λ(平均发生率) |
77
- | 正态 Normal | 大量独立小因素叠加(CLT) | μ, σ² |
78
- | 指数 Exponential | 等待时间、无记忆性 P(X>t+s\|X>s)=P(X>t) | λ(速率) |
79
- | 贝叶斯 Bayesian | 先验+似然→后验,逐步更新信念 | 先验参数,似然函数 |
80
- | t-分布 Student's t | 小样本均值推断,尾部厚于正态 | df = n − 1 |
81
- | χ²-分布 | 拟合优度检验、列联表、方差估计 | df |
82
- | F-分布 | 比较两组方差、ANOVA | df₁, df₂ |
83
- | 均匀 Uniform | 等概率事件、无先验默认 | a, b |
84
-
85
- 选择原则:离散/连续、大样本趋正态(小样本用 t)、物理机制(泊松=稀有独立事件、指数=等待时间)。
86
-
87
- ### 第三步:收集数据 / Collect Data
88
- 检查**样本量**是否足够(功效分析定最小 n)、**样本偏差**(选择/幸存者/自愿响应偏差)、**数据质量**(测量误差/缺失/异常值)、**收集方式**(随机抽样 vs 方便抽样)、**区组结构**。代表性比数据量更重要——有偏大样本比无偏小样本更危险。
89
-
90
- ### 第四步:统计推断 / Statistical Inference
91
- **点估计/MLE** θ̂ = argmax_θ L(θ;x),L(θ;x)=f(x|θ),大样本下渐近正态、渐近有效;**置信区间**以置信水平(如 95%)给区间估计,频率解释为重复抽样时 95% 区间含真值;**假设检验** H₀ vs H₁,p-value = P(观察到此数据或更极端 \| H₀),p < α 拒绝 H₀;**贝叶斯更新** P(θ|D) = P(D|θ)·P(θ)/P(D)。
92
-
93
- ### 第五步:回归建模 / Regression Modeling
94
- **线性回归** Y = β₀ + β₁X + ε, ε ~ N(0,σ²),最小二乘 β̂ = (XᵀX)⁻¹XᵀY,假设线性/独立/同方差/正态残差;**多元/逻辑回归** P(Y=1\|X) = 1/(1+e^(−(β₀+ΣβX))),MLE 估计输出概率;**模型选择** AIC = −2lnL + 2k(偏预测)、BIC = −2lnL + k·ln(n)(偏简约)、调整 R² = 1 − (1−R²)(n−1)/(n−k−1);**偏差-方差权衡** 总误差 = 偏差² + 方差 + σ²,交叉验证选复杂度。
95
-
96
- ### 第六步:实验设计 / Experimental Design
97
- **随机化**使处理组与对照组在所有变量(已知/未知)上期望相等;**区组化**将相似单元分组、区组内比较减少混杂变异;**功效分析** Power = 1 − β = P(拒绝 H₀ \| H₁ 为真),给定效应量 δ、α 算所需最小 n,低功效 = 高假阴性;**因子设计** 2ᵏ 同时研究 k 因素及交互。
98
-
99
- ### 第七步:因果推理 / Causal Inference
100
- **混淆变量** Z 同时影响 X 与 Y 使 P(Y\|X) ≠ P(Y\|do(X)),不调整则效应有偏;**DAG** 节点=变量、箭头=直接因果,识别后门/中介路径;**do-演算/后门准则** 若 S 阻断 X→Y 所有后门路径且不含 X 后代,则 P(Y\|do(X)) = Σₛ P(Y\|X,S=s)·P(S=s);**随机化**直接阻断所有后门路径,是因果效应估计的黄金标准。
101
-
102
- ### 第八步:解释结果 / Interpret Results
103
- 区分**统计显著**与**实际显著**(p<0.05 ≠ 效应大,大样本下微小差异也"显著")。报告**效应量**:Cohen's d = (μ₁−μ₂)/σ、odds ratio = (P₁/(1−P₁))/(P₂/(1−P₂))。注意**相关≠因果**(P(Y\|X) ≠ P(Y\|do(X)))、**多重比较**(m 个检验期望假阳性 = m·α,需 Bonferroni α_adj=α/m 或 BH-FDR 校正)。
104
-
105
- ### 第九步:量化不确定性 / Quantify Uncertainty
106
- 给出**置信区间**(频率:重复抽样覆盖率)或**可信区间**(贝叶斯:参数在此区间的概率);说明结论可靠性与统计功效;识别剩余不确定性来源(模型假设、测量误差、未观测混淆);报告效应量区间而非仅点估计。
107
-
108
- ## 常见错误 / Common Errors
109
-
110
- | 错误 / Error | 批评 / Critique | 正确做法 / Correct Approach |
111
- |---|---|---|
112
- | 把 p-value 当真理 | p=0.05 不表示"95% 把握",而是 H₀ 下观察到该数据或更极端的概率 | 理解 p = P(数据或更极端 \| H₀) |
113
- | 混淆概率与频率 | 概率是理论值 P(A),频率是经验值 f(A)/n | 用大数定律连接:n→∞ 时 f/n → P |
114
- | 忽视先验概率 | 基础率忽视:只看新证据不看背景概率,罕见病检验尤其危险 | 贝叶斯:P(H\|E) = P(E\|H)·P(H)/P(E) |
115
- | 幸存者偏差 | 只看成功者,样本空间被截断 | 考虑完整样本空间 Ω,含失败样本 |
116
- | 小样本陷阱 | n=3 的"规律"不可信,方差估计不稳定 | 检查样本量、算功效、用 t 分布 |
117
- | 相关当因果 | 两变量相关 ≠ 一者导致另一者 | 找混淆变量,DAG + 后门准则 |
118
- | 忽视回归均值 | 极端表现后倾向回归平均 E[X] | 用回归分析而非直觉判断趋势 |
119
- | 小样本用正态而非 t | n<30 时正态近似低估不确定性 | n<30 用 t 分布,df=n−1 |
120
- | 混淆 AIC 与 BIC | AIC 偏拟合、BIC 偏简约 | 预测用 AIC,解释用 BIC |
121
- | 观测数据推断因果 | 无随机化时混淆无法消除,P(Y\|X) ≠ P(Y\|do(X)) | DAG + 后门准则调整,或只断关联 |
122
- | 忽略多重比较校正 | m 个检验期望假阳性 = m·α | Bonferroni α/m 或 BH-FDR |
123
- | 忽略功效与效应量 | 低功效即使有真实效应也不显著;只报 p 不报效应量 | 设计前算样本量,报 Cohen's d / odds ratio |
124
- | 精确积分/大表后验不可算 | 高维归一化 Z=P(D) 与边缘化无闭式,逐样本串行 MCMC 不可并行 | 改用 MCMC/变分 ELBO/低秩近似,过 GPU 八维门 |
125
-
126
- ## 操作规程 / Operating Procedure
127
-
128
- 当本 skill 被触发时,输出必须包含:
129
-
130
- 1. **随机变量定义**:`[变量]: [含义] [类型: 离散/连续]`,指定样本空间 Ω 与事件域 𝔽
131
- 2. **概率模型**:`[分布]: [选择] 因为 [理由]`,注明 df 或关键参数
132
- 3. **数据评估**:`[样本量]: N, [偏差检查]: [结果], [收集方式]: [随机/方便]`
133
- 4. **统计推断**:`[估计值]: [θ̂], [置信区间]: [a,b], [p-value]: [值], [方法]: [MLE/Bayesian]`
134
- 5. **回归/实验设计(如适用)**:`[模型]: [线性/逻辑] [系数]: [β̂] [准则]: [AIC/BIC]`;`[设计]: [随机化/区组/因子] [功效]: [Power] [最小n]: [n]`
135
- 6. **因果评估(如适用)**:`[DAG]: [路径], [混淆]: [列表], [调整集]: [S], [因果效应]: [P(Y\|do(X))]`
136
- 7. **效应量与不确定性**:Cohen's d / odds ratio 及其区间,统计功效与剩余不确定性
137
- 8. **偏差检查**:逐一核对常见错误表,标注 `✅ 无` 或 `⚠️ 发现 [问题]`
138
- 9. **[GPU 可行性]**(若用于随机算法/采样/训练):推断是否需采样/变分近似,过八维门,标注友好/可改造/反模式 + 改造建议
139
- 10. **行动建议**:明确写出"接下来我将……"
140
-
141
- **输出不得只给分析而无结论。**
142
-
143
- ## 与其他 skill 的关系 / Relations to Other Skills
144
-
145
- - **建模思想**:概率模型是建模的重要工具——不确定性需要概率框架。
146
- - **优化思想**:不确定性下的优化需期望值优化或鲁棒优化;随机优化/SAA 把期望目标转为确定性近似。
147
- - **归纳与类比**:从数据中发现规律本质是归纳推理的概率版本。
148
- - **逻辑演绎**:经典逻辑是确定性的,概率逻辑是不确定性的推广。
149
- - **因果推断思想**:P(Y\|X) 是统计关联,P(Y\|do(X)) 是因果效应;因果需机制假设(DAG),不能纯靠数据得出。
150
- - **信息论思想**:熵 H(X)=−ΣP(x)lnP(x) 量化不确定性;信息增益 I(X;Y)=H(X)−H(X\|Y);最大熵原则在约束下选使熵最大的分布。
151
- - **现代数学激活**:`../../references/books/optimization-ml.md`(随机优化/SAA、变分推断 ELBO)、`../../references/books/matrix-analysis.md`(协方差低秩、因子化近似)。
@@ -1,191 +0,0 @@
1
- # Mathematical Sources and Classic Texts
2
-
3
- ## Bayes' Theorem (Bayes, 1763)
4
-
5
- > P(H|E) = P(E|H) × P(H) / P(E)
6
- >
7
- > Posterior = Likelihood × Prior / Evidence
8
-
9
- **Meaning**: When we observe new evidence E, our belief about hypothesis H is updated from the prior P(H) to the posterior P(H|E).
10
-
11
- **The core of Bayesian thinking**:
12
- 1. Start with a belief (prior probability)
13
- 2. Observe data (evidence)
14
- 3. Update the belief (posterior probability)
15
- 4. Repeat the process
16
-
17
- **Mathematical background**: Thomas Bayes's paper "An Essay towards solving a Problem in the Doctrine of Chances" was published posthumously in 1763 by Richard Price. Bayes' theorem is essentially a rearrangement of the definition of conditional probability P(A∩B) = P(A|B)P(B) = P(B|A)P(A), yet its philosophical significance far transcends the mathematics itself — it provides a rigorous mathematical framework for "learning from data."
18
-
19
- ## Law of Large Numbers (Bernoulli, 1713)
20
-
21
- > As the number of trials n approaches infinity, the sample mean converges in probability to the expected value.
22
-
23
- **Meaning**: A single observation is unreliable, but a large number of observations reveals the true pattern. This is the theoretical foundation of statistical inference.
24
-
25
- **Mathematical background**: Jacob Bernoulli proved the weak law of large numbers in *Ars Conjectandi* (1713): for any ε>0, P(|X̄ₙ - μ| ≥ ε) → 0. Borel (1909) and Kolmogorov subsequently strengthened this to the strong law of large numbers — almost sure convergence: P(lim X̄ₙ = μ) = 1.
26
-
27
- ## Central Limit Theorem (De Moivre-Laplace, 1733 – Lindeberg-Feller, 20th century)
28
-
29
- > The sum of a large number of i.i.d. random variables is approximately normally distributed, regardless of the original distribution.
30
-
31
- **Meaning**: The normal distribution is ubiquitous because it is the natural result of "the superposition of many small factors."
32
-
33
- **Mathematical background**: De Moivre (1733) first discovered the normal approximation to the binomial distribution; Laplace (1810) generalized it to the general case. The Lindeberg-Feller conditions give the most precise convergence conditions for independent but non-identically distributed settings. Lyapunov (1901) introduced the characteristic function approach, which became a core tool of modern probability theory.
34
-
35
- ## Kolmogorov Axioms (1933)
36
-
37
- > The foundational axioms of probability theory:
38
- > 1. Non-negativity: P(A) ≥ 0
39
- > 2. Normalization: P(Ω) = 1
40
- > 3. Countable additivity: If A₁, A₂, ... are mutually disjoint, then P(∪Aₖ) = ΣP(Aₖ)
41
-
42
- **Meaning**: Probability is defined as a measure — probability theory thereby became a rigorous branch of mathematics rather than a collection of empirical rules.
43
-
44
- **Mathematical background**: In *Grundbegriffe der Wahrscheinlichkeitsrechnung* (1933), Andrey Kolmogorov embedded probability theory within the measure-theoretic framework (Ω, F, P), i.e., the triple of sample space, event space (σ-algebra), and probability measure. This axiomatization gave precise definitions to concepts such as the law of large numbers, conditional probability, and random variables, and is the cornerstone of modern probability theory.
45
-
46
- ## Neyman-Pearson Lemma (1928/1933)
47
-
48
- > At a given significance level α, the likelihood ratio test is the most powerful test:
49
- > Reject H₀ when L(x|H₁)/L(x|H₀) > k, where k is determined by α.
50
-
51
- **Meaning**: Statistical testing is not a matter of subjective judgment; it can be made optimal under the constraint of "controlling the probability of error."
52
-
53
- **Mathematical background**: Jerzy Neyman and Egon Pearson systematized hypothesis testing theory between 1928 and 1933, introducing the concepts of Type I error (α, false positive), Type II error (β, false negative), and test power (power = 1-β). The Neyman-Pearson lemma proves the optimality of the likelihood ratio test in the simple-vs-simple hypothesis setting. This framework became the standard paradigm for modern statistical testing.
54
-
55
- ## Fisher's Statistical Inference (1920s–1930s)
56
-
57
- - **Maximum likelihood estimation**: Choose the parameter θ̂ = argmax L(θ; x) that maximizes the probability of observing the data
58
- - **p-value**: The probability of observing the current or more extreme data under the assumption that the null hypothesis is true
59
- - **Significance testing**: Deciding whether to reject the null hypothesis via the p-value
60
- - **Sufficiency principle**: A statistic T(X) is sufficient if P(X|T) does not depend on θ
61
-
62
- **Mathematical background**: R.A. Fisher's contributions extend far beyond the p-value. He proposed criteria for evaluating estimators such as consistency and efficiency; Fisher information I(θ) = E[(∂log L/∂θ)²] measures the information content of data about the parameter and is closely linked to the Cramér-Rao lower bound: Var(θ̂) ≥ 1/I(θ).
63
-
64
- ## Fisher's Experimental Design (1935)
65
-
66
- > Randomization does not ignore causality — it makes causal inference possible.
67
-
68
- **Meaning**: The credibility of a scientific experiment comes not from "precise control" but from "random assignment."
69
-
70
- **Mathematical background**: In *The Design of Experiments* (1935), Fisher proposed three fundamental principles — randomization, blocking, and factorial designs. Randomization ensures that estimates of treatment effects are free from systematic bias; blocking controls for known nuisance variables; factorial designs such as 2² and 2³ allow simultaneous estimation of multiple main effects and interaction effects, far more efficient than one-factor-at-a-time experimentation.
71
-
72
- ## Student's t-Distribution (Gosset, 1908)
73
-
74
- > When the sample size n is small and the population standard deviation is unknown:
75
- > t = (X̄ - μ) / (S/√n), which follows a t(n-1) distribution.
76
-
77
- **Meaning**: Small samples cannot be approximated directly by the normal distribution — the t-distribution has heavier tails, reflecting the additional uncertainty from estimating the standard deviation itself.
78
-
79
- **Mathematical background**: William Sealy Gosset published this result under the pen name "Student" in 1908. He worked at the Guinness brewery and could not use his real name due to confidentiality requirements. The t-distribution is the ratio of a standard normal to √(χ²/(n-1)), and converges to the normal distribution as n→∞. Fisher (1925) provided a rigorous proof and generalized the result.
80
-
81
- ## Chi-Squared Test (Karl Pearson, 1900)
82
-
83
- > χ² = Σ(Oₖ - Eₖ)² / Eₖ, which approximately follows a χ²(k-1-p) distribution under the null hypothesis.
84
-
85
- **Meaning**: Does the discrepancy between observed and expected frequencies exceed what can be explained by random fluctuation?
86
-
87
- **Mathematical background**: Karl Pearson proposed the goodness-of-fit test in 1900, the first formal statistical test. The degrees-of-freedom correction to k-1-p (where k is the number of categories and p is the number of estimated parameters) was completed by Fisher (1922). The χ² test is widely used in contingency table independence testing, distribution fitting, and related areas.
88
-
89
- ## Regression and Least Squares (Legendre 1805, Gauss 1809)
90
-
91
- > min Σ(yₖ - (a + bxₖ))² → least squares estimate β̂ = (X'X)⁻¹X'y
92
-
93
- **Meaning**: Among all fitted lines, least squares minimizes the sum of squared residuals; under the assumption of normal errors, it is equivalent to maximum likelihood estimation.
94
-
95
- **Mathematical background**: Legendre (1805) was the first to publish the method of least squares; Gauss (1809) claimed to have used the method as early as 1795 and provided a probabilistic argument under the normal error assumption. The term "regression" was coined by Galton (1886) in his study of the intergenerational regression of height. The modern linear regression model Y = Xβ + ε is the core framework of statistical modeling.
96
-
97
- ## Markov Chains (Markov, 1906)
98
-
99
- > P(Xₙ₊₁ = j | Xₙ = i, Xₙ₋₁, ...) = P(Xₙ₊₁ = j | Xₙ = i)
100
- >
101
- > The future depends only on the present, not on the past — the memoryless property.
102
-
103
- **Meaning**: Many real-world processes have the property that "the current state determines the future trajectory," and historical details can be disregarded.
104
-
105
- **Mathematical background**: Andrey Markov (1906) first defined Markov chains by studying vowel/consonant sequences in Pushkin's *Eugene Onegin*. The ergodic theorem guarantees that for an irreducible, aperiodic, positive recurrent chain, π(j) = lim P(Xₙ = j) exists and is the unique stationary distribution. Markov chains are the theoretical foundation of MCMC (Metropolis 1943, Hastings 1970, Gelfand-Smith 1990) and also underpin Google PageRank (Brin-Page 1998).
106
-
107
- ## Stochastic Processes (Brownian Motion, Wiener Process)
108
-
109
- > W(t) satisfies: (1) W(0)=0, (2) W(t)-W(s) ~ N(0, t-s), (3) independent increments, (4) continuous paths
110
-
111
- **Meaning**: Brownian motion is the macroscopic mathematical model of microscopic random fluctuations — from pollen motion to stock price fluctuations.
112
-
113
- **Mathematical background**: Brown (1827) observed the irregular motion of pollen particles; Bachelier (1900) was the first to use it to model stock prices; Wiener (1923) gave the rigorous mathematical construction. Itô (1944) developed stochastic integration dX = μdt + σdW and Itô's formula, which became the theoretical foundation of financial mathematics (Black-Scholes 1973) and stochastic differential equations.
114
-
115
- ## Shannon Information Theory (1948)
116
-
117
- > H(X) = -Σ p(x) log p(x) — entropy, the measure of uncertainty of a random variable
118
- > I(X;Y) = H(X) - H(X|Y) — mutual information, the amount of information Y provides about X
119
- > C = max I(X;Y) — channel capacity, the upper bound on the rate of reliable communication
120
-
121
- **Meaning**: Information can be quantified; the fundamental limits of communication are determined by mathematical laws, not by engineering technology.
122
-
123
- **Mathematical background**: Claude Shannon founded information theory in "A Mathematical Theory of Communication" (1948). The source coding theorem: average code length ≥ H(X); the channel coding theorem: when the transmission rate R < C, reliable coding schemes exist. The deep connection between entropy and probability — H(X) = -E[log p(X)] — makes information theory a natural extension of probability theory.
124
-
125
- ## Pearl's Causal Inference (2000)
126
-
127
- > The causal hierarchy:
128
- > 1. Association P(y|x) — seeing
129
- > 2. Intervention P(y|do(x)) — doing
130
- > 3. Counterfactual P(yₓ|x', y') — imagining
131
-
132
- **Meaning**: Causality is not a strengthened version of association — "do(x)" and "observe x" are mathematically distinct.
133
-
134
- **Mathematical background**: In *Causality* (2000), Judea Pearl systematized causal inference using directed acyclic graphs (DAGs) and the do-calculus. The three rules of the do-calculus allow transformation of interventional probabilities among observable variables; the front-door and back-door criteria specify conditions under which causal effects can be computed from observational data. Causal inference answers "what would happen to y if I did x," which goes beyond the expressive power of probability theory alone.
135
-
136
- ## Bootstrap (Efron, 1979)
137
-
138
- > Resample with replacement from X₁,...,Xₙ a total of B times to obtain B bootstrap samples;
139
- > use the bootstrap distribution to approximate the true distribution.
140
-
141
- **Meaning**: When theoretical derivation is difficult, use the data itself to simulate the sampling process — "validate yourself with yourself."
142
-
143
- **Mathematical background**: Bradley Efron (1979) proposed the bootstrap; its theoretical guarantees were established by Bickel-Freedman (1981) and Singh (1981): under mild conditions, the bootstrap distribution converges uniformly to the true sampling distribution. The bootstrap can estimate standard errors, confidence intervals (percentile method / BCa method), p-values, and more, making it a general-purpose tool for nonparametric inference.
144
-
145
- ## Bayesian vs Frequentist Debate
146
-
147
- > Bayesian: Probability is degree of belief; parameter θ is a random variable → P(θ|data)
148
- > Frequentist: Probability is long-run frequency; parameter θ is a fixed unknown constant → sampling distribution of the estimator θ̂
149
-
150
- **Meaning**: This is not a technical disagreement but a philosophical one about "what probability is."
151
-
152
- **Core comparison**:
153
- - Bayesian: Prior + Likelihood → Posterior; naturally suited to sequential updating and small samples
154
- - Frequentist: Unbiasedness, consistency, power; naturally suited to large-scale repeatable experiments
155
- - In practice: Bayesian methods dominate in machine learning and causal inference; frequentist methods dominate in clinical trials and quality control
156
-
157
- **Mathematical background**: The debate has continued from Laplace vs Fisher to the present day. Jeffreys (1939) proposed the non-informative prior p(θ) ∝ |I(θ)|^(1/2); de Finetti (1937) proved that coherence of subjective probability is equivalent to additivity; Bernardo-Smith (1994) developed reference prior theory.
158
-
159
- ## Monty Hall Problem
160
-
161
- > Three doors, one with a prize. You choose one; the host opens another, revealing it to be empty.
162
- > Question: Should you switch doors? Answer: switching wins with probability 2/3; staying wins with probability 1/3.
163
-
164
- **Meaning**: Intuition fails here — the host's action conveys information (he avoids opening the door with the prize).
165
-
166
- **Mathematical background**: This problem is an excellent introduction to Bayesian thinking. By Bayes' theorem: P(prize behind remaining door | host opened empty door) = 2/3, because the host selectively avoids the prize, which is itself information. Analogous structures appear in medical diagnosis and legal reasoning — "selective observation" alters probabilities.
167
-
168
- ## Common Statistical Fallacies and Cognitive Biases
169
-
170
- **Survivorship Bias**:
171
- During World War II, the military analyzed bullet-hole distributions on returning aircraft and found the most holes on the wings, recommending reinforcement of the wings. Statistician Abraham Wald pointed out: the areas without bullet holes should be reinforced — because the planes hit in those areas never came back. Wald's insight is essentially about conditional probability: the observed data are conditioned on "the aircraft returned," not the full data set.
172
-
173
- **Base Rate Neglect**:
174
- A rare disease has a prevalence of 0.1%, and the diagnostic test has 99% accuracy. If you test positive, what is the probability you actually have the disease?
175
- - Intuitive answer: 99%
176
- - Bayesian calculation: P(disease|positive) = 0.99 × 0.001 / (0.99 × 0.001 + 0.01 × 0.999) ≈ 9%
177
- - The prior probability (base rate) is severely underestimated by intuition
178
-
179
- **Regression to the Mean**:
180
- Individuals who perform exceptionally well tend to be closer to average on the next measurement, not because of "declining ability" but because extreme performance is partly due to luck. Galton (1886) found that children of tall parents tend to be shorter than their parents — this is not "degeneration" but a statistical law.
181
-
182
- ## The Value of Probabilistic Thinking in Everyday Life
183
-
184
- > "The core of probabilistic thinking is not computing exact probabilities, but cultivating the habit of 'thinking under uncertainty.'"
185
-
186
- - Don't be swayed by a single anecdote — consider the base rate
187
- - Update your beliefs when new information arrives — Bayesian updating
188
- - Distinguish signal from noise — the law of large numbers
189
- - Be wary of extreme values — regression to the mean
190
- - Distinguish "seeing" from "doing" — the causal hierarchy (Pearl)
191
- - Quantify uncertainty — entropy and information (Shannon)