@numero-uno-jpn/rstats 0.11.0 → 0.11.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 (269) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.ja.md +5 -4
  3. package/README.md +6 -4
  4. package/dist/chunks/{chunk-YSWGDOWK.js → chunk-2X7JYQBI.js} +2 -2
  5. package/dist/chunks/{chunk-F5EDJFEO.js → chunk-36GVER3O.js} +2 -2
  6. package/dist/chunks/{chunk-7GQMKH3Z.js → chunk-3WUXRSM6.js} +1 -1
  7. package/dist/chunks/{chunk-JWBO5WVN.js → chunk-6I6QKTFK.js} +2 -2
  8. package/dist/chunks/{chunk-EZWBRCJL.js → chunk-ETOEZTGL.js} +1 -1
  9. package/dist/chunks/{chunk-VJ4BDBMU.js → chunk-FVPDVRJQ.js} +2 -2
  10. package/dist/chunks/{chunk-EZAFN5CD.js → chunk-GG4BJMJW.js} +1 -1
  11. package/dist/chunks/{chunk-5WDJPHYY.js → chunk-HITD7CX6.js} +1 -1
  12. package/dist/chunks/{chunk-Y5PYRAYP.js → chunk-KK4GE65D.js} +2 -2
  13. package/dist/chunks/{chunk-AHHS6AC4.js → chunk-LAUYSGV4.js} +2 -2
  14. package/dist/chunks/{chunk-ALM3VHFP.js → chunk-M6GDXKKS.js} +1 -1
  15. package/dist/chunks/{chunk-C5XTWMGB.js → chunk-PHHUHR7T.js} +1 -1
  16. package/dist/chunks/{chunk-TOGXTCZO.js → chunk-WQPFDDIY.js} +2 -2
  17. package/dist/chunks/{chunk-CGBNKHNZ.js → chunk-X2AWQSVS.js} +2 -2
  18. package/dist/chunks/{chunk-Y5CNQ266.js → chunk-ZRJQD7VS.js} +2 -2
  19. package/dist/data/grouping.d.ts +33 -12
  20. package/dist/data/grouping.js +2 -0
  21. package/dist/descriptive/basic.d.ts +130 -17
  22. package/dist/descriptive/basic.js +115 -14
  23. package/dist/descriptive/cov.d.ts +22 -12
  24. package/dist/descriptive/dataFrames.d.ts +39 -11
  25. package/dist/descriptive/dataFrames.js +14 -6
  26. package/dist/descriptive/factanal.d.ts +26 -6
  27. package/dist/descriptive/factanal.js +7 -3
  28. package/dist/descriptive/hist.d.ts +27 -6
  29. package/dist/descriptive/hist.js +9 -3
  30. package/dist/descriptive/missing.d.ts +13 -6
  31. package/dist/descriptive/missing.js +4 -2
  32. package/dist/descriptive/moments.d.ts +91 -13
  33. package/dist/descriptive/moments.js +66 -9
  34. package/dist/descriptive/omega.d.ts +28 -6
  35. package/dist/descriptive/omega.js +16 -4
  36. package/dist/descriptive/pivot.d.ts +22 -6
  37. package/dist/descriptive/pivot.js +7 -3
  38. package/dist/descriptive/quantile.d.ts +33 -5
  39. package/dist/descriptive/quantile.js +20 -2
  40. package/dist/descriptive/rank.d.ts +12 -2
  41. package/dist/descriptive/rank.js +2 -0
  42. package/dist/descriptive/table.d.ts +55 -7
  43. package/dist/descriptive/table.js +38 -4
  44. package/dist/descriptive.js +2 -2
  45. package/dist/distributions/arcsine.d.ts +40 -5
  46. package/dist/distributions/arcsine.js +35 -4
  47. package/dist/distributions/beta.d.ts +12 -0
  48. package/dist/distributions/beta.js +12 -0
  49. package/dist/distributions/binomial.d.ts +18 -0
  50. package/dist/distributions/binomial.js +18 -0
  51. package/dist/distributions/bvnorm.d.ts +4 -1
  52. package/dist/distributions/bvnorm.js +4 -1
  53. package/dist/distributions/cauchy.d.ts +24 -0
  54. package/dist/distributions/cauchy.js +24 -0
  55. package/dist/distributions/chisq.d.ts +18 -0
  56. package/dist/distributions/chisq.js +18 -0
  57. package/dist/distributions/exponential.d.ts +29 -1
  58. package/dist/distributions/exponential.js +24 -0
  59. package/dist/distributions/f.d.ts +18 -0
  60. package/dist/distributions/f.js +18 -0
  61. package/dist/distributions/gamma.d.ts +20 -0
  62. package/dist/distributions/gamma.js +18 -0
  63. package/dist/distributions/geometric.d.ts +24 -0
  64. package/dist/distributions/geometric.js +24 -0
  65. package/dist/distributions/hypergeometric.d.ts +24 -0
  66. package/dist/distributions/hypergeometric.js +24 -0
  67. package/dist/distributions/invgamma.d.ts +32 -4
  68. package/dist/distributions/invgamma.js +27 -3
  69. package/dist/distributions/kumaraswamy.d.ts +31 -3
  70. package/dist/distributions/kumaraswamy.js +31 -3
  71. package/dist/distributions/laplace.d.ts +36 -4
  72. package/dist/distributions/laplace.js +31 -3
  73. package/dist/distributions/logistic.d.ts +29 -1
  74. package/dist/distributions/logistic.js +24 -0
  75. package/dist/distributions/lognormal.d.ts +29 -1
  76. package/dist/distributions/lognormal.js +24 -0
  77. package/dist/distributions/multinomial.d.ts +7 -1
  78. package/dist/distributions/multinomial.js +2 -0
  79. package/dist/distributions/negbinomial.d.ts +29 -1
  80. package/dist/distributions/negbinomial.js +24 -0
  81. package/dist/distributions/normal.d.ts +11 -1
  82. package/dist/distributions/normal.js +6 -0
  83. package/dist/distributions/pareto.d.ts +36 -4
  84. package/dist/distributions/pareto.js +31 -3
  85. package/dist/distributions/poisson.d.ts +18 -0
  86. package/dist/distributions/poisson.js +18 -0
  87. package/dist/distributions/signrank.d.ts +24 -0
  88. package/dist/distributions/signrank.js +24 -0
  89. package/dist/distributions/summary.d.ts +20 -2
  90. package/dist/distributions/summary.js +4 -0
  91. package/dist/distributions/t.d.ts +18 -0
  92. package/dist/distributions/t.js +18 -0
  93. package/dist/distributions/triangular.d.ts +36 -4
  94. package/dist/distributions/triangular.js +31 -3
  95. package/dist/distributions/tukey.d.ts +15 -1
  96. package/dist/distributions/tukey.js +10 -0
  97. package/dist/distributions/uniform.d.ts +29 -1
  98. package/dist/distributions/uniform.js +24 -0
  99. package/dist/distributions/weibull.d.ts +29 -1
  100. package/dist/distributions/weibull.js +24 -0
  101. package/dist/distributions/wilcox.d.ts +24 -0
  102. package/dist/distributions/wilcox.js +24 -0
  103. package/dist/distributions.js +2 -2
  104. package/dist/entries/descriptive.d.ts +1 -1
  105. package/dist/entries/numerics.d.ts +1 -1
  106. package/dist/entries/tests.js +1 -1
  107. package/dist/htest/agreement.d.ts +61 -23
  108. package/dist/htest/agreement.js +19 -9
  109. package/dist/htest/ansariTest.d.ts +8 -2
  110. package/dist/htest/aov.d.ts +43 -10
  111. package/dist/htest/aov.js +17 -3
  112. package/dist/htest/binomTest.d.ts +12 -2
  113. package/dist/htest/binomTest.js +2 -0
  114. package/dist/htest/brunnerMunzelTest.d.ts +9 -3
  115. package/dist/htest/brunnerMunzelTest.js +4 -2
  116. package/dist/htest/chisqTest.d.ts +19 -3
  117. package/dist/htest/cor.d.ts +20 -4
  118. package/dist/htest/effectSize.d.ts +70 -12
  119. package/dist/htest/effectSize.js +40 -7
  120. package/dist/htest/fisherTest.d.ts +9 -1
  121. package/dist/htest/fisherTest.js +2 -0
  122. package/dist/htest/groups.d.ts +5 -1
  123. package/dist/htest/ksTest.d.ts +20 -3
  124. package/dist/htest/leveneTest.d.ts +15 -4
  125. package/dist/htest/leveneTest.js +5 -2
  126. package/dist/htest/mantelhaenTest.d.ts +25 -3
  127. package/dist/htest/mantelhaenTest.js +15 -1
  128. package/dist/htest/mcnemarTest.d.ts +14 -4
  129. package/dist/htest/mcnemarTest.js +4 -2
  130. package/dist/htest/multipleComparisons.d.ts +173 -29
  131. package/dist/htest/multipleComparisons.js +123 -19
  132. package/dist/htest/normalityTests.d.ts +56 -9
  133. package/dist/htest/normalityTests.js +40 -6
  134. package/dist/htest/onewayTest.d.ts +32 -3
  135. package/dist/htest/onewayTest.js +10 -0
  136. package/dist/htest/pAdjust.d.ts +9 -1
  137. package/dist/htest/pAdjust.js +2 -0
  138. package/dist/htest/pairwise.d.ts +50 -5
  139. package/dist/htest/pairwise.js +25 -0
  140. package/dist/htest/poissonTest.d.ts +12 -2
  141. package/dist/htest/poissonTest.js +2 -0
  142. package/dist/htest/polycor.d.ts +29 -10
  143. package/dist/htest/power.d.ts +60 -6
  144. package/dist/htest/power.js +6 -0
  145. package/dist/htest/propTest.d.ts +13 -2
  146. package/dist/htest/propTest.js +2 -0
  147. package/dist/htest/pwr.d.ts +286 -36
  148. package/dist/htest/pwr.js +116 -15
  149. package/dist/htest/rankTests.d.ts +80 -12
  150. package/dist/htest/rankTests.js +11 -2
  151. package/dist/htest/tTest.d.ts +13 -3
  152. package/dist/htest/trendTests.d.ts +29 -8
  153. package/dist/htest/trendTests.js +8 -4
  154. package/dist/htest/types.d.ts +14 -2
  155. package/dist/htest/varTest.d.ts +25 -8
  156. package/dist/htest/wilcoxTest.d.ts +10 -2
  157. package/dist/internal/dpq.d.ts +4 -0
  158. package/dist/internal/noncentral.d.ts +2 -0
  159. package/dist/internal/vectorize.d.ts +4 -0
  160. package/dist/linalg/basic.d.ts +39 -5
  161. package/dist/linalg/basic.js +15 -0
  162. package/dist/linalg/chol.d.ts +26 -5
  163. package/dist/linalg/chol.js +7 -0
  164. package/dist/linalg/eigen.d.ts +16 -7
  165. package/dist/linalg/eigen.js +6 -5
  166. package/dist/linalg/expm.d.ts +15 -5
  167. package/dist/linalg/expm.js +5 -3
  168. package/dist/linalg/kappa.d.ts +21 -1
  169. package/dist/linalg/kappa.js +16 -0
  170. package/dist/linalg/lu.d.ts +30 -6
  171. package/dist/linalg/lu.js +15 -3
  172. package/dist/linalg/matrix.d.ts +4 -0
  173. package/dist/linalg/norm.d.ts +16 -1
  174. package/dist/linalg/norm.js +9 -0
  175. package/dist/linalg/ops.d.ts +156 -35
  176. package/dist/linalg/ops.js +96 -15
  177. package/dist/linalg/qr.d.ts +87 -12
  178. package/dist/linalg/qr.js +31 -0
  179. package/dist/linalg/schur.d.ts +8 -2
  180. package/dist/linalg/schur.js +3 -1
  181. package/dist/linalg/solve.d.ts +42 -6
  182. package/dist/linalg/solve.js +22 -0
  183. package/dist/linalg/svd.d.ts +12 -2
  184. package/dist/linalg/svd.js +2 -0
  185. package/dist/linalg.js +2 -2
  186. package/dist/models/anovaSequential.d.ts +26 -4
  187. package/dist/models/anovaSequential.js +3 -1
  188. package/dist/models/aovEz.d.ts +29 -6
  189. package/dist/models/aovEz.js +5 -2
  190. package/dist/models/aovStrata.d.ts +12 -2
  191. package/dist/models/carAnova.d.ts +9 -3
  192. package/dist/models/carAnova.js +4 -2
  193. package/dist/models/coxph.d.ts +33 -7
  194. package/dist/models/coxph.js +8 -3
  195. package/dist/models/glm.d.ts +128 -21
  196. package/dist/models/glm.js +71 -14
  197. package/dist/models/glmAnova.d.ts +30 -5
  198. package/dist/models/glmAnova.js +15 -2
  199. package/dist/models/glmConfint.d.ts +16 -2
  200. package/dist/models/glmConfint.js +9 -1
  201. package/dist/models/glmFamily.d.ts +27 -5
  202. package/dist/models/lm.d.ts +75 -17
  203. package/dist/models/lm.js +22 -4
  204. package/dist/models/mauchly.d.ts +20 -5
  205. package/dist/models/mauchly.js +7 -3
  206. package/dist/models/modelFrame.d.ts +5 -1
  207. package/dist/models/modelMatrix.d.ts +18 -4
  208. package/dist/models/modelMatrix.js +3 -1
  209. package/dist/models/survival.d.ts +41 -9
  210. package/dist/models/survival.js +10 -4
  211. package/dist/numerics/deriv.d.ts +21 -6
  212. package/dist/numerics/deriv.js +16 -5
  213. package/dist/numerics/integrate.d.ts +37 -7
  214. package/dist/numerics/integrate.js +8 -2
  215. package/dist/numerics/interp.d.ts +63 -12
  216. package/dist/numerics/interp.js +30 -6
  217. package/dist/numerics/ode.d.ts +15 -5
  218. package/dist/numerics/ode.js +5 -3
  219. package/dist/numerics.js +2 -2
  220. package/dist/optim/optim.d.ts +32 -8
  221. package/dist/optim/optim.js +8 -4
  222. package/dist/random/beta.d.ts +8 -0
  223. package/dist/random/beta.js +8 -0
  224. package/dist/random/binomial.d.ts +16 -0
  225. package/dist/random/binomial.js +16 -0
  226. package/dist/random/continuous.d.ts +51 -0
  227. package/dist/random/continuous.js +51 -0
  228. package/dist/random/extra.d.ts +66 -6
  229. package/dist/random/extra.js +66 -6
  230. package/dist/random/gamma.d.ts +33 -0
  231. package/dist/random/gamma.js +33 -0
  232. package/dist/random/hyper.d.ts +8 -0
  233. package/dist/random/hyper.js +8 -0
  234. package/dist/random/poisson.d.ts +25 -0
  235. package/dist/random/poisson.js +25 -0
  236. package/dist/random/r2dtable.d.ts +2 -0
  237. package/dist/random/r2dtable.js +2 -0
  238. package/dist/random/rank.d.ts +16 -0
  239. package/dist/random/rank.js +16 -0
  240. package/dist/random/rng.d.ts +49 -6
  241. package/dist/random/rng.js +29 -2
  242. package/dist/random/sample.d.ts +10 -2
  243. package/dist/random/sample.js +5 -1
  244. package/dist/random/streams.d.ts +13 -0
  245. package/dist/random/streams.js +13 -0
  246. package/dist/rstats.js +1 -1
  247. package/dist/special/besselIK.d.ts +11 -3
  248. package/dist/special/besselIK.js +6 -2
  249. package/dist/special/besselJY.d.ts +6 -2
  250. package/dist/special/besselJY.js +6 -2
  251. package/dist/special/beta.d.ts +16 -2
  252. package/dist/special/beta.js +16 -2
  253. package/dist/special/choose.d.ts +13 -5
  254. package/dist/special/choose.js +13 -5
  255. package/dist/special/erf.d.ts +8 -3
  256. package/dist/special/erf.js +8 -3
  257. package/dist/special/extra.d.ts +30 -10
  258. package/dist/special/extra.js +25 -9
  259. package/dist/special/gamma.d.ts +18 -2
  260. package/dist/special/gamma.js +18 -2
  261. package/dist/special/log1p.d.ts +16 -7
  262. package/dist/special/log1p.js +16 -7
  263. package/dist/special/psigamma.d.ts +9 -3
  264. package/dist/special/psigamma.js +9 -3
  265. package/dist/special/rCompatible.d.ts +5 -1
  266. package/dist/special.js +2 -2
  267. package/dist/tests.js +2 -2
  268. package/llms.txt +2 -0
  269. package/package.json +1 -1
