@numero-uno-jpn/rstats 0.16.0 → 1.0.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 (243) hide show
  1. package/CHANGELOG.md +205 -0
  2. package/README.ja.md +57 -23
  3. package/README.md +60 -23
  4. package/dist/chunks/{chunk-5UQCRBAG.js → chunk-3W5NFFAA.js} +1 -1
  5. package/dist/chunks/chunk-4F2IALD4.js +3 -0
  6. package/dist/chunks/{chunk-QNNL7AZ3.js → chunk-4OLDGML4.js} +2 -2
  7. package/dist/chunks/chunk-63OPBEYO.js +2 -0
  8. package/dist/chunks/chunk-6XJBCRBV.js +2 -0
  9. package/dist/chunks/chunk-BQSIBJVX.js +2 -0
  10. package/dist/chunks/chunk-BWKHYRM6.js +3 -0
  11. package/dist/chunks/{chunk-W26LRYOJ.js → chunk-CKV4JWW2.js} +1 -1
  12. package/dist/chunks/chunk-DCAWMF4K.js +2 -0
  13. package/dist/chunks/chunk-F7YGX7PN.js +2 -0
  14. package/dist/chunks/chunk-H7I32ZZE.js +2 -0
  15. package/dist/chunks/chunk-IEOD5GWC.js +3 -0
  16. package/dist/chunks/chunk-KICBQGFN.js +2 -0
  17. package/dist/chunks/chunk-LROMWFAK.js +2 -0
  18. package/dist/chunks/chunk-NSWENS3S.js +2 -0
  19. package/dist/chunks/chunk-O2SQMGE3.js +2 -0
  20. package/dist/chunks/chunk-QQX46TCI.js +2 -0
  21. package/dist/chunks/chunk-QZK3CCBA.js +2 -0
  22. package/dist/chunks/chunk-UJ66VQIG.js +2 -0
  23. package/dist/chunks/chunk-UKNDX4BA.js +2 -0
  24. package/dist/chunks/chunk-WIBKS73G.js +2 -0
  25. package/dist/chunks/{chunk-URIO5LY5.js → chunk-WQWZ7FND.js} +2 -2
  26. package/dist/chunks/chunk-WWVMVZUL.js +2 -0
  27. package/dist/chunks/chunk-YG5S5AVP.js +2 -0
  28. package/dist/chunks/chunk-YHNMBYSW.js +2 -0
  29. package/dist/data/grouping.js +6 -2
  30. package/dist/descriptive/basic.js +20 -0
  31. package/dist/descriptive/cov.js +11 -0
  32. package/dist/descriptive/dataFrames.js +13 -5
  33. package/dist/descriptive/factanal.d.ts +2 -0
  34. package/dist/descriptive/factanal.js +10 -2
  35. package/dist/descriptive/hist.js +6 -0
  36. package/dist/descriptive/moments.js +14 -0
  37. package/dist/descriptive/omega.js +8 -3
  38. package/dist/descriptive/pivot.d.ts +4 -1
  39. package/dist/descriptive/pivot.js +27 -13
  40. package/dist/descriptive/quantile.js +8 -0
  41. package/dist/descriptive/rank.js +4 -0
  42. package/dist/descriptive/table.d.ts +20 -1
  43. package/dist/descriptive/table.js +14 -14
  44. package/dist/descriptive.js +2 -2
  45. package/dist/distributions/arcsine.js +8 -0
  46. package/dist/distributions/beta.js +9 -0
  47. package/dist/distributions/binomial.js +9 -0
  48. package/dist/distributions/cauchy.js +9 -0
  49. package/dist/distributions/chisq.js +9 -0
  50. package/dist/distributions/exponential.js +9 -0
  51. package/dist/distributions/f.js +9 -0
  52. package/dist/distributions/gamma.js +8 -0
  53. package/dist/distributions/geometric.js +9 -0
  54. package/dist/distributions/hypergeometric.js +8 -0
  55. package/dist/distributions/invgamma.js +8 -0
  56. package/dist/distributions/kumaraswamy.js +9 -0
  57. package/dist/distributions/laplace.js +9 -0
  58. package/dist/distributions/logistic.js +9 -0
  59. package/dist/distributions/lognormal.js +8 -0
  60. package/dist/distributions/multinomial.js +4 -0
  61. package/dist/distributions/negbinomial.js +8 -0
  62. package/dist/distributions/normal.js +8 -0
  63. package/dist/distributions/pareto.js +8 -0
  64. package/dist/distributions/poisson.js +9 -0
  65. package/dist/distributions/signrank.js +9 -0
  66. package/dist/distributions/summary.d.ts +2 -1
  67. package/dist/distributions/summary.js +31 -1
  68. package/dist/distributions/t.js +9 -0
  69. package/dist/distributions/triangular.js +9 -0
  70. package/dist/distributions/tukey.js +6 -0
  71. package/dist/distributions/uniform.js +8 -0
  72. package/dist/distributions/weibull.js +8 -0
  73. package/dist/distributions/wilcox.js +9 -0
  74. package/dist/distributions.js +2 -2
  75. package/dist/entries/descriptive.d.ts +3 -1
  76. package/dist/entries/descriptive.js +1 -1
  77. package/dist/entries/distributions.d.ts +1 -0
  78. package/dist/entries/distributions.js +2 -0
  79. package/dist/entries/linalg.d.ts +3 -1
  80. package/dist/entries/mixed.d.ts +9 -0
  81. package/dist/entries/mixed.js +8 -1
  82. package/dist/entries/numerics.d.ts +2 -1
  83. package/dist/entries/tests.d.ts +8 -5
  84. package/dist/entries/tests.js +3 -1
  85. package/dist/htest/agreement.d.ts +13 -0
  86. package/dist/htest/agreement.js +46 -7
  87. package/dist/htest/ansariTest.d.ts +2 -1
  88. package/dist/htest/ansariTest.js +43 -12
  89. package/dist/htest/aov.d.ts +28 -22
  90. package/dist/htest/aov.js +42 -13
  91. package/dist/htest/binomTest.js +6 -0
  92. package/dist/htest/brunnerMunzelTest.js +5 -0
  93. package/dist/htest/chisqTest.d.ts +3 -1
  94. package/dist/htest/chisqTest.js +21 -3
  95. package/dist/htest/cor.d.ts +7 -1
  96. package/dist/htest/cor.js +40 -7
  97. package/dist/htest/core/simulate.d.ts +6 -0
  98. package/dist/htest/core/simulate.js +20 -0
  99. package/dist/htest/effectSize.d.ts +3 -0
  100. package/dist/htest/effectSize.js +28 -8
  101. package/dist/htest/fisherTest.d.ts +2 -1
  102. package/dist/htest/fisherTest.js +52 -6
  103. package/dist/htest/ksTest.d.ts +4 -0
  104. package/dist/htest/ksTest.js +13 -4
  105. package/dist/htest/leveneTest.d.ts +2 -0
  106. package/dist/htest/leveneTest.js +9 -3
  107. package/dist/htest/mantelhaenTest.js +7 -0
  108. package/dist/htest/mcnemarTest.js +8 -0
  109. package/dist/htest/multipleComparisons.d.ts +16 -25
  110. package/dist/htest/multipleComparisons.js +26 -43
  111. package/dist/htest/normalityTests.js +10 -4
  112. package/dist/htest/onewayTest.js +10 -0
  113. package/dist/htest/pAdjust.js +4 -0
  114. package/dist/htest/pairwise.d.ts +2 -0
  115. package/dist/htest/pairwise.js +29 -6
  116. package/dist/htest/poissonTest.js +6 -0
  117. package/dist/htest/polycor.js +20 -10
  118. package/dist/htest/power.d.ts +4 -0
  119. package/dist/htest/power.js +16 -2
  120. package/dist/htest/propTest.d.ts +3 -0
  121. package/dist/htest/propTest.js +23 -2
  122. package/dist/htest/pwr.d.ts +38 -1
  123. package/dist/htest/pwr.js +38 -15
  124. package/dist/htest/rankTests.js +7 -1
  125. package/dist/htest/tTest.d.ts +2 -0
  126. package/dist/htest/tTest.js +9 -0
  127. package/dist/htest/testFormula.js +11 -11
  128. package/dist/htest/trendTests.d.ts +21 -1
  129. package/dist/htest/trendTests.js +13 -18
  130. package/dist/htest/types.d.ts +2 -0
  131. package/dist/htest/varTest.js +7 -0
  132. package/dist/htest/wilcoxTest.js +51 -9
  133. package/dist/internal/checkOptions.d.ts +11 -0
  134. package/dist/internal/checkOptions.js +31 -0
  135. package/dist/internal/optionalArgs.d.ts +12 -0
  136. package/dist/internal/optionalArgs.js +46 -0
  137. package/dist/internal/warnings.d.ts +66 -0
  138. package/dist/internal/warnings.js +122 -0
  139. package/dist/linalg/basic.js +7 -0
  140. package/dist/linalg/chol.js +6 -0
  141. package/dist/linalg/eigen.js +4 -0
  142. package/dist/linalg/expm.js +4 -0
  143. package/dist/linalg/kappa.js +6 -0
  144. package/dist/linalg/lu.js +5 -0
  145. package/dist/linalg/norm.js +4 -0
  146. package/dist/linalg/ops.d.ts +27 -2
  147. package/dist/linalg/ops.js +14 -13
  148. package/dist/linalg/qr.js +14 -0
  149. package/dist/linalg/solve.js +9 -0
  150. package/dist/linalg/svd.js +6 -2
  151. package/dist/linalg.js +2 -2
  152. package/dist/mixed.js +5 -4
  153. package/dist/models/anovaSequential.d.ts +16 -1
  154. package/dist/models/anovaSequential.js +50 -7
  155. package/dist/models/aovEz.js +16 -11
  156. package/dist/models/aovStrata.js +15 -4
  157. package/dist/models/carAnova.js +11 -17
  158. package/dist/models/coxph.d.ts +6 -0
  159. package/dist/models/coxph.js +21 -6
  160. package/dist/models/formula.d.ts +5 -2
  161. package/dist/models/formula.js +31 -8
  162. package/dist/models/glm.d.ts +22 -2
  163. package/dist/models/glm.js +32 -22
  164. package/dist/models/glmAnova.js +8 -3
  165. package/dist/models/glmConfint.js +6 -2
  166. package/dist/models/glmFamily.d.ts +1 -6
  167. package/dist/models/glmFamily.js +3 -22
  168. package/dist/models/glmer.d.ts +255 -0
  169. package/dist/models/glmer.js +635 -0
  170. package/dist/models/glmerAnova.d.ts +81 -0
  171. package/dist/models/glmerAnova.js +139 -0
  172. package/dist/models/glmerDeviance.d.ts +98 -0
  173. package/dist/models/glmerDeviance.js +576 -0
  174. package/dist/models/glmerFamily.d.ts +57 -0
  175. package/dist/models/glmerFamily.js +236 -0
  176. package/dist/models/glmerGradient.d.ts +46 -0
  177. package/dist/models/glmerGradient.js +301 -0
  178. package/dist/models/glmerStructure.d.ts +45 -0
  179. package/dist/models/glmerStructure.js +168 -0
  180. package/dist/models/glmerSummary.d.ts +102 -0
  181. package/dist/models/glmerSummary.js +94 -0
  182. package/dist/models/lm.js +13 -3
  183. package/dist/models/lmer.d.ts +27 -6
  184. package/dist/models/lmer.js +75 -321
  185. package/dist/models/lmerAnova.d.ts +52 -3
  186. package/dist/models/lmerAnova.js +101 -45
  187. package/dist/models/lmerTest.d.ts +12 -5
  188. package/dist/models/lmerTest.js +39 -18
  189. package/dist/models/mauchly.d.ts +2 -0
  190. package/dist/models/mauchly.js +7 -2
  191. package/dist/models/mixedDeviance.d.ts +28 -2
  192. package/dist/models/mixedDeviance.js +84 -56
  193. package/dist/models/mixedMinimiser.d.ts +83 -0
  194. package/dist/models/mixedMinimiser.js +438 -0
  195. package/dist/models/mixedPredict.d.ts +121 -0
  196. package/dist/models/mixedPredict.js +530 -0
  197. package/dist/models/mixedStructure.d.ts +62 -3
  198. package/dist/models/mixedStructure.js +74 -29
  199. package/dist/models/modelFrame.js +2 -2
  200. package/dist/models/modelMatrix.d.ts +8 -1
  201. package/dist/models/modelMatrix.js +56 -39
  202. package/dist/models/survival.d.ts +6 -0
  203. package/dist/models/survival.js +9 -2
  204. package/dist/numerics/deriv.js +8 -0
  205. package/dist/numerics/integrate.js +8 -0
  206. package/dist/numerics/interp.d.ts +32 -7
  207. package/dist/numerics/interp.js +27 -9
  208. package/dist/numerics/ode.js +4 -0
  209. package/dist/numerics.js +2 -2
  210. package/dist/optim/optim.js +17 -2
  211. package/dist/random/beta.js +5 -0
  212. package/dist/random/continuous.js +17 -0
  213. package/dist/random/extra.js +13 -0
  214. package/dist/random/gamma.js +11 -0
  215. package/dist/random/poisson.js +5 -0
  216. package/dist/random/rng.js +4 -0
  217. package/dist/random/sample.js +6 -0
  218. package/dist/rstats.js +17 -14
  219. package/dist/special/besselIK.js +7 -0
  220. package/dist/special/choose.js +7 -0
  221. package/dist/special/psigamma.js +7 -0
  222. package/dist/special.js +2 -2
  223. package/dist/tests.js +14 -11
  224. package/llms.txt +15 -4
  225. package/package.json +19 -10
  226. package/dist/chunks/chunk-2D2IQWUQ.js +0 -2
  227. package/dist/chunks/chunk-6CSTWA5E.js +0 -2
  228. package/dist/chunks/chunk-72Y3HZID.js +0 -2
  229. package/dist/chunks/chunk-BG2KLEHM.js +0 -2
  230. package/dist/chunks/chunk-CMEKBNHQ.js +0 -2
  231. package/dist/chunks/chunk-FLJNSXSW.js +0 -2
  232. package/dist/chunks/chunk-GM53LWSR.js +0 -2
  233. package/dist/chunks/chunk-JBCA56ZS.js +0 -3
  234. package/dist/chunks/chunk-K3RJAD2T.js +0 -2
  235. package/dist/chunks/chunk-KAZRWIB5.js +0 -2
  236. package/dist/chunks/chunk-KBVVIMXX.js +0 -3
  237. package/dist/chunks/chunk-N3SIFCZX.js +0 -2
  238. package/dist/chunks/chunk-SC6CV4Z3.js +0 -2
  239. package/dist/chunks/chunk-SYWOBOTR.js +0 -2
  240. package/dist/chunks/chunk-VTUGG2SV.js +0 -2
  241. package/dist/chunks/chunk-XHETEYVC.js +0 -2
  242. package/dist/chunks/chunk-YRZWONZB.js +0 -3
  243. package/dist/chunks/chunk-ZGABZMWX.js +0 -2
