ppef 1.0.0 → 1.1.0

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 (336) hide show
  1. package/README.md +172 -0
  2. package/bin/ppef.mjs +20 -0
  3. package/dist/__tests__/framework-pipeline.integration.test.d.ts +7 -0
  4. package/dist/__tests__/framework-pipeline.integration.test.d.ts.map +1 -0
  5. package/dist/__tests__/framework-pipeline.integration.test.js +415 -0
  6. package/dist/__tests__/framework-pipeline.integration.test.js.map +1 -0
  7. package/dist/__tests__/index-exports.unit.test.d.ts +8 -0
  8. package/dist/__tests__/index-exports.unit.test.d.ts.map +1 -0
  9. package/dist/__tests__/index-exports.unit.test.js +127 -0
  10. package/dist/__tests__/index-exports.unit.test.js.map +1 -0
  11. package/dist/__tests__/registry-executor.integration.test.d.ts +5 -0
  12. package/dist/__tests__/registry-executor.integration.test.d.ts.map +1 -0
  13. package/dist/__tests__/registry-executor.integration.test.js +352 -0
  14. package/dist/__tests__/registry-executor.integration.test.js.map +1 -0
  15. package/dist/__tests__/test-helpers.d.ts +94 -0
  16. package/dist/__tests__/test-helpers.d.ts.map +1 -0
  17. package/dist/__tests__/test-helpers.js +271 -0
  18. package/dist/__tests__/test-helpers.js.map +1 -0
  19. package/dist/aggregation/__tests__/aggregators.unit.test.d.ts +7 -0
  20. package/dist/aggregation/__tests__/aggregators.unit.test.d.ts.map +1 -0
  21. package/dist/aggregation/__tests__/aggregators.unit.test.js +350 -0
  22. package/dist/aggregation/__tests__/aggregators.unit.test.js.map +1 -0
  23. package/dist/aggregation/__tests__/pipeline.unit.test.d.ts +7 -0
  24. package/dist/aggregation/__tests__/pipeline.unit.test.d.ts.map +1 -0
  25. package/dist/aggregation/__tests__/pipeline.unit.test.js +213 -0
  26. package/dist/aggregation/__tests__/pipeline.unit.test.js.map +1 -0
  27. package/dist/aggregation/aggregators.d.ts +63 -0
  28. package/dist/aggregation/aggregators.d.ts.map +1 -0
  29. package/dist/aggregation/aggregators.js +228 -0
  30. package/dist/aggregation/aggregators.js.map +1 -0
  31. package/dist/aggregation/index.d.ts +8 -0
  32. package/dist/aggregation/index.d.ts.map +1 -0
  33. package/dist/aggregation/index.js +8 -0
  34. package/dist/aggregation/index.js.map +1 -0
  35. package/dist/aggregation/pipeline.d.ts +38 -0
  36. package/dist/aggregation/pipeline.d.ts.map +1 -0
  37. package/dist/aggregation/pipeline.js +198 -0
  38. package/dist/aggregation/pipeline.js.map +1 -0
  39. package/dist/claims/__tests__/evaluator.unit.test.d.ts +12 -0
  40. package/dist/claims/__tests__/evaluator.unit.test.d.ts.map +1 -0
  41. package/dist/claims/__tests__/evaluator.unit.test.js +801 -0
  42. package/dist/claims/__tests__/evaluator.unit.test.js.map +1 -0
  43. package/dist/claims/evaluator.d.ts +33 -0
  44. package/dist/claims/evaluator.d.ts.map +1 -0
  45. package/dist/claims/evaluator.js +174 -0
  46. package/dist/claims/evaluator.js.map +1 -0
  47. package/dist/claims/index.d.ts +7 -0
  48. package/dist/claims/index.d.ts.map +1 -0
  49. package/dist/claims/index.js +7 -0
  50. package/dist/claims/index.js.map +1 -0
  51. package/dist/cli/__tests__/aggregate.command.unit.test.d.ts +7 -0
  52. package/dist/cli/__tests__/aggregate.command.unit.test.d.ts.map +1 -0
  53. package/dist/cli/__tests__/aggregate.command.unit.test.js +396 -0
  54. package/dist/cli/__tests__/aggregate.command.unit.test.js.map +1 -0
  55. package/dist/cli/__tests__/commands.unit.test.d.ts +10 -0
  56. package/dist/cli/__tests__/commands.unit.test.d.ts.map +1 -0
  57. package/dist/cli/__tests__/commands.unit.test.js +217 -0
  58. package/dist/cli/__tests__/commands.unit.test.js.map +1 -0
  59. package/dist/cli/__tests__/index.unit.test.d.ts +10 -0
  60. package/dist/cli/__tests__/index.unit.test.d.ts.map +1 -0
  61. package/dist/cli/__tests__/index.unit.test.js +65 -0
  62. package/dist/cli/__tests__/index.unit.test.js.map +1 -0
  63. package/dist/cli/__tests__/logger.unit.test.d.ts +11 -0
  64. package/dist/cli/__tests__/logger.unit.test.d.ts.map +1 -0
  65. package/dist/cli/__tests__/logger.unit.test.js +180 -0
  66. package/dist/cli/__tests__/logger.unit.test.js.map +1 -0
  67. package/dist/cli/__tests__/module-loader.unit.test.d.ts +11 -0
  68. package/dist/cli/__tests__/module-loader.unit.test.d.ts.map +1 -0
  69. package/dist/cli/__tests__/module-loader.unit.test.js +262 -0
  70. package/dist/cli/__tests__/module-loader.unit.test.js.map +1 -0
  71. package/dist/cli/__tests__/output-writer.unit.test.d.ts +10 -0
  72. package/dist/cli/__tests__/output-writer.unit.test.d.ts.map +1 -0
  73. package/dist/cli/__tests__/output-writer.unit.test.js +216 -0
  74. package/dist/cli/__tests__/output-writer.unit.test.js.map +1 -0
  75. package/dist/cli/__tests__/plan.command.unit.test.d.ts +7 -0
  76. package/dist/cli/__tests__/plan.command.unit.test.d.ts.map +1 -0
  77. package/dist/cli/__tests__/plan.command.unit.test.js +289 -0
  78. package/dist/cli/__tests__/plan.command.unit.test.js.map +1 -0
  79. package/dist/cli/__tests__/run.command.unit.test.d.ts +7 -0
  80. package/dist/cli/__tests__/run.command.unit.test.d.ts.map +1 -0
  81. package/dist/cli/__tests__/run.command.unit.test.js +422 -0
  82. package/dist/cli/__tests__/run.command.unit.test.js.map +1 -0
  83. package/dist/cli/__tests__/validate.command.unit.test.d.ts +7 -0
  84. package/dist/cli/__tests__/validate.command.unit.test.d.ts.map +1 -0
  85. package/dist/cli/__tests__/validate.command.unit.test.js +226 -0
  86. package/dist/cli/__tests__/validate.command.unit.test.js.map +1 -0
  87. package/dist/cli/command-deps.d.ts +125 -0
  88. package/dist/cli/command-deps.d.ts.map +1 -0
  89. package/dist/cli/command-deps.js +7 -0
  90. package/dist/cli/command-deps.js.map +1 -0
  91. package/dist/cli/commands/aggregate.d.ts +35 -0
  92. package/dist/cli/commands/aggregate.d.ts.map +1 -0
  93. package/dist/cli/commands/aggregate.js +121 -0
  94. package/dist/cli/commands/aggregate.js.map +1 -0
  95. package/dist/cli/commands/plan.d.ts +36 -0
  96. package/dist/cli/commands/plan.d.ts.map +1 -0
  97. package/dist/cli/commands/plan.js +109 -0
  98. package/dist/cli/commands/plan.js.map +1 -0
  99. package/dist/cli/commands/run.d.ts +33 -0
  100. package/dist/cli/commands/run.d.ts.map +1 -0
  101. package/dist/cli/commands/run.js +185 -0
  102. package/dist/cli/commands/run.js.map +1 -0
  103. package/dist/cli/commands/validate.d.ts +27 -0
  104. package/dist/cli/commands/validate.d.ts.map +1 -0
  105. package/dist/cli/commands/validate.js +88 -0
  106. package/dist/cli/commands/validate.js.map +1 -0
  107. package/dist/cli/config-loader.d.ts +30 -0
  108. package/dist/cli/config-loader.d.ts.map +1 -0
  109. package/dist/cli/config-loader.js +181 -0
  110. package/dist/cli/config-loader.js.map +1 -0
  111. package/dist/cli/index.d.ts +26 -0
  112. package/dist/cli/index.d.ts.map +1 -0
  113. package/dist/cli/index.js +58 -0
  114. package/dist/cli/index.js.map +1 -0
  115. package/dist/cli/logger.d.ts +75 -0
  116. package/dist/cli/logger.d.ts.map +1 -0
  117. package/dist/cli/logger.js +131 -0
  118. package/dist/cli/logger.js.map +1 -0
  119. package/dist/cli/module-loader.d.ts +46 -0
  120. package/dist/cli/module-loader.d.ts.map +1 -0
  121. package/dist/cli/module-loader.js +116 -0
  122. package/dist/cli/module-loader.js.map +1 -0
  123. package/dist/cli/output-writer.d.ts +51 -0
  124. package/dist/cli/output-writer.d.ts.map +1 -0
  125. package/dist/cli/output-writer.js +65 -0
  126. package/dist/cli/output-writer.js.map +1 -0
  127. package/dist/cli/types.d.ts +174 -0
  128. package/dist/cli/types.d.ts.map +1 -0
  129. package/dist/cli/types.js +7 -0
  130. package/dist/cli/types.js.map +1 -0
  131. package/dist/collector/__tests__/result-collector.unit.test.d.ts +7 -0
  132. package/dist/collector/__tests__/result-collector.unit.test.d.ts.map +1 -0
  133. package/dist/collector/__tests__/result-collector.unit.test.js +1021 -0
  134. package/dist/collector/__tests__/result-collector.unit.test.js.map +1 -0
  135. package/dist/collector/__tests__/schema.unit.test.d.ts +7 -0
  136. package/dist/collector/__tests__/schema.unit.test.d.ts.map +1 -0
  137. package/dist/collector/__tests__/schema.unit.test.js +360 -0
  138. package/dist/collector/__tests__/schema.unit.test.js.map +1 -0
  139. package/dist/collector/index.d.ts +8 -0
  140. package/dist/collector/index.d.ts.map +1 -0
  141. package/dist/collector/index.js +8 -0
  142. package/dist/collector/index.js.map +1 -0
  143. package/dist/collector/result-collector.d.ts +159 -0
  144. package/dist/collector/result-collector.d.ts.map +1 -0
  145. package/dist/collector/result-collector.js +213 -0
  146. package/dist/collector/result-collector.js.map +1 -0
  147. package/dist/collector/schema.d.ts +34 -0
  148. package/dist/collector/schema.d.ts.map +1 -0
  149. package/dist/collector/schema.js +145 -0
  150. package/dist/collector/schema.js.map +1 -0
  151. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.d.ts +10 -0
  152. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.d.ts.map +1 -0
  153. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.js +122 -0
  154. package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.js.map +1 -0
  155. package/dist/executor/__tests__/checkpoint-manager.integration.test.d.ts +7 -0
  156. package/dist/executor/__tests__/checkpoint-manager.integration.test.d.ts.map +1 -0
  157. package/dist/executor/__tests__/checkpoint-manager.integration.test.js +330 -0
  158. package/dist/executor/__tests__/checkpoint-manager.integration.test.js.map +1 -0
  159. package/dist/executor/__tests__/checkpoint-manager.unit.test.d.ts +7 -0
  160. package/dist/executor/__tests__/checkpoint-manager.unit.test.d.ts.map +1 -0
  161. package/dist/executor/__tests__/checkpoint-manager.unit.test.js +531 -0
  162. package/dist/executor/__tests__/checkpoint-manager.unit.test.js.map +1 -0
  163. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.d.ts +8 -0
  164. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.d.ts.map +1 -0
  165. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.js +493 -0
  166. package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.js.map +1 -0
  167. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.d.ts +8 -0
  168. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.d.ts.map +1 -0
  169. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.js +164 -0
  170. package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.js.map +1 -0
  171. package/dist/executor/__tests__/checkpoint-storage.unit.test.d.ts +7 -0
  172. package/dist/executor/__tests__/checkpoint-storage.unit.test.d.ts.map +1 -0
  173. package/dist/executor/__tests__/checkpoint-storage.unit.test.js +490 -0
  174. package/dist/executor/__tests__/checkpoint-storage.unit.test.js.map +1 -0
  175. package/dist/executor/__tests__/executor.unit.test.d.ts +7 -0
  176. package/dist/executor/__tests__/executor.unit.test.d.ts.map +1 -0
  177. package/dist/executor/__tests__/executor.unit.test.js +202 -0
  178. package/dist/executor/__tests__/executor.unit.test.js.map +1 -0
  179. package/dist/executor/__tests__/memory-monitor.unit.test.d.ts +7 -0
  180. package/dist/executor/__tests__/memory-monitor.unit.test.d.ts.map +1 -0
  181. package/dist/executor/__tests__/memory-monitor.unit.test.js +285 -0
  182. package/dist/executor/__tests__/memory-monitor.unit.test.js.map +1 -0
  183. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.d.ts +12 -0
  184. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.d.ts.map +1 -0
  185. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.js +196 -0
  186. package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.js.map +1 -0
  187. package/dist/executor/__tests__/parallel-executor.integration.test.d.ts +7 -0
  188. package/dist/executor/__tests__/parallel-executor.integration.test.d.ts.map +1 -0
  189. package/dist/executor/__tests__/parallel-executor.integration.test.js +249 -0
  190. package/dist/executor/__tests__/parallel-executor.integration.test.js.map +1 -0
  191. package/dist/executor/__tests__/parallel-executor.unit.test.d.ts +8 -0
  192. package/dist/executor/__tests__/parallel-executor.unit.test.d.ts.map +1 -0
  193. package/dist/executor/__tests__/parallel-executor.unit.test.js +473 -0
  194. package/dist/executor/__tests__/parallel-executor.unit.test.js.map +1 -0
  195. package/dist/executor/__tests__/run-id.unit.test.d.ts +8 -0
  196. package/dist/executor/__tests__/run-id.unit.test.d.ts.map +1 -0
  197. package/dist/executor/__tests__/run-id.unit.test.js +156 -0
  198. package/dist/executor/__tests__/run-id.unit.test.js.map +1 -0
  199. package/dist/executor/__tests__/worker-entry.integration.test.d.ts +24 -0
  200. package/dist/executor/__tests__/worker-entry.integration.test.d.ts.map +1 -0
  201. package/dist/executor/__tests__/worker-entry.integration.test.js +82 -0
  202. package/dist/executor/__tests__/worker-entry.integration.test.js.map +1 -0
  203. package/dist/executor/__tests__/worker-entry.unit.test.d.ts +7 -0
  204. package/dist/executor/__tests__/worker-entry.unit.test.d.ts.map +1 -0
  205. package/dist/executor/__tests__/worker-entry.unit.test.js +364 -0
  206. package/dist/executor/__tests__/worker-entry.unit.test.js.map +1 -0
  207. package/dist/executor/checkpoint-manager.d.ts +231 -0
  208. package/dist/executor/checkpoint-manager.d.ts.map +1 -0
  209. package/dist/executor/checkpoint-manager.js +395 -0
  210. package/dist/executor/checkpoint-manager.js.map +1 -0
  211. package/dist/executor/checkpoint-storage.d.ts +230 -0
  212. package/dist/executor/checkpoint-storage.d.ts.map +1 -0
  213. package/dist/executor/checkpoint-storage.js +370 -0
  214. package/dist/executor/checkpoint-storage.js.map +1 -0
  215. package/dist/executor/checkpoint-types.d.ts +48 -0
  216. package/dist/executor/checkpoint-types.d.ts.map +1 -0
  217. package/dist/executor/checkpoint-types.js +8 -0
  218. package/dist/executor/checkpoint-types.js.map +1 -0
  219. package/dist/executor/executor.d.ts +164 -0
  220. package/dist/executor/executor.d.ts.map +1 -0
  221. package/dist/executor/executor.js +408 -0
  222. package/dist/executor/executor.js.map +1 -0
  223. package/dist/executor/index.d.ts +11 -0
  224. package/dist/executor/index.d.ts.map +1 -0
  225. package/dist/executor/index.js +11 -0
  226. package/dist/executor/index.js.map +1 -0
  227. package/dist/executor/memory-monitor.d.ts +115 -0
  228. package/dist/executor/memory-monitor.d.ts.map +1 -0
  229. package/dist/executor/memory-monitor.js +168 -0
  230. package/dist/executor/memory-monitor.js.map +1 -0
  231. package/dist/executor/parallel-executor.d.ts +239 -0
  232. package/dist/executor/parallel-executor.d.ts.map +1 -0
  233. package/dist/executor/parallel-executor.js +329 -0
  234. package/dist/executor/parallel-executor.js.map +1 -0
  235. package/dist/executor/run-id.d.ts +71 -0
  236. package/dist/executor/run-id.d.ts.map +1 -0
  237. package/dist/executor/run-id.js +74 -0
  238. package/dist/executor/run-id.js.map +1 -0
  239. package/dist/executor/worker-entry.d.ts +10 -0
  240. package/dist/executor/worker-entry.d.ts.map +1 -0
  241. package/dist/executor/worker-entry.js +42 -0
  242. package/dist/executor/worker-entry.js.map +1 -0
  243. package/dist/executor/worker-executor.d.ts +156 -0
  244. package/dist/executor/worker-executor.d.ts.map +1 -0
  245. package/dist/executor/worker-executor.js +88 -0
  246. package/dist/executor/worker-executor.js.map +1 -0
  247. package/dist/index.cjs +11 -0
  248. package/dist/index.d.ts +15 -0
  249. package/dist/index.d.ts.map +1 -0
  250. package/dist/index.js +24 -0
  251. package/dist/index.js.map +1 -0
  252. package/dist/registry/case-registry.d.ts +113 -0
  253. package/dist/registry/case-registry.d.ts.map +1 -0
  254. package/dist/registry/case-registry.js +160 -0
  255. package/dist/registry/case-registry.js.map +1 -0
  256. package/dist/registry/index.d.ts +8 -0
  257. package/dist/registry/index.d.ts.map +1 -0
  258. package/dist/registry/index.js +8 -0
  259. package/dist/registry/index.js.map +1 -0
  260. package/dist/registry/sut-registry.d.ts +96 -0
  261. package/dist/registry/sut-registry.d.ts.map +1 -0
  262. package/dist/registry/sut-registry.js +126 -0
  263. package/dist/registry/sut-registry.js.map +1 -0
  264. package/dist/renderers/index.d.ts +10 -0
  265. package/dist/renderers/index.d.ts.map +1 -0
  266. package/dist/renderers/index.js +9 -0
  267. package/dist/renderers/index.js.map +1 -0
  268. package/dist/renderers/latex-renderer.d.ts +84 -0
  269. package/dist/renderers/latex-renderer.d.ts.map +1 -0
  270. package/dist/renderers/latex-renderer.js +208 -0
  271. package/dist/renderers/latex-renderer.js.map +1 -0
  272. package/dist/renderers/types.d.ts +106 -0
  273. package/dist/renderers/types.d.ts.map +1 -0
  274. package/dist/renderers/types.js +23 -0
  275. package/dist/renderers/types.js.map +1 -0
  276. package/dist/robustness/__tests__/analyzer.unit.test.d.ts +11 -0
  277. package/dist/robustness/__tests__/analyzer.unit.test.d.ts.map +1 -0
  278. package/dist/robustness/__tests__/analyzer.unit.test.js +455 -0
  279. package/dist/robustness/__tests__/analyzer.unit.test.js.map +1 -0
  280. package/dist/robustness/__tests__/perturbations.unit.test.d.ts +11 -0
  281. package/dist/robustness/__tests__/perturbations.unit.test.d.ts.map +1 -0
  282. package/dist/robustness/__tests__/perturbations.unit.test.js +284 -0
  283. package/dist/robustness/__tests__/perturbations.unit.test.js.map +1 -0
  284. package/dist/robustness/analyzer.d.ts +61 -0
  285. package/dist/robustness/analyzer.d.ts.map +1 -0
  286. package/dist/robustness/analyzer.js +191 -0
  287. package/dist/robustness/analyzer.js.map +1 -0
  288. package/dist/robustness/index.d.ts +8 -0
  289. package/dist/robustness/index.d.ts.map +1 -0
  290. package/dist/robustness/index.js +8 -0
  291. package/dist/robustness/index.js.map +1 -0
  292. package/dist/robustness/perturbations.d.ts +46 -0
  293. package/dist/robustness/perturbations.d.ts.map +1 -0
  294. package/dist/robustness/perturbations.js +184 -0
  295. package/dist/robustness/perturbations.js.map +1 -0
  296. package/dist/statistical/__tests__/mann-whitney-u.unit.test.d.ts +7 -0
  297. package/dist/statistical/__tests__/mann-whitney-u.unit.test.d.ts.map +1 -0
  298. package/dist/statistical/__tests__/mann-whitney-u.unit.test.js +185 -0
  299. package/dist/statistical/__tests__/mann-whitney-u.unit.test.js.map +1 -0
  300. package/dist/statistical/index.d.ts +8 -0
  301. package/dist/statistical/index.d.ts.map +1 -0
  302. package/dist/statistical/index.js +8 -0
  303. package/dist/statistical/index.js.map +1 -0
  304. package/dist/statistical/mann-whitney-u.d.ts +62 -0
  305. package/dist/statistical/mann-whitney-u.d.ts.map +1 -0
  306. package/dist/statistical/mann-whitney-u.js +127 -0
  307. package/dist/statistical/mann-whitney-u.js.map +1 -0
  308. package/dist/types/aggregate.d.ts +124 -0
  309. package/dist/types/aggregate.d.ts.map +1 -0
  310. package/dist/types/aggregate.js +9 -0
  311. package/dist/types/aggregate.js.map +1 -0
  312. package/dist/types/case.d.ts +105 -0
  313. package/dist/types/case.d.ts.map +1 -0
  314. package/dist/types/case.js +10 -0
  315. package/dist/types/case.js.map +1 -0
  316. package/dist/types/claims.d.ts +122 -0
  317. package/dist/types/claims.d.ts.map +1 -0
  318. package/dist/types/claims.js +14 -0
  319. package/dist/types/claims.js.map +1 -0
  320. package/dist/types/index.d.ts +12 -0
  321. package/dist/types/index.d.ts.map +1 -0
  322. package/dist/types/index.js +7 -0
  323. package/dist/types/index.js.map +1 -0
  324. package/dist/types/perturbation.d.ts +105 -0
  325. package/dist/types/perturbation.d.ts.map +1 -0
  326. package/dist/types/perturbation.js +9 -0
  327. package/dist/types/perturbation.js.map +1 -0
  328. package/dist/types/result.d.ts +150 -0
  329. package/dist/types/result.d.ts.map +1 -0
  330. package/dist/types/result.js +12 -0
  331. package/dist/types/result.js.map +1 -0
  332. package/dist/types/sut.d.ts +128 -0
  333. package/dist/types/sut.d.ts.map +1 -0
  334. package/dist/types/sut.js +12 -0
  335. package/dist/types/sut.js.map +1 -0
  336. package/package.json +290 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perturbations.d.ts","sourceRoot":"","sources":["../../src/robustness/perturbations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,YAgDrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,YA4BnC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,YA+BrC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,EAAE,YA+BrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,EAKvC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,KAAG,YAAY,GAAG,SACrB,CAAC;AAExC;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,kBAAkB,KAAG,YAU/D,CAAC"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * Perturbation Implementations
