@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
@@ -1,7 +1,11 @@
1
1
  import { type GroupLabel } from "./groups.js";
2
2
  import { type PAdjustMethod } from "./pAdjust.js";
3
3
  import { type Alternative, type Sample } from "./types.js";
4
- /** Result of the PMCMRplus tests (R's `PMCMR` objects). */
4
+ /**
5
+ * Result of the PMCMRplus tests (R's `PMCMR` objects).
6
+ *
7
+ * @category Multiple comparisons
8
+ */
5
9
  export interface PMCMRResult {
6
10
  /** Description of the test (R's `method`). */
7
11
  method: string;
@@ -22,84 +26,194 @@ export interface PMCMRResult {
22
26
  /** R's warnings. */
23
27
  warnings: string[];
24
28
  }
25
- /** Options of the all-pairs Dunn test. */
29
+ /**
30
+ * Options of the all-pairs Dunn test.
31
+ *
32
+ * @category Multiple comparisons
33
+ */
26
34
  export interface KwAllPairsDunnTestOptions {
27
35
  /** p-value adjustment (see `pAdjust`). Default `"holm"`. */
28
36
  pAdjustMethod?: PAdjustMethod | (string & {});
29
37
  }
30
- /** Options of the many-to-one tests. */
38
+ /**
39
+ * Options of the many-to-one tests.
40
+ *
41
+ * @category Multiple comparisons
42
+ */
31
43
  export interface ManyOneTestOptions {
32
44
  /** Alternative hypothesis for each group against the control. Default `"two.sided"`. */
33
45
  alternative?: Alternative | "two" | "l" | "g";
34
46
  }
35
- /** Options of the many-to-one Dunn test. */
47
+ /**
48
+ * Options of the many-to-one Dunn test.
49
+ *
50
+ * @category Multiple comparisons
51
+ */
36
52
  export interface KwManyOneDunnTestOptions extends ManyOneTestOptions {
37
53
  /** `"single-step"` (simultaneous normal probabilities, the default) or a `pAdjust` method. */
38
54
  pAdjustMethod?: "single-step" | PAdjustMethod | (string & {});
39
55
  }
40
- /** Options of Steel's many-to-one rank test (`manyOneUTest`). */
56
+ /**
57
+ * Options of Steel's many-to-one rank test (`manyOneUTest`).
58
+ *
59
+ * @category Multiple comparisons
60
+ */
41
61
  export type ManyOneUTestOptions = KwManyOneDunnTestOptions;
42
62
  /**
43
- * Dunn's all-pairs test of mean ranks with adjusted p-values. Equivalent to PMCMRplus's `kwAllPairsDunnTest()`.
63
+ * Dunn's all-pairs test of mean ranks with adjusted p-values. Equivalent to `PMCMRplus::kwAllPairsDunnTest()` in R.
44
64
  *
45
65
  * @param x Response values.
46
66
  * @param g Group labels, parallel to `x` (groups in the order of the sorted labels).
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
71
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
72
+ * kwAllPairsDunnTest(x, g).pValue; // [[0.3594249897579995, NaN], [0.02187107427460692, 0.3594249897579995]]
73
+ * ```
74
+ *
75
+ * @category Multiple comparisons
47
76
  */
48
77
  export declare function kwAllPairsDunnTest(x: Sample, g: readonly GroupLabel[], options?: KwAllPairsDunnTestOptions): PMCMRResult;
49
78
  /**
50
- * Dunn's many-to-one test of mean ranks against the control (the first group). Equivalent to PMCMRplus's
51
- * `kwManyOneDunnTest()`. With `pAdjustMethod` `"single-step"` (the default) the p-values are the exact simultaneous
52
- * normal probabilities (R approximates them by randomised integration).
79
+ * Dunn's many-to-one test of mean ranks against the control (the first group). Equivalent to
80
+ * `PMCMRplus::kwManyOneDunnTest()` in R. With `pAdjustMethod` `"single-step"` (the default) the p-values are the
81
+ * exact simultaneous normal probabilities (R approximates them by randomised integration).
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
86
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
87
+ * kwManyOneDunnTest(x, g).pValue; // [[0.30272579742071715], [0.013938744281312318]]
88
+ * ```
89
+ *
90
+ * @category Multiple comparisons
53
91
  */
54
92
  export declare function kwManyOneDunnTest(x: Sample, g: readonly GroupLabel[], options?: KwManyOneDunnTestOptions): PMCMRResult;
55
93
  /**
56
94
  * Dunnett's many-to-one test of means against the control (the first group), with the pooled variance. Equivalent to
57
- * PMCMRplus's `dunnettTest()`. The p-values are the exact multivariate t probabilities (R approximates them by
95
+ * `PMCMRplus::dunnettTest()` in R. The p-values are the exact multivariate t probabilities (R approximates them by
58
96
  * randomised integration); two-sided, as in PMCMRplus, `min(1, 2 P(max T_i >= |t|))`.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
101
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
102
+ * dunnettTest(x, g).pValue; // [[0.026103399464872296], [0.0011111316275120736]]
103
+ * ```
104
+ *
105
+ * @category Multiple comparisons
59
106
  */
60
107
  export declare function dunnettTest(x: Sample, g: readonly GroupLabel[], options?: ManyOneTestOptions): PMCMRResult;
61
108
  /**
62
109
  * Steel's many-to-one rank test in its normal approximation: the Mann-Whitney statistic of each group against the
63
110
  * control (the first group), each pair ranked on its own (midranks), standardised with the tie-corrected variance.
64
- * Equivalent to PMCMRplus's `manyOneUTest()`. The statistic is positive when the group ranks higher than the
111
+ * Equivalent to `PMCMRplus::manyOneUTest()` in R. The statistic is positive when the group ranks higher than the
65
112
  * control. With `pAdjustMethod` `"single-step"` (the default; at least three groups) the p-values are the exact
66
113
  * simultaneous normal probabilities (R approximates them by randomised integration).
67
114
  *
68
115
  * @param x Response values.
69
116
  * @param g Group labels, parallel to `x` (groups in the order of the sorted labels).
117
+ *
118
+ * @example
119
+ * ```ts
120
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
121
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
122
+ * manyOneUTest(x, g).pValue; // [[0.08993551204759488], [0.08993551204759488]]
123
+ * ```
124
+ *
125
+ * @category Multiple comparisons
70
126
  */
71
127
  export declare function manyOneUTest(x: Sample, g: readonly GroupLabel[], options?: ManyOneUTestOptions): PMCMRResult;
72
128
  /**
73
- * Dwass-Steel-Critchlow-Fligner all-pairs test of pairwise Mann-Whitney statistics. Equivalent to PMCMRplus's
74
- * `dscfAllPairsTest()`. The statistic, sqrt(2) (U - n_i n_j / 2) / sqrt(Var U) with the smaller U, is never positive.
129
+ * Dwass-Steel-Critchlow-Fligner all-pairs test of pairwise Mann-Whitney statistics. Equivalent to
130
+ * `PMCMRplus::dscfAllPairsTest()` in R. The statistic, sqrt(2) (U - n_i n_j / 2) / sqrt(Var U) with the smaller U,
131
+ * is never positive.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
136
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
137
+ * dscfAllPairsTest(x, g).pValue; // [[0.12122941216677251, NaN], [0.12122941216677251, 0.12122941216677251]]
138
+ * ```
139
+ *
140
+ * @category Multiple comparisons
75
141
  */
76
142
  export declare function dscfAllPairsTest(x: Sample, g: readonly GroupLabel[]): PMCMRResult;
77
143
  /**
78
144
  * Games-Howell all-pairs test of means with Welch's standard errors and degrees of freedom. Equivalent to
79
- * PMCMRplus's `gamesHowellTest()`.
145
+ * `PMCMRplus::gamesHowellTest()` in R.
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
150
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
151
+ * gamesHowellTest(x, g).pValue; // [[0.05271565998164183, NaN], [0.009781818487986175, 0.08494498877912128]]
152
+ * ```
153
+ *
154
+ * @category Multiple comparisons
80
155
  */
81
156
  export declare function gamesHowellTest(x: Sample, g: readonly GroupLabel[]): PMCMRResult;
82
- /** Tukey's all-pairs test of means (Tukey-Kramer for unequal sizes). Equivalent to PMCMRplus's `tukeyTest()`. */
157
+ /**
158
+ * Tukey's all-pairs test of means (Tukey-Kramer for unequal sizes). Equivalent to `PMCMRplus::tukeyTest()` in R.
159
+ *
160
+ * @example
161
+ * ```ts
162
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
163
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
164
+ * tukeyTest(x, g).pValue; // [[0.03403130149294014, NaN], [0.001492661804896774, 0.04527523376597547]]
165
+ * ```
166
+ *
167
+ * @category Multiple comparisons
168
+ */
83
169
  export declare function tukeyTest(x: Sample, g: readonly GroupLabel[]): PMCMRResult;
84
170
  /**
85
- * Steel's many-to-one rank test, as PMCMRplus 1.9.12's `steelTest()` behaves: it fails on every input, so this
86
- * reproduces its errors. A two-sided alternative is rejected (`'arg' should be one of “greater”, “less”`), unequal
87
- * group sizes give `Steel's test is only valid for balanced designs.`, and balanced data the error PMCMRplus raises
88
- * internally.
171
+ * Steel's many-to-one rank test. Equivalent to `PMCMRplus::steelTest()` in R. It behaves as `steelTest()` of
172
+ * PMCMRplus 1.9.12 does: that fails on every input, so this reproduces its errors. A two-sided
173
+ * alternative is rejected (`'arg' should be one of “greater”, “less”`), unequal group sizes give `Steel's test is
174
+ * only valid for balanced designs.`, and balanced data the error PMCMRplus raises internally.
89
175
  *
90
176
  * @throws Always.
177
+ *
178
+ * @example
179
+ * ```ts
180
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
181
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
182
+ * const message = (() => {
183
+ * try {
184
+ * steelTest(x, g, { alternative: "greater" });
185
+ * } catch (e) {
186
+ * return (e as Error).message;
187
+ * }
188
+ * })();
189
+ * message; // "'data' must be of a vector type, was 'NULL'"
190
+ * ```
191
+ *
192
+ * @category Multiple comparisons
91
193
  */
92
194
  export declare function steelTest(x: Sample, g: readonly GroupLabel[], options?: ManyOneTestOptions): never;
93
- /** Adjustment method of {@link dunnTest} (dunn.test's `method`). */
195
+ /**
196
+ * Adjustment method of {@link dunnTest} (dunn.test's `method`).
197
+ *
198
+ * @category Multiple comparisons
199
+ */
94
200
  export type DunnTestMethod = "none" | "bonferroni" | "sidak" | "holm" | "hs" | "hochberg" | "bh" | "by";
95
- /** Options of {@link dunnTest}. */
201
+ /**
202
+ * Options of {@link dunnTest}.
203
+ *
204
+ * @category Multiple comparisons
205
+ */
96
206
  export interface DunnTestOptions {
97
207
  /** Adjustment of the p-values. Default `"none"`. */
98
208
  method?: DunnTestMethod;
99
209
  /** Report two-sided p-values (twice the upper tail of |Z|) instead of one-sided ones. Default `false`. */
100
210
  altp?: boolean;
101
211
  }
102
- /** Result of {@link dunnTest} (dunn.test's list). */
212
+ /**
213
+ * Result of {@link dunnTest} (dunn.test's list).
214
+ *
215
+ * @category Multiple comparisons
216
+ */
103
217
  export interface DunnTestResult {
104
218
  /** Kruskal-Wallis chi-squared statistic (with the tie correction). */
105
219
  chi2: number;
@@ -113,17 +227,36 @@ export interface DunnTestResult {
113
227
  comparisons: string[];
114
228
  }
115
229
  /**
116
- * Dunn's test of all pairs of mean ranks. Equivalent to dunn.test's `dunn.test(x, g, method, altp)`. The step-wise
230
+ * Dunn's test of all pairs of mean ranks. Equivalent to `dunn.test::dunn.test(x, g, method, altp)` in R. The step-wise
117
231
  * adjustments multiply (or transform) each p-value by the factor of its rank and cap it at 1, without enforcing
118
232
  * monotonicity, as dunn.test does (unlike `pAdjust`).
233
+ *
234
+ * @example
235
+ * ```ts
236
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
237
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
238
+ * const r = dunnTest(x, g, { method: "bonferroni" });
239
+ * r.comparisons; // ["a - b", "a - c", "b - c"]
240
+ * r.PAdjusted; // [0.26956874231849964, 0.01093553713730346, 0.26956874231849964]
241
+ * ```
242
+ *
243
+ * @category Multiple comparisons
119
244
  */
120
245
  export declare function dunnTest(x: Sample, g: readonly GroupLabel[], options?: DunnTestOptions): DunnTestResult;
121
- /** Options of {@link glhtDunnett}. */
246
+ /**
247
+ * Options of {@link glhtDunnett}.
248
+ *
249
+ * @category Multiple comparisons
250
+ */
122
251
  export interface GlhtDunnettOptions {
123
252
  /** Alternative hypothesis for each group against the control. Default `"two.sided"`. */
124
253
  alternative?: Alternative | "two" | "l" | "g";
125
254
  }
126
- /** Result of {@link glhtDunnett}. */
255
+ /**
256
+ * Result of {@link glhtDunnett}.
257
+ *
258
+ * @category Multiple comparisons
259
+ */
127
260
  export interface GlhtDunnettResult {
128
261
  /** Labels of the contrasts, `"<level> - <level 1>"`. */
129
262
  names: string[];
@@ -139,9 +272,20 @@ export interface GlhtDunnettResult {
139
272
  df: number;
140
273
  }
141
274
  /**
142
- * Dunnett's many-to-one comparisons of a one-way ANOVA with simultaneous p-values. Equivalent to multcomp's
143
- * `summary(glht(aov(y ~ g), linfct = mcp(g = "Dunnett"), alternative))`, with the exact multivariate t probabilities
144
- * (R approximates them by randomised integration): two-sided `P(max |T_i| >= |t|)`, greater `P(max T_i >= t)`, less
145
- * `P(min T_i <= t)`.
275
+ * Dunnett's many-to-one comparisons of a one-way ANOVA with simultaneous p-values. Equivalent to
276
+ * `multcomp::glht()` in R. It gives `summary(glht(aov(y ~ g), linfct = mcp(g = "Dunnett"), alternative))`, with the
277
+ * exact multivariate t probabilities (R approximates them by randomised integration): two-sided
278
+ * `P(max |T_i| >= |t|)`, greater `P(max T_i >= t)`, less `P(min T_i <= t)`.
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
283
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
284
+ * const r = glhtDunnett(x, g);
285
+ * r.names; // ["b - a", "c - a"]
286
+ * r.p; // [0.02601829573165104, 0.0011091043143827048]
287
+ * ```
288
+ *
289
+ * @category Multiple comparisons
146
290
  */
147
291
  export declare function glhtDunnett(x: Sample, g: readonly GroupLabel[], options?: GlhtDunnettOptions): GlhtDunnettResult;
@@ -109,10 +109,19 @@ function pooled(d) {
109
109
  return { m: d.groups.map(mean), s2: ss / df, df: d.N - d.k };
110
110
  }
111
111
  /**
112
- * Dunn's all-pairs test of mean ranks with adjusted p-values. Equivalent to PMCMRplus's `kwAllPairsDunnTest()`.
112
+ * Dunn's all-pairs test of mean ranks with adjusted p-values. Equivalent to `PMCMRplus::kwAllPairsDunnTest()` in R.
113
113
  *
114
114
  * @param x Response values.
115
115
  * @param g Group labels, parallel to `x` (groups in the order of the sorted labels).
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
120
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
121
+ * kwAllPairsDunnTest(x, g).pValue; // [[0.3594249897579995, NaN], [0.02187107427460692, 0.3594249897579995]]
122
+ * ```
123
+ *
124
+ * @category Multiple comparisons
116
125
  */
117
126
  export function kwAllPairsDunnTest(x, g, options = {}) {
118
127
  const adjust = options.pAdjustMethod ?? "holm";
@@ -124,9 +133,18 @@ export function kwAllPairsDunnTest(x, g, options = {}) {
124
133
  return allPairs(d, "Dunn's all-pairs test", z, p, adjust, C !== 0 ? [TIES_WARNING] : []);
125
134
  }
126
135
  /**
127
- * Dunn's many-to-one test of mean ranks against the control (the first group). Equivalent to PMCMRplus's
128
- * `kwManyOneDunnTest()`. With `pAdjustMethod` `"single-step"` (the default) the p-values are the exact simultaneous
129
- * normal probabilities (R approximates them by randomised integration).
136
+ * Dunn's many-to-one test of mean ranks against the control (the first group). Equivalent to
137
+ * `PMCMRplus::kwManyOneDunnTest()` in R. With `pAdjustMethod` `"single-step"` (the default) the p-values are the
138
+ * exact simultaneous normal probabilities (R approximates them by randomised integration).
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
143
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
144
+ * kwManyOneDunnTest(x, g).pValue; // [[0.30272579742071715], [0.013938744281312318]]
145
+ * ```
146
+ *
147
+ * @category Multiple comparisons
130
148
  */
131
149
  export function kwManyOneDunnTest(x, g, options = {}) {
132
150
  const alternative = matchAlternative(options.alternative);
@@ -155,8 +173,17 @@ function manyOneNormalP(z, lambda, alternative, adjust) {
155
173
  }
156
174
  /**
157
175
  * Dunnett's many-to-one test of means against the control (the first group), with the pooled variance. Equivalent to
158
- * PMCMRplus's `dunnettTest()`. The p-values are the exact multivariate t probabilities (R approximates them by
176
+ * `PMCMRplus::dunnettTest()` in R. The p-values are the exact multivariate t probabilities (R approximates them by
159
177
  * randomised integration); two-sided, as in PMCMRplus, `min(1, 2 P(max T_i >= |t|))`.
178
+ *
179
+ * @example
180
+ * ```ts
181
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
182
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
183
+ * dunnettTest(x, g).pValue; // [[0.026103399464872296], [0.0011111316275120736]]
184
+ * ```
185
+ *
186
+ * @category Multiple comparisons
160
187
  */
161
188
  export function dunnettTest(x, g, options = {}) {
162
189
  const alternative = matchAlternative(options.alternative);
@@ -174,12 +201,21 @@ export function dunnettTest(x, g, options = {}) {
174
201
  /**
175
202
  * Steel's many-to-one rank test in its normal approximation: the Mann-Whitney statistic of each group against the
176
203
  * control (the first group), each pair ranked on its own (midranks), standardised with the tie-corrected variance.
177
- * Equivalent to PMCMRplus's `manyOneUTest()`. The statistic is positive when the group ranks higher than the
204
+ * Equivalent to `PMCMRplus::manyOneUTest()` in R. The statistic is positive when the group ranks higher than the
178
205
  * control. With `pAdjustMethod` `"single-step"` (the default; at least three groups) the p-values are the exact
179
206
  * simultaneous normal probabilities (R approximates them by randomised integration).
180
207
  *
181
208
  * @param x Response values.
182
209
  * @param g Group labels, parallel to `x` (groups in the order of the sorted labels).
210
+ *
211
+ * @example
212
+ * ```ts
213
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
214
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
215
+ * manyOneUTest(x, g).pValue; // [[0.08993551204759488], [0.08993551204759488]]
216
+ * ```
217
+ *
218
+ * @category Multiple comparisons
183
219
  */
184
220
  export function manyOneUTest(x, g, options = {}) {
185
221
  const alternative = matchAlternative(options.alternative);
@@ -213,8 +249,18 @@ export function manyOneUTest(x, g, options = {}) {
213
249
  return manyOne(d, "Wilcoxon, Mann, Whittney U-test\n\tfor multiple comparisons with one control", z, p, adjust);
214
250
  }
215
251
  /**
216
- * Dwass-Steel-Critchlow-Fligner all-pairs test of pairwise Mann-Whitney statistics. Equivalent to PMCMRplus's
217
- * `dscfAllPairsTest()`. The statistic, sqrt(2) (U - n_i n_j / 2) / sqrt(Var U) with the smaller U, is never positive.
252
+ * Dwass-Steel-Critchlow-Fligner all-pairs test of pairwise Mann-Whitney statistics. Equivalent to
253
+ * `PMCMRplus::dscfAllPairsTest()` in R. The statistic, sqrt(2) (U - n_i n_j / 2) / sqrt(Var U) with the smaller U,
254
+ * is never positive.
255
+ *
256
+ * @example
257
+ * ```ts
258
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
259
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
260
+ * dscfAllPairsTest(x, g).pValue; // [[0.12122941216677251, NaN], [0.12122941216677251, 0.12122941216677251]]
261
+ * ```
262
+ *
263
+ * @category Multiple comparisons
218
264
  */
219
265
  export function dscfAllPairsTest(x, g) {
220
266
  const d = layout(x, g);
@@ -240,7 +286,16 @@ export function dscfAllPairsTest(x, g) {
240
286
  }
241
287
  /**
242
288
  * Games-Howell all-pairs test of means with Welch's standard errors and degrees of freedom. Equivalent to
243
- * PMCMRplus's `gamesHowellTest()`.
289
+ * `PMCMRplus::gamesHowellTest()` in R.
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
294
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
295
+ * gamesHowellTest(x, g).pValue; // [[0.05271565998164183, NaN], [0.009781818487986175, 0.08494498877912128]]
296
+ * ```
297
+ *
298
+ * @category Multiple comparisons
244
299
  */
245
300
  export function gamesHowellTest(x, g) {
246
301
  const d = layout(x, g);
@@ -253,7 +308,18 @@ export function gamesHowellTest(x, g) {
253
308
  });
254
309
  return allPairs(d, "Games-Howell test", q, p, "none");
255
310
  }
256
- /** Tukey's all-pairs test of means (Tukey-Kramer for unequal sizes). Equivalent to PMCMRplus's `tukeyTest()`. */
311
+ /**
312
+ * Tukey's all-pairs test of means (Tukey-Kramer for unequal sizes). Equivalent to `PMCMRplus::tukeyTest()` in R.
313
+ *
314
+ * @example
315
+ * ```ts
316
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
317
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
318
+ * tukeyTest(x, g).pValue; // [[0.03403130149294014, NaN], [0.001492661804896774, 0.04527523376597547]]
319
+ * ```
320
+ *
321
+ * @category Multiple comparisons
322
+ */
257
323
  export function tukeyTest(x, g) {
258
324
  const d = layout(x, g);
259
325
  const { m, s2, df } = pooled(d);
@@ -262,12 +328,28 @@ export function tukeyTest(x, g) {
262
328
  return allPairs(d, "Tukey's test", q, p, "single-step");
263
329
  }
264
330
  /**
265
- * Steel's many-to-one rank test, as PMCMRplus 1.9.12's `steelTest()` behaves: it fails on every input, so this
266
- * reproduces its errors. A two-sided alternative is rejected (`'arg' should be one of “greater”, “less”`), unequal
267
- * group sizes give `Steel's test is only valid for balanced designs.`, and balanced data the error PMCMRplus raises
268
- * internally.
331
+ * Steel's many-to-one rank test. Equivalent to `PMCMRplus::steelTest()` in R. It behaves as `steelTest()` of
332
+ * PMCMRplus 1.9.12 does: that fails on every input, so this reproduces its errors. A two-sided
333
+ * alternative is rejected (`'arg' should be one of “greater”, “less”`), unequal group sizes give `Steel's test is
334
+ * only valid for balanced designs.`, and balanced data the error PMCMRplus raises internally.
269
335
  *
270
336
  * @throws Always.
337
+ *
338
+ * @example
339
+ * ```ts
340
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
341
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
342
+ * const message = (() => {
343
+ * try {
344
+ * steelTest(x, g, { alternative: "greater" });
345
+ * } catch (e) {
346
+ * return (e as Error).message;
347
+ * }
348
+ * })();
349
+ * message; // "'data' must be of a vector type, was 'NULL'"
350
+ * ```
351
+ *
352
+ * @category Multiple comparisons
271
353
  */
272
354
  export function steelTest(x, g, options = {}) {
273
355
  const alternative = options.alternative === undefined ? "greater" : matchAlternative(options.alternative);
@@ -279,9 +361,20 @@ export function steelTest(x, g, options = {}) {
279
361
  throw new Error("'data' must be of a vector type, was 'NULL'");
280
362
  }
281
363
  /**
282
- * Dunn's test of all pairs of mean ranks. Equivalent to dunn.test's `dunn.test(x, g, method, altp)`. The step-wise
364
+ * Dunn's test of all pairs of mean ranks. Equivalent to `dunn.test::dunn.test(x, g, method, altp)` in R. The step-wise
283
365
  * adjustments multiply (or transform) each p-value by the factor of its rank and cap it at 1, without enforcing
284
366
  * monotonicity, as dunn.test does (unlike `pAdjust`).
367
+ *
368
+ * @example
369
+ * ```ts
370
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
371
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
372
+ * const r = dunnTest(x, g, { method: "bonferroni" });
373
+ * r.comparisons; // ["a - b", "a - c", "b - c"]
374
+ * r.PAdjusted; // [0.26956874231849964, 0.01093553713730346, 0.26956874231849964]
375
+ * ```
376
+ *
377
+ * @category Multiple comparisons
285
378
  */
286
379
  export function dunnTest(x, g, options = {}) {
287
380
  const method = options.method ?? "none";
@@ -347,10 +440,21 @@ function dunnAdjust(P, method) {
347
440
  }
348
441
  }
349
442
  /**
350
- * Dunnett's many-to-one comparisons of a one-way ANOVA with simultaneous p-values. Equivalent to multcomp's
351
- * `summary(glht(aov(y ~ g), linfct = mcp(g = "Dunnett"), alternative))`, with the exact multivariate t probabilities
352
- * (R approximates them by randomised integration): two-sided `P(max |T_i| >= |t|)`, greater `P(max T_i >= t)`, less
353
- * `P(min T_i <= t)`.
443
+ * Dunnett's many-to-one comparisons of a one-way ANOVA with simultaneous p-values. Equivalent to
444
+ * `multcomp::glht()` in R. It gives `summary(glht(aov(y ~ g), linfct = mcp(g = "Dunnett"), alternative))`, with the
445
+ * exact multivariate t probabilities (R approximates them by randomised integration): two-sided
446
+ * `P(max |T_i| >= |t|)`, greater `P(max T_i >= t)`, less `P(min T_i <= t)`.
447
+ *
448
+ * @example
449
+ * ```ts
450
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
451
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
452
+ * const r = glhtDunnett(x, g);
453
+ * r.names; // ["b - a", "c - a"]
454
+ * r.p; // [0.02601829573165104, 0.0011091043143827048]
455
+ * ```
456
+ *
457
+ * @category Multiple comparisons
354
458
  */
355
459
  export function glhtDunnett(x, g, options = {}) {
356
460
  const alternative = matchAlternative(options.alternative);
@@ -1,36 +1,75 @@
1
1
  import type { HTest, Sample } from "./types.js";
2
- /** Result of a normality test: no `alternative`, as nortest returns none. */
2
+ /**
3
+ * Result of a normality test: no `alternative`, as nortest returns none.
4
+ *
5
+ * @category Hypothesis tests
6
+ */
3
7
  export type NormalityTestResult = Omit<HTest, "alternative">;
4
- /** Result of {@link cvmTest}, with nortest's warning for a p-value below the approximation's range. */
8
+ /**
9
+ * Result of {@link cvmTest}, with nortest's warning for a p-value below the approximation's range.
10
+ *
11
+ * @category Hypothesis tests
12
+ */
5
13
  export interface CvmTestResult extends NormalityTestResult {
14
+ /** Warnings, as nortest gives them (empty when there are none). */
6
15
  warnings: string[];
7
16
  }
8
17
  /**
9
- * Anderson-Darling test for normality. Equivalent to nortest's `ad.test()`. `NaN` values are dropped; at least 8
18
+ * Anderson-Darling test for normality. Equivalent to `nortest::ad.test()` in R. `NaN` values are dropped; at least 8
10
19
  * values are needed.
11
20
  *
12
21
  * @example
13
22
  * ```ts
14
23
  * adTest([2.1, 3.4, 1.9, 5.6, 4.4, 3.8, 2.9, 4.1, 3.3, 2.6]).statistic; // 0.15414195923525043
15
24
  * ```
25
+ *
26
+ * @category Hypothesis tests
16
27
  */
17
28
  export declare function adTest(x: Sample): NormalityTestResult;
18
29
  /**
19
- * Cramer-von Mises test for normality. Equivalent to nortest's `cvm.test()`. `NaN` values are dropped; at least 8
30
+ * Cramer-von Mises test for normality. Equivalent to `nortest::cvm.test()` in R. `NaN` values are dropped; at least 8
20
31
  * values are needed.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const x = [2.1, 3.4, 1.9, 5.6, 4.4, 3.3, 2.8, 4.1, 3.9, 6.2];
36
+ * cvmTest(x).pValue; // 0.8725514730213816
37
+ * ```
38
+ *
39
+ * @category Hypothesis tests
21
40
  */
22
41
  export declare function cvmTest(x: Sample): CvmTestResult;
23
42
  /**
24
- * Lilliefors (Kolmogorov-Smirnov) test for normality. Equivalent to nortest's `lillie.test()`. `NaN` values are
43
+ * Lilliefors (Kolmogorov-Smirnov) test for normality. Equivalent to `nortest::lillie.test()` in R. `NaN` values are
25
44
  * dropped; at least 5 values are needed.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const x = [2.1, 3.4, 1.9, 5.6, 4.4, 3.3, 2.8, 4.1, 3.9, 6.2];
49
+ * lillieTest(x).pValue; // 0.9287268902599117
50
+ * ```
51
+ *
52
+ * @category Hypothesis tests
26
53
  */
27
54
  export declare function lillieTest(x: Sample): NormalityTestResult;
28
55
  /**
29
- * Shapiro-Francia test for normality. Equivalent to nortest's `sf.test()`. `NaN` values are dropped; the sample size
30
- * must be between 5 and 5000.
56
+ * Shapiro-Francia test for normality. Equivalent to `nortest::sf.test()` in R. `NaN` values are dropped; the sample
57
+ * size must be between 5 and 5000.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const x = [2.1, 3.4, 1.9, 5.6, 4.4, 3.3, 2.8, 4.1, 3.9, 6.2];
62
+ * sfTest(x).pValue; // 0.8583583366365347
63
+ * ```
64
+ *
65
+ * @category Hypothesis tests
31
66
  */
32
67
  export declare function sfTest(x: Sample): NormalityTestResult;
33
- /** Options for {@link pearsonTest}. */
68
+ /**
69
+ * Options for {@link pearsonTest}.
70
+ *
71
+ * @category Hypothesis tests
72
+ */
34
73
  export interface PearsonTestOptions {
35
74
  /** Number of classes. Default `ceil(2 n^(2/5))`. */
36
75
  nClasses?: number;
@@ -39,6 +78,14 @@ export interface PearsonTestOptions {
39
78
  }
40
79
  /**
41
80
  * Pearson chi-square test for normality, with classes of equal probability under the fitted normal distribution.
42
- * Equivalent to nortest's `pearson.test()`. `NaN` values are dropped.
81
+ * Equivalent to `nortest::pearson.test()` in R. `NaN` values are dropped.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const x = [2.1, 3.4, 1.9, 5.6, 4.4, 3.3, 2.8, 4.1, 3.9, 6.2];
86
+ * pearsonTest(x).pValue; // 0.8494670333918255
87
+ * ```
88
+ *
89
+ * @category Hypothesis tests
43
90
  */
44
91
  export declare function pearsonTest(x: Sample, options?: PearsonTestOptions): NormalityTestResult;