@@ -10,6 +10,12 @@ import { dpoisRaw } from "../special/loader.js";
10
10
  import { logAddExp, logSubExp } from "../internal/ddexp.js";
11
11
  import { qnorm } from "./normal.js";
12
12
  import { countAtMost, nonInt } from "../internal/integer.js";
13
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
14
+ import { checkOptions } from "../internal/checkOptions.js";
15
+ const DPOIS_KEYS = ["log"];
16
+ const PPOIS_KEYS = ["lowerTail", "logP"];
17
+ const QPOIS_KEYS = ["lowerTail", "logP"];
18
+ // Generated by `node scripts/option-keys.mjs --write` (end)
13
19
  /** Whether x is not an integer (relative tolerance 1e-9 as in R; see src/internal/integer.ts) */
14
20
  export const nonInteger = nonInt;
15
21
  export function dpois1(x, lambda, log) {
@@ -102,6 +108,7 @@ export function qpois1(p, lambda, lowerTail, logP) {
102
108
  * @category Distributions
103
109
  */
104
110
  export function dpois(x, lambda, options = {}) {
111
+ checkOptions(options, DPOIS_KEYS, "dpois"); // generated: option-keys.mjs
105
112
  const log = options.log ?? false;
106
113
  return vectorize(x, (v) => dpois1(v, lambda, log));
107
114
  }
@@ -122,6 +129,7 @@ export function dpois(x, lambda, options = {}) {
122
129
  * @category Distributions
123
130
  */
124
131
  export function ppois(q, lambda, options = {}) {
132
+ checkOptions(options, PPOIS_KEYS, "ppois"); // generated: option-keys.mjs
125
133
  const { lowerTail = true, logP = false } = options;
126
134
  return vectorize(q, (v) => ppois1(v, lambda, lowerTail, logP));
127
135
  }
@@ -142,6 +150,7 @@ export function ppois(q, lambda, options = {}) {
142
150
  * @category Distributions
143
151
  */
144
152
  export function qpois(p, lambda, options = {}) {
153
+ checkOptions(options, QPOIS_KEYS, "qpois"); // generated: option-keys.mjs
145
154
  const { lowerTail = true, logP = false } = options;
146
155
  return vectorize(p, (v) => qpois1(v, lambda, lowerTail, logP));
147
156
  }
@@ -10,6 +10,12 @@ import { d0, dt0, dt1, quantileBoundaries } from "../internal/dpq.js";
10
10
  import { discreteQuantile } from "../internal/discrete.js";
11
11
  import { countAtMost, nonInt, roundHalfEven } from "../internal/integer.js";
12
12
  import { qnorm } from "./normal.js";
13
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
14
+ import { checkOptions } from "../internal/checkOptions.js";
15
+ const DSIGNRANK_KEYS = ["log"];
16
+ const PSIGNRANK_KEYS = ["lowerTail", "logP"];
17
+ const QSIGNRANK_KEYS = ["lowerTail", "logP"];
18
+ // Generated by `node scripts/option-keys.mjs --write` (end)
13
19
  /** Threshold at which counts are multiplied by 2^-SCALE_STEP to keep them from growing too large */
14
20
  const SCALE_LIMIT = 2 ** 900;
15
21
  const SCALE_STEP = -900;
@@ -247,6 +253,7 @@ export function qsignrank1(p, n, lowerTail, logP) {
247
253
  * @category Distributions
248
254
  */
249
255
  export function dsignrank(x, n, options = {}) {
256
+ checkOptions(options, DSIGNRANK_KEYS, "dsignrank"); // generated: option-keys.mjs
250
257
  const log = options.log ?? false;
251
258
  return vectorize(x, (v) => dsignrank1(v, n, log));
252
259
  }
@@ -269,6 +276,7 @@ export function dsignrank(x, n, options = {}) {
269
276
  * @category Distributions
270
277
  */
271
278
  export function psignrank(q, n, options = {}) {
279
+ checkOptions(options, PSIGNRANK_KEYS, "psignrank"); // generated: option-keys.mjs
272
280
  const { lowerTail = true, logP = false } = options;
273
281
  return vectorize(q, (v) => psignrank1(v, n, lowerTail, logP));
274
282
  }
@@ -291,6 +299,7 @@ export function psignrank(q, n, options = {}) {
291
299
  * @category Distributions
292
300
  */
293
301
  export function qsignrank(p, n, options = {}) {
302
+ checkOptions(options, QSIGNRANK_KEYS, "qsignrank"); // generated: option-keys.mjs
294
303
  const { lowerTail = true, logP = false } = options;
295
304
  return vectorize(p, (v) => qsignrank1(v, n, lowerTail, logP));
296
305
  }
@@ -28,7 +28,8 @@ export type DistName = "norm" | "lnorm" | "unif" | "exp" | "gamma" | "chisq" | "
28
28
  /**
29
29
  * Mean, variance, standard deviation, median, mode, skewness and excess kurtosis of a distribution, given by the
30
30
  * name of its d/p/q/r functions and their parameters (with the same names and defaults; `gamma` takes `rate` or
31
- * `scale`, `nbinom` takes `prob` or `mu`). Invalid parameters give NaN throughout.
31
+ * `scale`, `nbinom` takes `prob` or `mu`). Invalid parameters give NaN throughout. The distributions are the central
32
+ * ones: `ncp` of `chisq`, `beta`, `t` and `f` is not taken (an unknown key, a RangeError).
32
33
  * Not an R function. R has no function for these summaries; the R references are closed forms checked against
33
34
  * numerical moments.
34
35
  *
@@ -28,6 +28,33 @@ import { qtriang } from "./triangular.js";
28
28
  import { ldexp } from "../internal/summary.js";
29
29
  import { midpoint } from "../internal/extremes.js";
30
30
  import { splitDouble } from "../linalg/dot.js";
31
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
32
+ import { checkOptions } from "../internal/checkOptions.js";
33
+ const DIST_SUMMARY_KEYS = {
34
+ arcsine: ["a", "b"],
35
+ beta: ["shape1", "shape2"],
36
+ binom: ["size", "prob"],
37
+ cauchy: ["location", "scale"],
38
+ chisq: ["df"],
39
+ exp: ["rate"],
40
+ f: ["df1", "df2"],
41
+ gamma: ["shape", "rate", "scale"],
42
+ geom: ["prob"],
43
+ hyper: ["m", "n", "k"],
44
+ invgamma: ["alpha", "beta"],
45
+ kumar: ["a", "b"],
46
+ laplace: ["mu", "sigma"],
47
+ lnorm: ["meanlog", "sdlog"],
48
+ logis: ["location", "scale"],
49
+ nbinom: ["size", "prob", "mu"],
50
+ norm: ["mean", "sd"],
51
+ pareto: ["a", "b"],
52
+ pois: ["lambda"],
53
+ t: ["df"],
54
+ triang: ["a", "b", "c"],
55
+ unif: ["min", "max"],
56
+ weibull: ["shape", "scale"],
57
+ };
31
58
  const NAN = { mean: NaN, variance: NaN, sd: NaN, median: NaN, mode: NaN, skewness: NaN, kurtosis: NaN };
32
59
  /** A point mass at 0: no skewness or kurtosis */
33
60
  const POINT_AT_0 = { mean: 0, variance: 0, sd: 0, median: 0, mode: 0, skewness: NaN, kurtosis: NaN };
@@ -194,7 +221,8 @@ function betaVariance(a, b, s) {
194
221
  /**
195
222
  * Mean, variance, standard deviation, median, mode, skewness and excess kurtosis of a distribution, given by the
196
223
  * name of its d/p/q/r functions and their parameters (with the same names and defaults; `gamma` takes `rate` or
197
- * `scale`, `nbinom` takes `prob` or `mu`). Invalid parameters give NaN throughout.
224
+ * `scale`, `nbinom` takes `prob` or `mu`). Invalid parameters give NaN throughout. The distributions are the central
225
+ * ones: `ncp` of `chisq`, `beta`, `t` and `f` is not taken (an unknown key, a RangeError).
198
226
  * Not an R function. R has no function for these summaries; the R references are closed forms checked against
199
227
  * numerical moments.
200
228
  *
@@ -207,6 +235,8 @@ function betaVariance(a, b, s) {
207
235
  * @category Distributions
208
236
  */
209
237
  export function distSummary(distribution, params = {}) {
238
+ if (Object.hasOwn(DIST_SUMMARY_KEYS, distribution))
239
+ checkOptions(params, DIST_SUMMARY_KEYS[distribution] ?? [], "distSummary"); // generated: option-keys.mjs
210
240
  const P = params;
211
241
  switch (distribution) {
212
242
  case "norm": {
@@ -16,6 +16,12 @@ import { betaIncBothDD, betaIncDD } from "../special/incbet.js";
16
16
  import { bd0, bd0dd, stirlerr } from "../special/loader.js";
17
17
  import { dnorm, pnorm, qnorm } from "./normal.js";
18
18
  import { HUGE_DF, dnt1, hugeDfRatio, hugeDfTail, hugeDfTailLog, hugeDfTailQuantile, pnt1, qnt1 } from "./nt.js";
19
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
20
+ import { checkOptions } from "../internal/checkOptions.js";
21
+ const DT_KEYS = ["log", "ncp"];
22
+ const PT_KEYS = ["lowerTail", "logP", "ncp"];
23
+ const QT_KEYS = ["lowerTail", "logP", "ncp"];
24
+ // Generated by `node scripts/option-keys.mjs --write` (end)
19
25
  const LN_SQRT_2PI = 0.918938533204672741780329736406;
20
26
  /** -log(sqrt(2 pi)) in double-double (computed with Rmpfr) */
21
27
  const LN_SQRT_2PI_DD_NEG = [-0.91893853320467278, 3.8782941580672414e-17];
@@ -288,6 +294,7 @@ export function qt1(p, df, lowerTail, logP) {
288
294
  * @category Distributions
289
295
  */
290
296
  export function dt(x, df, options = {}) {
297
+ checkOptions(options, DT_KEYS, "dt"); // generated: option-keys.mjs
291
298
  const { log = false, ncp } = options;
292
299
  if (ncp !== undefined && ncp !== 0)
293
300
  return vectorize(x, (v) => dnt1(v, df, ncp, log));
@@ -312,6 +319,7 @@ export function dt(x, df, options = {}) {
312
319
  * @category Distributions
313
320
  */
314
321
  export function pt(q, df, options = {}) {
322
+ checkOptions(options, PT_KEYS, "pt"); // generated: option-keys.mjs
315
323
  const { lowerTail = true, logP = false, ncp } = options;
316
324
  if (ncp !== undefined && ncp !== 0)
317
325
  return vectorize(q, (v) => pnt1(v, df, ncp, lowerTail, logP));
@@ -336,6 +344,7 @@ export function pt(q, df, options = {}) {
336
344
  * @category Distributions
337
345
  */
338
346
  export function qt(p, df, options = {}) {
347
+ checkOptions(options, QT_KEYS, "qt"); // generated: option-keys.mjs
339
348
  const { lowerTail = true, logP = false, ncp } = options;
340
349
  if (ncp !== undefined && ncp !== 0)
341
350
  return vectorize(p, (v) => qnt1(v, df, ncp, lowerTail, logP));
@@ -8,6 +8,12 @@
8
8
  import { vectorize } from "../internal/vectorize.js";
9
9
  import { d0, dt0, dt1, quantileBoundaries } from "../internal/dpq.js";
10
10
  import { midpoint } from "../internal/extremes.js";
11
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
12
+ import { checkOptions } from "../internal/checkOptions.js";
13
+ const DTRIANG_KEYS = ["a", "b", "c", "log"];
14
+ const PTRIANG_KEYS = ["a", "b", "c", "lowerTail", "logP"];
15
+ const QTRIANG_KEYS = ["a", "b", "c", "lowerTail", "logP"];
16
+ // Generated by `node scripts/option-keys.mjs --write` (end)
11
17
  const MIN_NORMAL = 2 ** -1022;
12
18
  const valid = (a, b, c) => Number.isFinite(a) && Number.isFinite(b) && a < b && a <= c && c <= b;
13
19
  /** 1/2 when b - a overflows (x, a, b and c are all halved then; the probabilities do not change), else 1 */
@@ -148,6 +154,7 @@ export function qtriang1(p, a, b, c, lowerTail, logP) {
148
154
  * @category Distributions
149
155
  */
150
156
  export function dtriang(x, options = {}) {
157
+ checkOptions(options, DTRIANG_KEYS, "dtriang"); // generated: option-keys.mjs
151
158
  const { a = -1, b = 1, log = false } = options;
152
159
  const c = options.c ?? midpoint(a, b);
153
160
  return vectorize(x, (v) => dtriang1(v, a, b, c, log));
@@ -164,6 +171,7 @@ export function dtriang(x, options = {}) {
164
171
  * @category Distributions
165
172
  */
166
173
  export function ptriang(q, options = {}) {
174
+ checkOptions(options, PTRIANG_KEYS, "ptriang"); // generated: option-keys.mjs
167
175
  const { a = -1, b = 1, lowerTail = true, logP = false } = options;
168
176
  const c = options.c ?? midpoint(a, b);
169
177
  return vectorize(q, (v) => ptriang1(v, a, b, c, lowerTail, logP));
@@ -180,6 +188,7 @@ export function ptriang(q, options = {}) {
180
188
  * @category Distributions
181
189
  */
182
190
  export function qtriang(p, options = {}) {
191
+ checkOptions(options, QTRIANG_KEYS, "qtriang"); // generated: option-keys.mjs
183
192
  const { a = -1, b = 1, lowerTail = true, logP = false } = options;
184
193
  const c = options.c ?? midpoint(a, b);
185
194
  return vectorize(p, (v) => qtriang1(v, a, b, c, lowerTail, logP));
@@ -23,6 +23,10 @@ import { vectorize } from "../internal/vectorize.js";
23
23
  import { dt0, dt1, quantileBoundaries, smallerTail } from "../internal/dpq.js";
24
24
  import { stirlerr } from "../special/loader.js";
25
25
  import { pnorm } from "./normal.js";
26
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
27
+ import { checkOptions } from "../internal/checkOptions.js";
28
+ const PTUKEY_KEYS = ["nranges", "lowerTail", "logP"];
29
+ const QTUKEY_KEYS = ["nranges", "lowerTail", "logP"];
26
30
  // ---- Clenshaw-Curtis rule (convergence judged from the Chebyshev coefficients) ----
27
31
  //
28
32
  // Evaluate f on [a, b] at the Chebyshev points x_j = cos(jπ/N) (j = 0..N), compute the Chebyshev
@@ -1030,6 +1034,7 @@ function brent(f, a, b, fa, fb) {
1030
1034
  * @category Distributions
1031
1035
  */
1032
1036
  export function ptukey(q, nmeans, df, options = {}) {
1037
+ checkOptions(options, PTUKEY_KEYS, "ptukey"); // generated: option-keys.mjs
1033
1038
  const { nranges = 1, lowerTail = true, logP = false } = options;
1034
1039
  return vectorize(q, (v) => ptukey1(v, nmeans, df, nranges, lowerTail, logP));
1035
1040
  }
@@ -1053,6 +1058,7 @@ export function ptukey(q, nmeans, df, options = {}) {
1053
1058
  * @category Distributions
1054
1059
  */
1055
1060
  export function qtukey(p, nmeans, df, options = {}) {
1061
+ checkOptions(options, QTUKEY_KEYS, "qtukey"); // generated: option-keys.mjs
1056
1062
  const { nranges = 1, lowerTail = true, logP = false } = options;
1057
1063
  return vectorize(p, (v) => qtukey1(v, nmeans, df, nranges, lowerTail, logP));
1058
1064
  }
@@ -3,6 +3,11 @@
3
3
  // Formulas follow the definition. Argument handling (min = max, infinite ends, out of range) is matched to R's output.
4
4
  import { vectorize } from "../internal/vectorize.js";
5
5
  import { d0, dt0, dt1, quantileBoundaries } from "../internal/dpq.js";
6
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
7
+ import { checkOptions } from "../internal/checkOptions.js";
8
+ const DUNIF_KEYS = ["min", "max", "log"];
9
+ const PUNIF_KEYS = ["min", "max", "lowerTail", "logP"];
10
+ const QUNIF_KEYS = ["min", "max", "lowerTail", "logP"];
6
11
  /** When max - min overflows (e.g. min = -1e308, max = 1e308), both ends are halved before computing. This is that factor */
7
12
  function halfIfOverflow(min, max) {
8
13
  return Number.isFinite(max - min) ? 1 : 0.5;
@@ -76,6 +81,7 @@ export function qunif1(p, min, max, lowerTail, logP) {
76
81
  * @category Distributions
77
82
  */
78
83
  export function dunif(x, options = {}) {
84
+ checkOptions(options, DUNIF_KEYS, "dunif"); // generated: option-keys.mjs
79
85
  const { min = 0, max = 1, log = false } = options;
80
86
  return vectorize(x, (v) => dunif1(v, min, max, log));
81
87
  }
@@ -95,6 +101,7 @@ export function dunif(x, options = {}) {
95
101
  * @category Distributions
96
102
  */
97
103
  export function punif(q, options = {}) {
104
+ checkOptions(options, PUNIF_KEYS, "punif"); // generated: option-keys.mjs
98
105
  const { min = 0, max = 1, lowerTail = true, logP = false } = options;
99
106
  return vectorize(q, (v) => punif1(v, min, max, lowerTail, logP));
100
107
  }
@@ -114,6 +121,7 @@ export function punif(q, options = {}) {
114
121
  * @category Distributions
115
122
  */
116
123
  export function qunif(p, options = {}) {
124
+ checkOptions(options, QUNIF_KEYS, "qunif"); // generated: option-keys.mjs
117
125
  const { min = 0, max = 1, lowerTail = true, logP = false } = options;
118
126
  return vectorize(p, (v) => qunif1(v, min, max, lowerTail, logP));
119
127
  }
@@ -9,6 +9,11 @@ import { vectorize } from "../internal/vectorize.js";
9
9
  import { d0, dt0, quantileBoundaries } from "../internal/dpq.js";
10
10
  import { ddExp, expNeg, expNegOver, log1mExp, logOneMinusExpNeg, standardizeDD } from "../internal/ddexp.js";
11
11
  import { ddDivNum, ddLog, ddMulNum, ddSub } from "../special/dd.js";
12
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
13
+ import { checkOptions } from "../internal/checkOptions.js";
14
+ const DWEIBULL_KEYS = ["scale", "log"];
15
+ const PWEIBULL_KEYS = ["scale", "lowerTail", "logP"];
16
+ const QWEIBULL_KEYS = ["scale", "lowerTail", "logP"];
12
17
  /** 1^y = 1, as with C's pow (JS Math.pow(1, Infinity) is NaN) */
13
18
  function cpow(a, b) {
14
19
  return a === 1 ? 1 : Math.pow(a, b);
@@ -169,6 +174,7 @@ export function qweibull1(p, shape, scale, lowerTail, logP) {
169
174
  * @category Distributions
170
175
  */
171
176
  export function dweibull(x, shape, options = {}) {
177
+ checkOptions(options, DWEIBULL_KEYS, "dweibull"); // generated: option-keys.mjs
172
178
  const { scale = 1, log = false } = options;
173
179
  return vectorize(x, (v) => dweibull1(v, shape, scale, log));
174
180
  }
@@ -189,6 +195,7 @@ export function dweibull(x, shape, options = {}) {
189
195
  * @category Distributions
190
196
  */
191
197
  export function pweibull(q, shape, options = {}) {
198
+ checkOptions(options, PWEIBULL_KEYS, "pweibull"); // generated: option-keys.mjs
192
199
  const { scale = 1, lowerTail = true, logP = false } = options;
193
200
  return vectorize(q, (v) => pweibull1(v, shape, scale, lowerTail, logP));
194
201
  }
@@ -209,6 +216,7 @@ export function pweibull(q, shape, options = {}) {
209
216
  * @category Distributions
210
217
  */
211
218
  export function qweibull(p, shape, options = {}) {
219
+ checkOptions(options, QWEIBULL_KEYS, "qweibull"); // generated: option-keys.mjs
212
220
  const { scale = 1, lowerTail = true, logP = false } = options;
213
221
  return vectorize(p, (v) => qweibull1(v, shape, scale, lowerTail, logP));
214
222
  }
@@ -30,6 +30,12 @@ import { d0, dt0, dt1, quantileBoundaries } from "../internal/dpq.js";
30
30
  import { discreteQuantile } from "../internal/discrete.js";
31
31
  import { countAtMost, nonInt, roundHalfEven } from "../internal/integer.js";
32
32
  import { qnorm } from "./normal.js";
33
+ // Generated by `node scripts/option-keys.mjs --write` from the option types; do not edit (begin)
34
+ import { checkOptions } from "../internal/checkOptions.js";
35
+ const DWILCOX_KEYS = ["log"];
36
+ const PWILCOX_KEYS = ["lowerTail", "logP"];
37
+ const QWILCOX_KEYS = ["lowerTail", "logP"];
38
+ // Generated by `node scripts/option-keys.mjs --write` (end)
33
39
  /** Scale 2^STORE_SCALE applied to the coefficients (small enough that the 2^27 factor of Veltkamp splitting does not overflow) */
34
40
  const STORE_SCALE = 960;
35
41
  /** Largest table entry the passes can take (2^27 + 1 times it, in Veltkamp splitting, must not overflow) */
@@ -364,6 +370,7 @@ export function qwilcox1(p, m, n, lowerTail, logP) {
364
370
  * @category Distributions
365
371
  */
366
372
  export function dwilcox(x, m, n, options = {}) {
373
+ checkOptions(options, DWILCOX_KEYS, "dwilcox"); // generated: option-keys.mjs
367
374
  const log = options.log ?? false;
368
375
  return vectorize(x, (v) => dwilcox1(v, m, n, log));
369
376
  }
@@ -391,6 +398,7 @@ export function dwilcox(x, m, n, options = {}) {
391
398
  * @category Distributions
392
399
  */
393
400
  export function pwilcox(q, m, n, options = {}) {
401
+ checkOptions(options, PWILCOX_KEYS, "pwilcox"); // generated: option-keys.mjs
394
402
  const { lowerTail = true, logP = false } = options;
395
403
  return vectorize(q, (v) => pwilcox1(v, m, n, lowerTail, logP));
396
404
  }
@@ -418,6 +426,7 @@ export function pwilcox(q, m, n, options = {}) {
418
426
  * @category Distributions
419
427
  */
420
428
  export function qwilcox(p, m, n, options = {}) {
429
+ checkOptions(options, QWILCOX_KEYS, "qwilcox"); // generated: option-keys.mjs
421
430
  const { lowerTail = true, logP = false } = options;
422
431
  return vectorize(p, (v) => qwilcox1(v, m, n, lowerTail, logP));
423
432
  }