3
+ *
4
+ * Concrete perturbations for robustness analysis.
5
+ * Each perturbation modifies evaluation cases in controlled ways.
6
+ */
7
+ import { createHash } from "node:crypto";
8
+ /**
9
+ * Edge removal perturbation.
10
+ * Randomly removes a fraction of edges from the graph.
11
+ */
12
+ export const edgeRemovalPerturbation = {
13
+ id: "edge-removal",
14
+ name: "Edge Removal",
15
+ description: "Randomly remove a fraction of edges",
16
+ type: "structural",
17
+ intensity: 0.1, // Default: remove 10% of edges
18
+ apply(evaluationCase, seed = 42) {
19
+ const intensity = this.intensity ?? 0.1;
20
+ // Note: rng would be used when actually perturbing the graph at load time
21
+ // const rng = new SeededRandom(seed);
22
+ // Create perturbed case ID
23
+ const perturbedId = createHash("sha256")
24
+ .update(`${evaluationCase.caseId}-edge-removal-${intensity}-${seed}`)
25
+ .digest("hex")
26
+ .slice(0, 16);
27
+ // Mark artefacts as perturbed (actual perturbation happens at load time)
28
+ const perturbedArtefacts = (evaluationCase.inputs.artefacts ?? []).map((a) => ({
29
+ ...a,
30
+ metadata: {
31
+ ...a.metadata,
32
+ perturbation: "edge-removal",
33
+ perturbationIntensity: intensity,
34
+ perturbationSeed: seed,
35
+ },
36
+ }));
37
+ return {
38
+ ...evaluationCase,
39
+ caseId: perturbedId,
40
+ name: `${evaluationCase.name ?? "Case"} (${Math.round(intensity * 100)}% edges removed)`,
41
+ inputs: {
42
+ ...evaluationCase.inputs,
43
+ summary: {
44
+ ...evaluationCase.inputs.summary,
45
+ perturbation: "edge-removal",
46
+ perturbationIntensity: intensity,
47
+ perturbationSeed: seed,
48
+ },
49
+ artefacts: perturbedArtefacts,
50
+ },
51
+ tags: [...(evaluationCase.tags ?? []), "perturbed", "edge-removal"],
52
+ };
53
+ },
54
+ };
55
+ /**
56
+ * Seed shift perturbation.
57
+ * Shifts seed nodes to their neighbors.
58
+ */
59
+ export const seedShiftPerturbation = {
60
+ id: "seed-shift",
61
+ name: "Seed Shift",
62
+ description: "Shift seed nodes to random neighbors",
63
+ type: "seed",
64
+ intensity: 1, // Default: shift all seeds
65
+ apply: (evaluationCase, seed = 42) => {
66
+ const perturbedId = createHash("sha256")
67
+ .update(`${evaluationCase.caseId}-seed-shift-${seed}`)
68
+ .digest("hex")
69
+ .slice(0, 16);
70
+ return {
71
+ ...evaluationCase,
72
+ caseId: perturbedId,
73
+ name: `${evaluationCase.name ?? "Case"} (seeds shifted)`,
74
+ inputs: {
75
+ ...evaluationCase.inputs,
76
+ summary: {
77
+ ...evaluationCase.inputs.summary,
78
+ perturbation: "seed-shift",
79
+ perturbationSeed: seed,
80
+ },
81
+ },
82
+ tags: [...(evaluationCase.tags ?? []), "perturbed", "seed-shift"],
83
+ };
84
+ },
85
+ };
86
+ /**
87
+ * Node removal perturbation.
88
+ * Randomly removes non-seed nodes from the graph.
89
+ */
90
+ export const nodeRemovalPerturbation = {
91
+ id: "node-removal",
92
+ name: "Node Removal",
93
+ description: "Randomly remove non-seed nodes",
94
+ type: "structural",
95
+ intensity: 0.05, // Default: remove 5% of nodes
96
+ apply(evaluationCase, seed = 42) {
97
+ const intensity = this.intensity ?? 0.05;
98
+ const perturbedId = createHash("sha256")
99
+ .update(`${evaluationCase.caseId}-node-removal-${intensity}-${seed}`)
100
+ .digest("hex")
101
+ .slice(0, 16);
102
+ return {
103
+ ...evaluationCase,
104
+ caseId: perturbedId,
105
+ name: `${evaluationCase.name ?? "Case"} (${Math.round(intensity * 100)}% nodes removed)`,
106
+ inputs: {
107
+ ...evaluationCase.inputs,
108
+ summary: {
109
+ ...evaluationCase.inputs.summary,
110
+ perturbation: "node-removal",
111
+ perturbationIntensity: intensity,
112
+ perturbationSeed: seed,
113
+ },
114
+ },
115
+ tags: [...(evaluationCase.tags ?? []), "perturbed", "node-removal"],
116
+ };
117
+ },
118
+ };
119
+ /**
120
+ * Weight noise perturbation.
121
+ * Adds Gaussian noise to edge weights.
122
+ */
123
+ export const weightNoisePerturbation = {
124
+ id: "weight-noise",
125
+ name: "Weight Noise",
126
+ description: "Add Gaussian noise to edge weights",
127
+ type: "noise",
128
+ intensity: 0.1, // Default: 10% noise (std dev as fraction of weight)
129
+ apply(evaluationCase, seed = 42) {
130
+ const intensity = this.intensity ?? 0.1;
131
+ const perturbedId = createHash("sha256")
132
+ .update(`${evaluationCase.caseId}-weight-noise-${intensity}-${seed}`)
133
+ .digest("hex")
134
+ .slice(0, 16);
135
+ return {
136
+ ...evaluationCase,
137
+ caseId: perturbedId,
138
+ name: `${evaluationCase.name ?? "Case"} (${Math.round(intensity * 100)}% weight noise)`,
139
+ inputs: {
140
+ ...evaluationCase.inputs,
141
+ summary: {
142
+ ...evaluationCase.inputs.summary,
143
+ perturbation: "weight-noise",
144
+ perturbationIntensity: intensity,
145
+ perturbationSeed: seed,
146
+ },
147
+ },
148
+ tags: [...(evaluationCase.tags ?? []), "perturbed", "weight-noise"],
149
+ };
150
+ },
151
+ };
152
+ /**
153
+ * All built-in perturbations.
154
+ */
155
+ export const PERTURBATIONS = [
156
+ edgeRemovalPerturbation,
157
+ seedShiftPerturbation,
158
+ nodeRemovalPerturbation,
159
+ weightNoisePerturbation,
160
+ ];
161
+ /**
162
+ * Get a perturbation by ID.
163
+ *
164
+ * @param id - Perturbation identifier
165
+ * @returns Perturbation or undefined
166
+ */
167
+ export const getPerturbation = (id) => PERTURBATIONS.find((p) => p.id === id);
168
+ /**
169
+ * Create a perturbation with custom intensity.
170
+ *
171
+ * @param config - Perturbation configuration
172
+ * @returns Perturbation with configured intensity
173
+ */
174
+ export const createPerturbation = (config) => {
175
+ const basePerturbation = getPerturbation(config.type);
176
+ if (!basePerturbation) {
177
+ throw new Error(`Unknown perturbation type: ${config.type}`);
178
+ }
179
+ return {
180
+ ...basePerturbation,
181
+ intensity: config.intensity,
182
+ };
183
+ };
184
+ //# sourceMappingURL=perturbations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"perturbations.js","sourceRoot":"","sources":["../../src/robustness/perturbations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAiB;IACpD,EAAE,EAAE,cAAc;IAClB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,qCAAqC;IAClD,IAAI,EAAE,YAAY;IAClB,SAAS,EAAE,GAAG,EAAE,+BAA+B;IAE/C,KAAK,CAAC,cAA8B,EAAE,IAAI,GAAG,EAAE;QAC9C,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC;QACxC,0EAA0E;QAC1E,sCAAsC;QAEtC,2BAA2B;QAC3B,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC;aACtC,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,iBAAiB,SAAS,IAAI,IAAI,EAAE,CAAC;aACpE,MAAM,CAAC,KAAK,CAAC;aACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAEf,yEAAyE;QACzE,MAAM,kBAAkB,GAAwB,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,C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;AACH,MAAM,CAAC,MAAM,aAAa,GAAmB;IAC5C,uBAAuB;IACvB,qBAAqB;IACrB,uBAAuB;IACvB,uBAAuB;CACvB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAU,EAA4B,EAAE,CACvE,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,MAA0B,EAAgB,EAAE;IAC9E,MAAM,gBAAgB,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9D,CAAC;IAED,OAAO;QACN,GAAG,gBAAgB;QACnB,SAAS,EAAE,MAAM,CAAC,SAAS;KAC3B,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Unit tests for Mann-Whitney U test and related statistical functions.
3
+ *
4
+ * Tests the non-parametric statistical test for comparing two independent samples.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=mann-whitney-u.unit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mann-whitney-u.unit.test.d.ts","sourceRoot":"","sources":["../../../src/statistical/__tests__/mann-whitney-u.unit.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Unit tests for Mann-Whitney U test and related statistical functions.
3
+ *
4
+ * Tests the non-parametric statistical test for comparing two independent samples.
5
+ */
6
+ import { describe, it } from "node:test";
7
+ import { strict as assert } from "node:assert";
8
+ import { normalCDF, mannWhitneyUTest, cohensD, confidenceInterval } from "../mann-whitney-u.js";
9
+ describe("normalCDF", () => {
10
+ it("should return 0.5 for z = 0", () => {
11
+ const result = normalCDF(0);
12
+ assert.ok(Math.abs(result - 0.5) < 0.001);
13
+ });
14
+ it("should approach 1 for large positive z", () => {
15
+ const result = normalCDF(5);
16
+ assert.ok(result > 0.99);
17
+ });
18
+ it("should approach 0 for large negative z", () => {
19
+ const result = normalCDF(-5);
20
+ assert.ok(result < 0.01);
21
+ });
22
+ it("should be symmetric around 0", () => {
23
+ const z = 1.5;
24
+ const positive = normalCDF(z);
25
+ const negative = normalCDF(-z);
26
+ assert.ok(Math.abs(positive + negative - 1) < 0.001);
27
+ });
28
+ it("should handle negative z values", () => {
29
+ const result = normalCDF(-1);
30
+ assert.ok(result < 0.5);
31
+ assert.ok(result > 0.1);
32
+ });
33
+ });
34
+ describe("mannWhitneyUTest", () => {
35
+ it("should calculate U statistic for distinct samples", () => {
36
+ const sampleA = [1, 2, 3];
37
+ const sampleB = [4, 5, 6];
38
+ const result = mannWhitneyUTest(sampleA, sampleB);
39
+ assert.ok(typeof result.u === "number");
40
+ assert.ok(result.u >= 0);
41
+ assert.ok(typeof result.pValue === "number");
42
+ assert.ok(typeof result.significant === "boolean");
43
+ });
44
+ it("should detect significant difference between distinct samples", () => {
45
+ const sampleA = [1, 1, 1, 1, 1];
46
+ const sampleB = [100, 100, 100, 100, 100];
47
+ const result = mannWhitneyUTest(sampleA, sampleB);
48
+ assert.ok(result.pValue < 0.05);
49
+ assert.strictEqual(result.significant, true);
50
+ });
51
+ it("should not detect difference in similar samples", () => {
52
+ const sampleA = [5, 5, 5, 5, 5];
53
+ const sampleB = [5, 5, 5, 5, 5];
54
+ const result = mannWhitneyUTest(sampleA, sampleB);
55
+ // When samples are identical, p-value should be 1
56
+ assert.ok(result.pValue >= 0.95);
57
+ assert.strictEqual(result.significant, false);
58
+ });
59
+ it("should handle overlapping samples", () => {
60
+ const sampleA = [1, 2, 3, 4, 5];
61
+ const sampleB = [3, 4, 5, 6, 7];
62
+ const result = mannWhitneyUTest(sampleA, sampleB);
63
+ assert.ok(result.pValue >= 0 && result.pValue <= 1);
64
+ assert.ok(typeof result.significant === "boolean");
65
+ });
66
+ it("should handle samples with ties", () => {
67
+ const sampleA = [1, 2, 2, 3];
68
+ const sampleB = [2, 3, 4, 5];
69
+ const result = mannWhitneyUTest(sampleA, sampleB);
70
+ assert.ok(typeof result.u === "number");
71
+ assert.ok(result.pValue >= 0 && result.pValue <= 1);
72
+ });
73
+ it("should handle single-element samples", () => {
74
+ const sampleA = [5];
75
+ const sampleB = [10];
76
+ const result = mannWhitneyUTest(sampleA, sampleB);
77
+ assert.ok(typeof result.u === "number");
78
+ assert.ok(typeof result.pValue === "number");
79
+ });
80
+ it("should handle empty sample A", () => {
81
+ const sampleA = [];
82
+ const sampleB = [1, 2, 3];
83
+ const result = mannWhitneyUTest(sampleA, sampleB);
84
+ assert.strictEqual(result.u, 0);
85
+ });
86
+ it("should handle empty sample B", () => {
87
+ const sampleA = [1, 2, 3];
88
+ const sampleB = [];
89
+ const result = mannWhitneyUTest(sampleA, sampleB);
90
+ assert.strictEqual(result.u, 0);
91
+ });
92
+ });
93
+ describe("cohensD", () => {
94
+ it("should calculate effect size for distinct samples", () => {
95
+ const sampleA = [1, 2, 3, 4, 5];
96
+ const sampleB = [6, 7, 8, 9, 10];
97
+ const result = cohensD(sampleA, sampleB);
98
+ assert.ok(result > 0);
99
+ assert.ok(typeof result === "number");
100
+ });
101
+ it("should be zero for identical samples", () => {
102
+ const sampleA = [5, 5, 5, 5, 5];
103
+ const sampleB = [5, 5, 5, 5, 5];
104
+ const result = cohensD(sampleA, sampleB);
105
+ assert.strictEqual(result, 0);
106
+ });
107
+ it("should be symmetric", () => {
108
+ const sampleA = [1, 2, 3, 4, 5];
109
+ const sampleB = [10, 20, 30, 40, 50];
110
+ const d1 = cohensD(sampleA, sampleB);
111
+ const d2 = cohensD(sampleB, sampleA);
112
+ assert.ok(Math.abs(d1 - d2) < 0.001);
113
+ });
114
+ it("should handle large effect sizes", () => {
115
+ const sampleA = [1, 2, 1, 2, 1]; // Mean ~1.4, small variance
116
+ const sampleB = [100, 101, 100, 101, 100]; // Mean ~100.4, small variance
117
+ const result = cohensD(sampleA, sampleB);
118
+ assert.ok(result > 0.8); // Large effect due to separation of means
119
+ });
120
+ it("should handle small effect sizes", () => {
121
+ const sampleA = [10, 11, 12, 13, 14];
122
+ const sampleB = [12, 13, 14, 15, 16];
123
+ const result = cohensD(sampleA, sampleB);
124
+ assert.ok(result >= 0);
125
+ assert.ok(result < 2); // Should be reasonable
126
+ });
127
+ it("should handle samples with variance", () => {
128
+ const sampleA = [1, 2, 3, 4, 5];
129
+ const sampleB = [3, 4, 5, 6, 7];
130
+ const result = cohensD(sampleA, sampleB);
131
+ assert.ok(result >= 0);
132
+ });
133
+ it("should handle samples with same mean but different variance", () => {
134
+ const sampleA = [0, 10, 0, 10, 0, 10];
135
+ const sampleB = [4, 6, 4, 6, 4, 6];
136
+ // Both have mean 5
137
+ const meanA = sampleA.reduce((a, b) => a + b, 0) / sampleA.length;
138
+ const meanB = sampleB.reduce((a, b) => a + b, 0) / sampleB.length;
139
+ const result = cohensD(sampleA, sampleB);
140
+ assert.strictEqual(meanA, 5);
141
+ assert.strictEqual(meanB, 5);
142
+ assert.strictEqual(result, 0);
143
+ });
144
+ });
145
+ describe("confidenceInterval", () => {
146
+ it("should calculate interval for sample values", () => {
147
+ const values = [1, 2, 3, 4, 5];
148
+ const result = confidenceInterval(values);
149
+ assert.ok(typeof result.lower === "number");
150
+ assert.ok(typeof result.upper === "number");
151
+ assert.ok(result.lower < result.upper);
152
+ });
153
+ it("should be centered around mean", () => {
154
+ const values = [10, 20, 30, 40, 50];
155
+ const mean = values.reduce((a, b) => a + b, 0) / values.length;
156
+ const result = confidenceInterval(values);
157
+ const midpoint = (result.lower + result.upper) / 2;
158
+ assert.ok(Math.abs(midpoint - mean) < 0.1);
159
+ });
160
+ it("should handle identical values", () => {
161
+ const values = [5, 5, 5, 5, 5];
162
+ const result = confidenceInterval(values);
163
+ // With no variance, lower and upper should be same
164
+ assert.ok(Math.abs(result.lower - 5) < 0.01);
165
+ assert.ok(Math.abs(result.upper - 5) < 0.01);
166
+ });
167
+ it("should handle two values", () => {
168
+ const values = [0, 10];
169
+ const result = confidenceInterval(values);
170
+ assert.ok(result.lower < result.upper);
171
+ assert.ok(result.lower < 5);
172
+ assert.ok(result.upper > 5);
173
+ });
174
+ it("should have reasonable interval width for low variance", () => {
175
+ const values = [50, 51, 50, 51, 50, 51];
176
+ const mean = values.reduce((a, b) => a + b, 0) / values.length;
177
+ const result = confidenceInterval(values);
178
+ // Low variance should give narrow interval
179
+ const width = result.upper - result.lower;
180
+ assert.ok(width < 2); // Should be narrow
181
+ assert.ok(result.lower <= mean);
182
+ assert.ok(result.upper >= mean);
183
+ });
184
+ });
185
+ //# sourceMappingURL=mann-whitney-u.unit.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mann-whitney-u.unit.test.js","sourceRoot":"","sources":["../../../src/statistical/__tests__/mann-whitney-u.unit.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEhG,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IAC1B,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACtC,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QACjD,MAAM,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;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AC,MAAM,CAAC,CAAC;QAE1C,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QACjE,MAAM,MAAM,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;QAE/D,MAAM,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAE1C,2CAA2C;QAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1C,MAAM,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB;QACzC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;QAChC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Statistical Test Utilities
3
+ *
4
+ * Collection of statistical functions for hypothesis testing,
5
+ * effect size calculation, and confidence intervals.
6
+ */
7
+ export { mannWhitneyUTest, normalCDF, cohensD, confidenceInterval } from "./mann-whitney-u.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/statistical/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Statistical Test Utilities
3
+ *
4
+ * Collection of statistical functions for hypothesis testing,
5
+ * effect size calculation, and confidence intervals.
6
+ */
7
+ export { mannWhitneyUTest, normalCDF, cohensD, confidenceInterval } from "./mann-whitney-u.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/statistical/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Mann-Whitney U Test
3
+ *
4
+ * Statistical test for comparing two independent samples.
5
+ * Tests whether two populations have the same distribution.
6
+ *
7
+ * H0: Both populations have the same distribution
8
+ * H1: Populations have different distributions
9
+ *
10
+ * Returns p-value (smaller = more significant difference)
11
+ */
12
+ /**
13
+ * Standard normal cumulative distribution function.
14
+ * Uses the Abramowitz and Stegun approximation.
15
+ *
16
+ * @param z - Z-score
17
+ * @returns Cumulative probability from -infinity to z
18
+ */
19
+ export declare const normalCDF: (z: number) => number;
20
+ /**
21
+ * Mann-Whitney U test for comparing two independent samples.
22
+ *
23
+ * Non-parametric test that does not assume normal distribution.
24
+ * Tests whether two populations have the same distribution.
25
+ *
26
+ * @param sampleA - First sample array
27
+ * @param sampleB - Second sample array
28
+ * @returns Object containing U statistic, p-value, and significance flag
29
+ */
30
+ export declare const mannWhitneyUTest: (sampleA: number[], sampleB: number[]) => {
31
+ u: number;
32
+ pValue: number;
33
+ significant: boolean;
34
+ };
35
+ /**
36
+ * Calculate Cohen's d effect size.
37
+ *
38
+ * Measures the standardized difference between two means.
39
+ *
40
+ * Interpretation:
41
+ * - 0.2: Small effect
42
+ * - 0.5: Medium effect
43
+ * - 0.8: Large effect
44
+ *
45
+ * @param sampleA - First sample array
46
+ * @param sampleB - Second sample array
47
+ * @returns Cohen's d effect size
48
+ */
49
+ export declare const cohensD: (sampleA: number[], sampleB: number[]) => number;
50
+ /**
51
+ * Calculate confidence interval for a mean.
52
+ *
53
+ * Uses t-distribution approximation (1.96 for 95% CI with large samples).
54
+ *
55
+ * @param values - Sample values
56
+ * @returns Object with lower and upper bounds
57
+ */
58
+ export declare const confidenceInterval: (values: number[]) => {
59
+ lower: number;
60
+ upper: number;
61
+ };
62
+ //# sourceMappingURL=mann-whitney-u.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mann-whitney-u.d.ts","sourceRoot":"","sources":["../../src/statistical/mann-whitney-u.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,MAarC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,GAC5B,SAAS,MAAM,EAAE,EACjB,SAAS,MAAM,EAAE,KACf;IACF,CAAC,EAAE,MAAM,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CAgDrB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,EAAE,EAAE,SAAS,MAAM,EAAE,KAAG,MAa9D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,QAAQ,MAAM,EAAE,KAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAYnF,CAAC"}
@@ -0,0 +1,127 @@
1
+ /**
2
+ * Mann-Whitney U Test
3
+ *
4
+ * Statistical test for comparing two independent samples.
5
+ * Tests whether two populations have the same distribution.
6
+ *
7
+ * H0: Both populations have the same distribution
8
+ * H1: Populations have different distributions
9
+ *
10
+ * Returns p-value (smaller = more significant difference)
11
+ */
12
+ /**
13
+ * Standard normal cumulative distribution function.
14
+ * Uses the Abramowitz and Stegun approximation.
15
+ *
16
+ * @param z - Z-score
17
+ * @returns Cumulative probability from -infinity to z
18
+ */
19
+ export const normalCDF = (z) => {
20
+ const sign = z < 0 ? -1 : 1;
21
+ z = Math.abs(z) / Math.sqrt(2);
22
+ const a1 = 0.254_829_592;
23
+ const a2 = -0.284_496_736;
24
+ const a3 = 1.421_413_741;
25
+ const a4 = -1.453_152_027;
26
+ const a5 = 1.061_405_429;
27
+ const p = 0.327_591_1;
28
+ const t = 1 / (1 + p * z);
29
+ const y = 1 - ((((a5 * t + a4) * t + a3) * t + a2) * t + a1) * t * Math.exp(-z * z);
30
+ return 0.5 * (1 + sign * y);
31
+ };
32
+ /**
33
+ * Mann-Whitney U test for comparing two independent samples.
34
+ *
35
+ * Non-parametric test that does not assume normal distribution.
36
+ * Tests whether two populations have the same distribution.
37
+ *
38
+ * @param sampleA - First sample array
39
+ * @param sampleB - Second sample array
40
+ * @returns Object containing U statistic, p-value, and significance flag
41
+ */
42
+ export const mannWhitneyUTest = (sampleA, sampleB) => {
43
+ // Rank all values combined
44
+ const combined = [...sampleA, ...sampleB];
45
+ const sorted = [...combined].sort((a, b) => a - b);
46
+ // Assign ranks (handle ties)
47
+ const ranks = new Map();
48
+ for (const [index, value] of sorted.entries()) {
49
+ if (!ranks.has(value)) {
50
+ ranks.set(value, []);
51
+ }
52
+ const positions = ranks.get(value);
53
+ if (positions) {
54
+ positions.push(index + 1);
55
+ }
56
+ }
57
+ // Average rank for tied values
58
+ const avgRanks = new Map();
59
+ for (const [value, positions] of ranks) {
60
+ avgRanks.set(value, positions.reduce((a, b) => a + b, 0) / positions.length);
61
+ }
62
+ // Sum ranks for each sample
63
+ const rankSumA = sampleA.reduce((sum, value) => sum + (avgRanks.get(value) ?? 0), 0);
64
+ const rankSumB = sampleB.reduce((sum, value) => sum + (avgRanks.get(value) ?? 0), 0);
65
+ // Calculate U statistics
66
+ const n1 = sampleA.length;
67
+ const n2 = sampleB.length;
68
+ const u1 = rankSumA - (n1 * (n1 + 1)) / 2;
69
+ const u2 = rankSumB - (n2 * (n2 + 1)) / 2;
70
+ const u = Math.min(u1, u2);
71
+ // Calculate z-score for large samples
72
+ const meanU = (n1 * n2) / 2;
73
+ const stdU = Math.sqrt((n1 * n2 * (n1 + n2 + 1)) / 12);
74
+ const z = stdU > 0 ? (u - meanU) / stdU : 0;
75
+ // Two-tailed p-value from z-score (approximation)
76
+ const pValue = 2 * (1 - normalCDF(Math.abs(z)));
77
+ return {
78
+ u,
79
+ pValue,
80
+ significant: pValue < 0.05, // 95% confidence level
81
+ };
82
+ };
83
+ /**
84
+ * Calculate Cohen's d effect size.
85
+ *
86
+ * Measures the standardized difference between two means.
87
+ *
88
+ * Interpretation:
89
+ * - 0.2: Small effect
90
+ * - 0.5: Medium effect
91
+ * - 0.8: Large effect
92
+ *
93
+ * @param sampleA - First sample array
94
+ * @param sampleB - Second sample array
95
+ * @returns Cohen's d effect size
96
+ */
97
+ export const cohensD = (sampleA, sampleB) => {
98
+ const n1 = sampleA.length;
99
+ const n2 = sampleB.length;
100
+ const mean1 = sampleA.reduce((a, b) => a + b, 0) / n1;
101
+ const mean2 = sampleB.reduce((a, b) => a + b, 0) / n2;
102
+ const variable1 = sampleA.reduce((sum, value) => sum + (value - mean1) ** 2, 0) / (n1 - 1);
103
+ const variable2 = sampleB.reduce((sum, value) => sum + (value - mean2) ** 2, 0) / (n2 - 1);
104
+ const pooledStd = Math.sqrt(((n1 - 1) * variable1 + (n2 - 1) * variable2) / (n1 + n2 - 2));
105
+ return pooledStd > 0 ? Math.abs(mean1 - mean2) / pooledStd : 0;
106
+ };
107
+ /**
108
+ * Calculate confidence interval for a mean.
109
+ *
110
+ * Uses t-distribution approximation (1.96 for 95% CI with large samples).
111
+ *
112
+ * @param values - Sample values
113
+ * @returns Object with lower and upper bounds
114
+ */
115
+ export const confidenceInterval = (values) => {
116
+ const n = values.length;
117
+ const mean = values.reduce((a, b) => a + b, 0) / n;
118
+ const std = Math.sqrt(values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / (n - 1));
119
+ const se = std / Math.sqrt(n);
120
+ const t = 1.96; // Approximation for large samples (95% CI)
121
+ const margin = t * se;
122
+ return {
123
+ lower: mean - margin,
124
+ upper: mean + margin,
125
+ };
126
+ };
127
+ //# sourceMappingURL=mann-whitney-u.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mann-whitney-u.js","sourceRoot":"","sources":["../../src/statistical/mann-whitney-u.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAU,EAAE;IAC9C,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,EAAE,GAAG,aAAa,CAAC;IACzB,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC;IAC1B,MAAM,EAAE,GAAG,aAAa,CAAC;IACzB,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC;IAC1B,MAAM,EAAE,GAAG,aAAa,CAAC;IACzB,MAAM,CAAC,GAAG,WAAW,CAAC;IAEtB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,EA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