package/dist/htest/pwr.js CHANGED
@@ -19,23 +19,43 @@ const COHEN = {
19
19
  f2: [0.02, 0.15, 0.35],
20
20
  };
21
21
  /**
22
- * Cohen's conventional effect sizes. Equivalent to pwr's `cohen.ES(test, size)`.
22
+ * Cohen's conventional effect sizes. Equivalent to `pwr::cohen.ES(test, size)` in R.
23
23
  *
24
24
  * @example
25
25
  * ```ts
26
26
  * cohenES("anov", "medium").effectSize; // 0.25
27
27
  * ```
28
+ *
29
+ * @category Effect sizes and power
28
30
  */
29
31
  export function cohenES(test = "p", size = "small") {
30
32
  const t = matchChoice(test, ["p", "t", "r", "anov", "chisq", "f2"]);
31
33
  const s = matchChoice(size, ["small", "medium", "large"]);
32
34
  return { test: t, size: s, effectSize: COHEN[t][["small", "medium", "large"].indexOf(s)], method: "Conventional effect size from Cohen (1982)" };
33
35
  }
34
- /** Effect size h of two proportions: `2 asin(sqrt(p1)) - 2 asin(sqrt(p2))`. Equivalent to pwr's `ES.h`. */
36
+ /**
37
+ * Effect size h of two proportions: `2 asin(sqrt(p1)) - 2 asin(sqrt(p2))`. Equivalent to `pwr::ES.h()` in R.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * esH(0.65, 0.45); // 0.40486007517695755
42
+ * ```
43
+ *
44
+ * @category Effect sizes and power
45
+ */
35
46
  export function esH(p1, p2) {
36
47
  return 2 * Math.asin(Math.sqrt(p1)) - 2 * Math.asin(Math.sqrt(p2));
37
48
  }
38
- /** Effect size w of a goodness-of-fit test, `sqrt(sum((p1 - p0)^2 / p0))`. Equivalent to pwr's `ES.w1`. */
49
+ /**
50
+ * Effect size w of a goodness-of-fit test, `sqrt(sum((p1 - p0)^2 / p0))`. Equivalent to `pwr::ES.w1()` in R.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * esW1([0.25, 0.25, 0.25, 0.25], [0.4, 0.2, 0.2, 0.2]); // 0.34641016151377546
55
+ * ```
56
+ *
57
+ * @category Effect sizes and power
58
+ */
39
59
  export function esW1(p0, p1) {
40
60
  if (p0.length !== p1.length)
41
61
  throw new RangeError("'P0' and 'P1' must have the same length");
@@ -46,7 +66,14 @@ export function esW1(p0, p1) {
46
66
  }
47
67
  /**
48
68
  * Effect size w of a test of association, for a matrix of cell probabilities (an array of rows): with the row sums
49
- * r and column sums c, `p0 = r c'` and `sqrt(sum((p - p0)^2 / p0))`. Equivalent to pwr's `ES.w2`.
69
+ * r and column sums c, `p0 = r c'` and `sqrt(sum((p - p0)^2 / p0))`. Equivalent to `pwr::ES.w2()` in R.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * esW2([[0.3, 0.2], [0.1, 0.4]]); // 0.40824829046386296
74
+ * ```
75
+ *
76
+ * @category Effect sizes and power
50
77
  */
51
78
  export function esW2(p) {
52
79
  const rows = p.map((r) => r.reduce((a, b) => a + b, 0));
@@ -98,14 +125,16 @@ function normalPower(shift, sig, alt) {
98
125
  return (pnorm(qnorm(1 - sig / 2) - shift, { lowerTail: false }) + pnorm(qnorm(sig / 2) - shift));
99
126
  }
100
127
  /**
101
- * Power of a t test of means, or the sample size, effect size or significance level for a given power. Equivalent
102
- * to pwr's `pwr.t.test()`.
128
+ * Power of a t test of means, or the sample size, effect size or significance level for a given power.
129
+ * Equivalent to `pwr::pwr.t.test()` in R.
103
130
  *
104
131
  * @example
105
132
  * ```ts
106
133
  * pwrTTest({ n: 20, d: 0.5 }).power; // 0.3379390289250411
107
134
  * pwrTTest({ d: 0.5, power: 0.8 }).n; // 63.76561044415068
108
135
  * ```
136
+ *
137
+ * @category Effect sizes and power
109
138
  */
110
139
  export function pwrTTest(options = {}) {
111
140
  let { n, power } = options;
@@ -136,7 +165,15 @@ export function pwrTTest(options = {}) {
136
165
  }
137
166
  /**
138
167
  * Power of a two-sample t test with unequal sample sizes, or a sample size, the effect size or the significance
139
- * level for a given power. Equivalent to pwr's `pwr.t2n.test()`.
168
+ * level for a given power. Equivalent to `pwr::pwr.t2n.test()` in R.
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * pwrT2nTest({ n1: 20, n2: 30, d: 0.5 }).power; // 0.39656999440895696
173
+ * pwrT2nTest({ n1: 50, d: 0.5, power: 0.8 }).n2; // 87.70891347276086
174
+ * ```
175
+ *
176
+ * @category Effect sizes and power
140
177
  */
141
178
  export function pwrT2nTest(options = {}) {
142
179
  let { n1, n2, power } = options;
@@ -195,7 +232,15 @@ function normalTest(es0, options, name, scale, nLower, esLower) {
195
232
  }
196
233
  /**
197
234
  * Power of the test of two proportions with equal sample sizes (arcsine transformation), or the effect size, sample
198
- * size or significance level for a given power. Equivalent to pwr's `pwr.2p.test()`.
235
+ * size or significance level for a given power. Equivalent to `pwr::pwr.2p.test()` in R.
236
+ *
237
+ * @example
238
+ * ```ts
239
+ * pwr2pTest({ h: 0.3, n: 80 }).power; // 0.47510087057263806
240
+ * pwr2pTest({ h: esH(0.65, 0.45), power: 0.8 }).n; // 95.76938656160651
241
+ * ```
242
+ *
243
+ * @category Effect sizes and power
199
244
  */
200
245
  export function pwr2pTest(options = {}) {
201
246
  const r = normalTest(options.h, options, "h", (n) => Math.sqrt(n / 2), 2 + 1e-10, 1e-10);
@@ -211,7 +256,15 @@ export function pwr2pTest(options = {}) {
211
256
  }
212
257
  /**
213
258
  * Power of the test of one proportion (arcsine transformation), or the effect size, sample size or significance
214
- * level for a given power. Equivalent to pwr's `pwr.p.test()`.
259
+ * level for a given power. Equivalent to `pwr::pwr.p.test()` in R.
260
+ *
261
+ * @example
262
+ * ```ts
263
+ * pwrPTest({ h: 0.2, n: 60 }).power; // 0.34084512406749834
264
+ * pwrPTest({ h: 0.2, power: 0.8 }).n; // 196.221512550509
265
+ * ```
266
+ *
267
+ * @category Effect sizes and power
215
268
  */
216
269
  export function pwrPTest(options = {}) {
217
270
  const r = normalTest(options.h, options, "h", (n) => Math.sqrt(n), 2 + 1e-10, 1e-10);
@@ -226,7 +279,15 @@ export function pwrPTest(options = {}) {
226
279
  }
227
280
  /**
228
281
  * Power of the test of a mean of a normal distribution with known variance, or the effect size, sample size or
229
- * significance level for a given power. Equivalent to pwr's `pwr.norm.test()`.
282
+ * significance level for a given power. Equivalent to `pwr::pwr.norm.test()` in R.
283
+ *
284
+ * @example
285
+ * ```ts
286
+ * pwrNormTest({ d: 0.3, n: 50 }).power; // 0.5641160254310038
287
+ * pwrNormTest({ d: 0.3, power: 0.8 }).n; // 87.20953791564195
288
+ * ```
289
+ *
290
+ * @category Effect sizes and power
230
291
  */
231
292
  export function pwrNormTest(options = {}) {
232
293
  const r = normalTest(options.d, options, "d", (n) => Math.sqrt(n), 1 + 1e-10, 1e-10);
@@ -241,7 +302,15 @@ export function pwrNormTest(options = {}) {
241
302
  }
242
303
  /**
243
304
  * Power of the test of two proportions with unequal sample sizes (arcsine transformation), or the effect size, a
244
- * sample size or the significance level for a given power. Equivalent to pwr's `pwr.2p2n.test()`.
305
+ * sample size or the significance level for a given power. Equivalent to `pwr::pwr.2p2n.test()` in R.
306
+ *
307
+ * @example
308
+ * ```ts
309
+ * pwr2p2nTest({ h: 0.3, n1: 80, n2: 120 }).power; // 0.5471899635264242
310
+ * pwr2p2nTest({ h: 0.3, n1: 200, power: 0.8 }).n2; // 154.6399892648981
311
+ * ```
312
+ *
313
+ * @category Effect sizes and power
245
314
  */
246
315
  export function pwr2p2nTest(options = {}) {
247
316
  let { n1, n2, power } = options;
@@ -283,8 +352,16 @@ export function pwr2p2nTest(options = {}) {
283
352
  }
284
353
  /**
285
354
  * Power of the test of a correlation (Fisher's z transformation), or the sample size, correlation or significance
286
- * level for a given power. Equivalent to pwr's `pwr.r.test()`. As in pwr, the power computed for `"less"` reports
355
+ * level for a given power. Equivalent to `pwr::pwr.r.test()` in R. As in pwr, the power computed for `"less"` reports
287
356
  * `r` negated.
357
+ *
358
+ * @example
359
+ * ```ts
360
+ * pwrRTest({ n: 50, r: 0.3 }).power; // 0.571555841860208
361
+ * pwrRTest({ r: 0.3, power: 0.8 }).n; // 84.07363978228769
362
+ * ```
363
+ *
364
+ * @category Effect sizes and power
288
365
  */
289
366
  export function pwrRTest(options = {}) {
290
367
  let { n, power } = options;
@@ -333,7 +410,15 @@ export function pwrRTest(options = {}) {
333
410
  }
334
411
  /**
335
412
  * Power of a chi-squared test, or the effect size, number of observations or significance level for a given power.
336
- * Equivalent to pwr's `pwr.chisq.test()`.
413
+ * Equivalent to `pwr::pwr.chisq.test()` in R.
414
+ *
415
+ * @example
416
+ * ```ts
417
+ * pwrChisqTest({ w: 0.3, N: 100, df: 3 }).power; // 0.7112535997950422
418
+ * pwrChisqTest({ w: 0.3, df: 3, power: 0.8 }).N; // 121.13959310294602
419
+ * ```
420
+ *
421
+ * @category Effect sizes and power
337
422
  */
338
423
  export function pwrChisqTest(options) {
339
424
  let { N, power } = options;
@@ -364,7 +449,15 @@ export function pwrChisqTest(options) {
364
449
  }
365
450
  /**
366
451
  * Power of the F test of a balanced one-way analysis of variance, or the number of groups, sample size, effect size
367
- * or significance level for a given power. Equivalent to pwr's `pwr.anova.test()`.
452
+ * or significance level for a given power. Equivalent to `pwr::pwr.anova.test()` in R.
453
+ *
454
+ * @example
455
+ * ```ts
456
+ * pwrAnovaTest({ k: 4, n: 20, f: 0.25 }).power; // 0.42039009037704295
457
+ * pwrAnovaTest({ k: 4, f: 0.25, power: 0.8 }).n; // 44.59927432039623
458
+ * ```
459
+ *
460
+ * @category Effect sizes and power
368
461
  */
369
462
  export function pwrAnovaTest(options = {}) {
370
463
  let { k, n, power } = options;
@@ -408,7 +501,15 @@ export function pwrAnovaTest(options = {}) {
408
501
  }
409
502
  /**
410
503
  * Power of the F test of a general linear model, or the degrees of freedom, effect size or significance level for a
411
- * given power. Equivalent to pwr's `pwr.f2.test()`.
504
+ * given power. Equivalent to `pwr::pwr.f2.test()` in R.
505
+ *
506
+ * @example
507
+ * ```ts
508
+ * pwrF2Test({ u: 3, v: 60, f2: 0.15 }).power; // 0.7109605416866717
509
+ * pwrF2Test({ u: 3, f2: 0.15, power: 0.8 }).v; // 72.70582657950871
510
+ * ```
511
+ *
512
+ * @category Effect sizes and power
412
513
  */
413
514
  export function pwrF2Test(options = {}) {
414
515
  let { u, v, power } = options;
@@ -1,7 +1,11 @@
1
1
  import type { DataFrame } from "../models/modelFrame.js";
2
2
  import { type GroupLabel } from "./groups.js";
3
3
  import { type Alternative, type HTest, type Sample } from "./types.js";
4
- /** Result of a k-sample test with a chi-squared statistic. Has no `alternative`, as R returns none. */
4
+ /**
5
+ * Result of a k-sample test with a chi-squared statistic. Has no `alternative`, as R returns none.
6
+ *
7
+ * @category Hypothesis tests
8
+ */
5
9
  export interface ChisqStatTestResult extends Omit<HTest, "alternative"> {
6
10
  /** Degrees of freedom (`parameterName` is `"df"`). */
7
11
  parameter: number;
@@ -14,10 +18,19 @@ export interface ChisqStatTestResult extends Omit<HTest, "alternative"> {
14
18
  * @param g Group labels, parallel to `x`.
15
19
  *
16
20
  * There is also a formula form, `kruskalTest("y ~ g", data)` (next overload).
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const r = kruskalTest([[2.9, 3.0, 2.5, 2.6, 3.2], [3.8, 2.7, 4.0, 2.4], [2.8, 3.4, 3.7, 2.2, 2.0]]);
25
+ * r.statistic; // 0.7714285714285722
26
+ * r.pValue; // 0.6799647735788935
27
+ * ```
28
+ *
29
+ * @category Hypothesis tests
17
30
  */
18
31
  export declare function kruskalTest(x: Sample | readonly Sample[], g?: readonly GroupLabel[]): ChisqStatTestResult;
19
32
  /**
20
- * Kruskal-Wallis test from a formula and a data frame. Equivalent to R's `kruskal.test(formula, data)`: `"y ~ g"`,
33
+ * Kruskal-Wallis test from a formula and a data frame. As R's `kruskal.test(formula, data)`: `"y ~ g"`,
21
34
  * one group per level of `g`. Only the variables of the formula count: the rows where one of them is missing are
22
35
  * dropped.
23
36
  *
@@ -26,16 +39,25 @@ export declare function kruskalTest(x: Sample | readonly Sample[], g?: readonly
26
39
  */
27
40
  export declare function kruskalTest(formula: string, data: DataFrame): ChisqStatTestResult;
28
41
  /**
29
- * Friedman rank sum test for an unreplicated complete block design. Equivalent to R's `friedman.test()` with a
42
+ * Friedman rank sum test for an unreplicated complete block design. Equivalent to R's `friedman.test()`. Takes a
30
43
  * matrix.
31
44
  *
32
45
  * @param y Blocks as rows, treatments as columns. Rows with a missing value are dropped.
33
46
  *
34
47
  * There is also a formula form, `friedmanTest("y ~ w | b", data)` (next overload).
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const r = friedmanTest([[5.4, 5.5, 5.55], [5.85, 5.7, 5.75], [5.2, 5.6, 5.5], [5.55, 5.5, 5.4], [5.9, 5.85, 5.7]]);
52
+ * r.statistic; // 0.4
53
+ * r.pValue; // 0.8187307530779818
54
+ * ```
55
+ *
56
+ * @category Hypothesis tests
35
57
  */
36
58
  export declare function friedmanTest(y: readonly (readonly number[])[]): ChisqStatTestResult;
37
59
  /**
38
- * Friedman test from a formula and a data frame. Equivalent to R's `friedman.test(formula, data)`: `"y ~ w | b"`
60
+ * Friedman test from a formula and a data frame. As R's `friedman.test(formula, data)`: `"y ~ w | b"`
39
61
  * with the groups `w` and the blocks `b`. The rows where `y`, `w` or `b` is missing are dropped first; then every
40
62
  * combination of group and block must occur exactly once (else the error `not an unreplicated complete block
41
63
  * design`, so that one missing value fails, unlike the matrix form, which drops its block).
@@ -45,28 +67,52 @@ export declare function friedmanTest(y: readonly (readonly number[])[]): ChisqSt
45
67
  */
46
68
  export declare function friedmanTest(formula: string, data: DataFrame): ChisqStatTestResult;
47
69
  /**
48
- * Cochran's Q test for binary responses in an unreplicated complete block design. Equivalent to DescTools'
49
- * `CochranQTest()` with a matrix: the Friedman test of the 0/1 matrix (with ties), reported as Q.
70
+ * Cochran's Q test for binary responses in an unreplicated complete block design. Equivalent to
71
+ * `DescTools::CochranQTest()` in R. Takes a matrix: the Friedman test of the 0/1 matrix (with ties), reported as Q.
50
72
  *
51
73
  * @param y Blocks as rows, treatments as columns, values 0 or 1. Rows with a missing value are dropped.
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const r = cochranQTest([[1, 1, 0], [1, 0, 0], [1, 1, 1], [0, 0, 0], [1, 1, 0], [1, 0, 1]]);
78
+ * r.statistic; // 3.5
79
+ * r.pValue; // 0.17377394345044514
80
+ * ```
81
+ *
82
+ * @category Hypothesis tests
52
83
  */
53
84
  export declare function cochranQTest(y: readonly (readonly number[])[]): ChisqStatTestResult;
54
- /** Result of {@link quadeTest}: an F statistic with two degrees of freedom. */
85
+ /**
86
+ * Result of {@link quadeTest}: an F statistic with two degrees of freedom.
87
+ *
88
+ * @category Hypothesis tests
89
+ */
55
90
  export interface QuadeTestResult extends Omit<HTest, "alternative" | "parameter" | "parameterName"> {
56
91
  /** `[num df, denom df]`. */
57
92
  parameter: [number, number];
93
+ /** Names of `parameter`: `["num df", "denom df"]`. */
58
94
  parameterName: [string, string];
59
95
  }
60
96
  /**
61
- * Quade test for an unreplicated complete block design. Equivalent to R's `quade.test()` with a matrix.
97
+ * Quade test for an unreplicated complete block design. Equivalent to R's `quade.test()`. Takes a matrix.
62
98
  *
63
99
  * @param y Blocks as rows, treatments as columns. Rows with a missing value are dropped.
64
100
  *
65
101
  * There is also a formula form, `quadeTest("y ~ w | b", data)` (next overload).
102
+ *
103
+ * @example
104
+ * ```ts
105
+ * const r = quadeTest([[5.4, 5.5, 5.55], [5.85, 5.7, 5.75], [5.2, 5.6, 5.5], [5.55, 5.5, 5.4], [5.9, 5.85, 5.7]]);
106
+ * r.statistic; // 0.20634920634920637
107
+ * r.parameter; // [2, 8]
108
+ * r.pValue; // 0.8177464498805584
109
+ * ```
110
+ *
111
+ * @category Hypothesis tests
66
112
  */
67
113
  export declare function quadeTest(y: readonly (readonly number[])[]): QuadeTestResult;
68
114
  /**
69
- * Quade test from a formula and a data frame. Equivalent to R's `quade.test(formula, data)`: `"y ~ w | b"` with the
115
+ * Quade test from a formula and a data frame. As R's `quade.test(formula, data)`: `"y ~ w | b"` with the
70
116
  * groups `w` and the blocks `b`. The rows where `y`, `w` or `b` is missing are dropped first; then every combination
71
117
  * of group and block must occur exactly once (else the error `not an unreplicated complete block design`).
72
118
  *
@@ -82,10 +128,19 @@ export declare function quadeTest(formula: string, data: DataFrame): QuadeTestRe
82
128
  * @param g Group labels, parallel to `x`.
83
129
  *
84
130
  * There is also a formula form, `flignerTest("y ~ g", data)` (next overload).
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * const r = flignerTest([[2.9, 3.0, 2.5, 2.6, 3.2], [3.8, 2.7, 4.0, 2.4], [2.8, 3.4, 3.7, 2.2, 2.0]]);
135
+ * r.statistic; // 5.209183208821734
136
+ * r.pValue; // 0.07393332507668932
137
+ * ```
138
+ *
139
+ * @category Hypothesis tests
85
140
  */
86
141
  export declare function flignerTest(x: Sample | readonly Sample[], g?: readonly GroupLabel[]): ChisqStatTestResult;
87
142
  /**
88
- * Fligner-Killeen test from a formula and a data frame. Equivalent to R's `fligner.test(formula, data)`: `"y ~ g"`,
143
+ * Fligner-Killeen test from a formula and a data frame. As R's `fligner.test(formula, data)`: `"y ~ g"`,
89
144
  * one group per level of `g`. Only the variables of the formula count: the rows where one of them is missing are
90
145
  * dropped.
91
146
  *
@@ -93,7 +148,11 @@ export declare function flignerTest(x: Sample | readonly Sample[], g?: readonly
93
148
  * @param data The data frame: an object of columns (`null` or `NaN` for a missing value).
94
149
  */
95
150
  export declare function flignerTest(formula: string, data: DataFrame): ChisqStatTestResult;
96
- /** Options for {@link moodTest}. */
151
+ /**
152
+ * Options for {@link moodTest}.
153
+ *
154
+ * @category Hypothesis tests
155
+ */
97
156
  export interface MoodTestOptions {
98
157
  /** Alternative hypothesis (unambiguous abbreviations accepted). Default `"two.sided"`. */
99
158
  alternative?: Alternative | "two" | "l" | "g";
@@ -103,10 +162,19 @@ export interface MoodTestOptions {
103
162
  * of the scores of their positions.
104
163
  *
105
164
  * There is also a formula form, `moodTest("y ~ g", data, options)` (next overload).
165
+ *
166
+ * @example
167
+ * ```ts
168
+ * const r = moodTest([0.8, 1.9, 2.4, 3.1, 4.6, 5.0], [2.6, 2.9, 3.0, 3.3, 3.5]);
169
+ * r.statistic; // 2.0919054414739633
170
+ * r.pValue; // 0.03644697523591335
171
+ * ```
172
+ *
173
+ * @category Hypothesis tests
106
174
  */
107
175
  export declare function moodTest(x: Sample, y: Sample, options?: MoodTestOptions): HTest;
108
176
  /**
109
- * Mood's test from a formula and a data frame. Equivalent to R's `mood.test(formula, data)`: `"y ~ g"` compares the
177
+ * Mood's test from a formula and a data frame. As R's `mood.test(formula, data)`: `"y ~ g"` compares the
110
178
  * two levels of `g` (the first level is `x`). Only the variables of the formula count: the rows where one of them is
111
179
  * missing are dropped.
112
180
  *
@@ -87,10 +87,19 @@ export function friedmanTest(y, data) {
87
87
  return chisqResult("Friedman rank sum test", "Friedman chi-squared", stat, k - 1);
88
88
  }
89
89
  /**
90
- * Cochran's Q test for binary responses in an unreplicated complete block design. Equivalent to DescTools'
91
- * `CochranQTest()` with a matrix: the Friedman test of the 0/1 matrix (with ties), reported as Q.
90
+ * Cochran's Q test for binary responses in an unreplicated complete block design. Equivalent to
91
+ * `DescTools::CochranQTest()` in R. Takes a matrix: the Friedman test of the 0/1 matrix (with ties), reported as Q.
92
92
  *
93
93
  * @param y Blocks as rows, treatments as columns, values 0 or 1. Rows with a missing value are dropped.
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const r = cochranQTest([[1, 1, 0], [1, 0, 0], [1, 1, 1], [0, 0, 0], [1, 1, 0], [1, 0, 1]]);
98
+ * r.statistic; // 3.5
99
+ * r.pValue; // 0.17377394345044514
100
+ * ```
101
+ *
102
+ * @category Hypothesis tests
94
103
  */
95
104
  export function cochranQTest(y) {
96
105
  return { ...friedmanTest(y), method: "Cochran's Q test", statisticName: "Q" };
@@ -1,6 +1,10 @@
1
1
  import type { DataFrame } from "../models/modelFrame.js";
2
2
  import { type Alternative, type HTest, type Sample } from "./types.js";
3
- /** Options for {@link tTest}. */
3
+ /**
4
+ * Options for {@link tTest}.
5
+ *
6
+ * @category Hypothesis tests
7
+ */
4
8
  export interface TTestOptions {
5
9
  /**
6
10
  * Alternative hypothesis: `"two.sided"`, `"less"` or `"greater"`. Default `"two.sided"`.
@@ -16,7 +20,11 @@ export interface TTestOptions {
16
20
  /** Confidence level of the interval. Default `0.95`. */
17
21
  confLevel?: number;
18
22
  }
19
- /** Result of {@link tTest}. */
23
+ /**
24
+ * Result of {@link tTest}.
25
+ *
26
+ * @category Hypothesis tests
27
+ */
20
28
  export interface TTestResult extends HTest {
21
29
  /** Degrees of freedom of the t distribution (`parameterName` is `"df"`). */
22
30
  parameter: number;
@@ -56,10 +64,12 @@ export interface TTestResult extends HTest {
56
64
  * ```
57
65
  *
58
66
  * There is also a formula form, `tTest("y ~ g", data, options)` (next overload).
67
+ *
68
+ * @category Hypothesis tests
59
69
  */
60
70
  export declare function tTest(x: Sample, y?: Sample | TTestOptions, options?: TTestOptions): TTestResult;
61
71
  /**
62
- * Student's t-test from a formula and a data frame. Equivalent to R's `t.test(formula, data)`: `"y ~ g"` compares
72
+ * Student's t-test from a formula and a data frame. As R's `t.test(formula, data)`: `"y ~ g"` compares
63
73
  * the two levels of `g` (the first level is `x`; `estimateNames` and `nullValueName` name the levels, as in R),
64
74
  * `"y ~ 1"` is the one-sample test and `"Pair(a, b) ~ 1"` the paired test of `a` and `b` (the option `paired` is not
65
75
  * allowed). Only the variables of the formula count: the rows where one of them is missing are dropped.
@@ -1,6 +1,10 @@
1
1
  import type { GroupLabel } from "./groups.js";
2
2
  import type { HTest, Sample } from "./types.js";
3
- /** Result of {@link propTrendTest}: no `alternative`, as R returns none. */
3
+ /**
4
+ * Result of {@link propTrendTest}: no `alternative`, as R returns none.
5
+ *
6
+ * @category Hypothesis tests
7
+ */
4
8
  export interface PropTrendTestResult extends Omit<HTest, "alternative"> {
5
9
  /** Degrees of freedom (1). */
6
10
  parameter: number;
@@ -16,11 +20,21 @@ export interface PropTrendTestResult extends Omit<HTest, "alternative"> {
16
20
  * ```ts
17
21
  * propTrendTest([15, 10, 8, 4], [30, 30, 30, 30]).statistic; // 9.573428850537288
18
22
  * ```
23
+ *
24
+ * @category Hypothesis tests
19
25
  */
20
26
  export declare function propTrendTest(x: Sample, n: Sample, score?: Sample): PropTrendTestResult;
21
- /** Alternative of {@link jonckheereTest}. */
27
+ /**
28
+ * Alternative of {@link jonckheereTest}.
29
+ *
30
+ * @category Hypothesis tests
31
+ */
22
32
  export type JonckheereAlternative = "two.sided" | "increasing" | "decreasing";
23
- /** Options for {@link jonckheereTest}. */
33
+ /**
34
+ * Options for {@link jonckheereTest}.
35
+ *
36
+ * @category Hypothesis tests
37
+ */
24
38
  export interface JonckheereTestOptions {
25
39
  /** `"two.sided"` (default), `"increasing"` or `"decreasing"` (unambiguous abbreviations accepted). */
26
40
  alternative?: JonckheereAlternative | (string & {});
@@ -34,17 +48,22 @@ export interface JonckheereTestOptions {
34
48
  /** The order of the groups. Default: the labels sorted (numbers as numbers, strings by code point). */
35
49
  levels?: readonly GroupLabel[];
36
50
  }
37
- /** Result of {@link jonckheereTest}. */
51
+ /**
52
+ * Result of {@link jonckheereTest}.
53
+ *
54
+ * @category Hypothesis tests
55
+ */
38
56
  export interface JonckheereTestResult extends Omit<HTest, "alternative"> {
57
+ /** Alternative hypothesis: `"two.sided"`, `"increasing"` or `"decreasing"`. */
39
58
  alternative: JonckheereAlternative;
40
59
  /** The packages' warnings (normal approximation). */
41
60
  warnings: string[];
42
61
  }
43
62
  /**
44
- * Jonckheere-Terpstra test of equal distributions against ordered alternatives. Equivalent to DescTools'
45
- * `JonckheereTerpstraTest(x, g, alternative, exact)` (with `g` an ordered factor) or, with `variant: "clinfun"`, to
46
- * clinfun's `jonckheere.test(x, g, alternative)` (whose two-sided p-value is `2 min(p_increasing, p_decreasing,
47
- * 0.5)`; DescTools caps it at 1 instead of 0.5). Pairs with a missing value are dropped.
63
+ * Jonckheere-Terpstra test of equal distributions against ordered alternatives. Equivalent to
64
+ * `DescTools::JonckheereTerpstraTest()` in R. Computes `JonckheereTerpstraTest(x, g, alternative, exact)` (with `g`
65
+ * an ordered factor) or, with `variant: "clinfun"`, clinfun's `jonckheere.test(x, g, alternative)` (whose
66
+ * two-sided p-value is `2 min(p_increasing, p_decreasing, 0.5)`; DescTools caps it at 1 instead of 0.5). Pairs with a missing value are dropped.
48
67
  *
49
68
  * @param x The values.
50
69
  * @param g Group labels, parallel to `x`, in the order of the alternative.
@@ -53,5 +72,7 @@ export interface JonckheereTestResult extends Omit<HTest, "alternative"> {
53
72
  * ```ts
54
73
  * jonckheereTest([1.1, 2.0, 2.4, 3.5, 3.1, 4.6], [1, 1, 2, 2, 3, 3], { alternative: "increasing" }).statistic; // 11
55
74
  * ```
75
+ *
76
+ * @category Hypothesis tests
56
77
  */
57
78
  export declare function jonckheereTest(x: Sample, g: readonly GroupLabel[], options?: JonckheereTestOptions): JonckheereTestResult;
@@ -25,6 +25,8 @@ import { matchChoice } from "./power.js";
25
25
  * ```ts
26
26
  * propTrendTest([15, 10, 8, 4], [30, 30, 30, 30]).statistic; // 9.573428850537288
27
27
  * ```
28
+ *
29
+ * @category Hypothesis tests
28
30
  */
29
31
  export function propTrendTest(x, n, score) {
30
32
  const xs = Array.from(x);
@@ -84,10 +86,10 @@ function orderedGroups(x, g, levels) {
84
86
  return groups;
85
87
  }
86
88
  /**
87
- * Jonckheere-Terpstra test of equal distributions against ordered alternatives. Equivalent to DescTools'
88
- * `JonckheereTerpstraTest(x, g, alternative, exact)` (with `g` an ordered factor) or, with `variant: "clinfun"`, to
89
- * clinfun's `jonckheere.test(x, g, alternative)` (whose two-sided p-value is `2 min(p_increasing, p_decreasing,
90
- * 0.5)`; DescTools caps it at 1 instead of 0.5). Pairs with a missing value are dropped.
89
+ * Jonckheere-Terpstra test of equal distributions against ordered alternatives. Equivalent to
90
+ * `DescTools::JonckheereTerpstraTest()` in R. Computes `JonckheereTerpstraTest(x, g, alternative, exact)` (with `g`
91
+ * an ordered factor) or, with `variant: "clinfun"`, clinfun's `jonckheere.test(x, g, alternative)` (whose
92
+ * two-sided p-value is `2 min(p_increasing, p_decreasing, 0.5)`; DescTools caps it at 1 instead of 0.5). Pairs with a missing value are dropped.
91
93
  *
92
94
  * @param x The values.
93
95
  * @param g Group labels, parallel to `x`, in the order of the alternative.
@@ -96,6 +98,8 @@ function orderedGroups(x, g, levels) {
96
98
  * ```ts
97
99
  * jonckheereTest([1.1, 2.0, 2.4, 3.5, 3.1, 4.6], [1, 1, 2, 2, 3, 3], { alternative: "increasing" }).statistic; // 11
98
100
  * ```
101
+ *
102
+ * @category Hypothesis tests
99
103
  */
100
104
  export function jonckheereTest(x, g, options = {}) {
101
105
  const alternative = matchChoice(options.alternative, ["two.sided", "increasing", "decreasing"]);
@@ -1,11 +1,21 @@
1
1
  /**
2
2
  * Alternative hypothesis of a test, as in R. Test options also accept unambiguous
3
3
  * abbreviations (`"two"`, `"l"`, `"g"`), like R's `match.arg()`.
4
+ *
5
+ * @category Hypothesis tests
4
6
  */
5
7
  export type Alternative = "two.sided" | "less" | "greater";
6
- /** A sample: an array of numbers. */
8
+ /**
9
+ * A sample: an array of numbers.
10
+ *
11
+ * @category Hypothesis tests
12
+ */
7
13
  export type Sample = readonly number[] | Float64Array;
8
- /** Counts: an array of numbers. A contingency table is passed as an array of rows. */
14
+ /**
15
+ * Counts: an array of numbers. A contingency table is passed as an array of rows.
16
+ *
17
+ * @category Hypothesis tests
18
+ */
9
19
  export type Counts = readonly number[] | Float64Array;
10
20
  /**
11
21
  * Result of a hypothesis test: a plain object mirroring R's `htest` class.
@@ -14,6 +24,8 @@ export type Counts = readonly number[] | Float64Array;
14
24
  * number and a separate `...Name` field. `estimate` is an array only when there are two
15
25
  * estimates (for example the two means of a two-sample t-test). `conf.int`'s
16
26
  * `conf.level` attribute becomes `confLevel`.
27
+ *
28
+ * @category Hypothesis tests
17
29
  */
18
30
  export interface HTest {
19
31
  /** Description of the test, as R's `method` (e.g. `"Welch Two Sample t-test"`). */