@numero-uno-jpn/rstats 0.11.0 → 0.12.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 (289) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.ja.md +44 -13
  3. package/README.md +43 -11
  4. package/dist/chunks/{chunk-VJ4BDBMU.js → chunk-3VMBBQLV.js} +2 -2
  5. package/dist/chunks/chunk-4OKAZJJG.js +3 -0
  6. package/dist/chunks/{chunk-EZAFN5CD.js → chunk-6BH65HGN.js} +1 -1
  7. package/dist/chunks/chunk-ATC4F4BX.js +2 -0
  8. package/dist/chunks/{chunk-JWBO5WVN.js → chunk-EDH53DXN.js} +2 -2
  9. package/dist/chunks/{chunk-Y5CNQ266.js → chunk-EZ2KD5NA.js} +2 -2
  10. package/dist/chunks/{chunk-Y5PYRAYP.js → chunk-GSPOO2G3.js} +2 -2
  11. package/dist/chunks/{chunk-F5EDJFEO.js → chunk-K7AZ65H7.js} +2 -2
  12. package/dist/chunks/{chunk-YSWGDOWK.js → chunk-LEIH4U5X.js} +2 -2
  13. package/dist/chunks/{chunk-EZWBRCJL.js → chunk-OX3SBG5X.js} +1 -1
  14. package/dist/chunks/chunk-SGZQDJRR.js +2 -0
  15. package/dist/chunks/{chunk-C5XTWMGB.js → chunk-UH2N3ZQW.js} +1 -1
  16. package/dist/chunks/chunk-UV2MZYDQ.js +2 -0
  17. package/dist/chunks/{chunk-TOGXTCZO.js → chunk-VQHEOBTM.js} +2 -2
  18. package/dist/chunks/chunk-WJQZZYOI.js +2 -0
  19. package/dist/chunks/chunk-WKEFHOFR.js +2 -0
  20. package/dist/chunks/{chunk-CGBNKHNZ.js → chunk-WXC25OPJ.js} +2 -2
  21. package/dist/chunks/{chunk-5WDJPHYY.js → chunk-XJQKSR52.js} +1 -1
  22. package/dist/data/grouping.d.ts +39 -15
  23. package/dist/data/grouping.js +21 -22
  24. package/dist/descriptive/basic.d.ts +130 -17
  25. package/dist/descriptive/basic.js +115 -14
  26. package/dist/descriptive/cov.d.ts +22 -12
  27. package/dist/descriptive/dataFrames.d.ts +39 -11
  28. package/dist/descriptive/dataFrames.js +14 -6
  29. package/dist/descriptive/factanal.d.ts +26 -6
  30. package/dist/descriptive/factanal.js +7 -3
  31. package/dist/descriptive/hist.d.ts +27 -6
  32. package/dist/descriptive/hist.js +9 -3
  33. package/dist/descriptive/missing.d.ts +13 -6
  34. package/dist/descriptive/missing.js +4 -2
  35. package/dist/descriptive/moments.d.ts +91 -13
  36. package/dist/descriptive/moments.js +66 -9
  37. package/dist/descriptive/omega.d.ts +28 -6
  38. package/dist/descriptive/omega.js +16 -4
  39. package/dist/descriptive/pivot.d.ts +22 -6
  40. package/dist/descriptive/pivot.js +7 -3
  41. package/dist/descriptive/quantile.d.ts +33 -5
  42. package/dist/descriptive/quantile.js +20 -2
  43. package/dist/descriptive/rank.d.ts +12 -2
  44. package/dist/descriptive/rank.js +2 -0
  45. package/dist/descriptive/table.d.ts +55 -7
  46. package/dist/descriptive/table.js +38 -4
  47. package/dist/descriptive.js +2 -2
  48. package/dist/distributions/arcsine.d.ts +40 -5
  49. package/dist/distributions/arcsine.js +35 -4
  50. package/dist/distributions/beta.d.ts +12 -0
  51. package/dist/distributions/beta.js +12 -0
  52. package/dist/distributions/binomial.d.ts +18 -0
  53. package/dist/distributions/binomial.js +18 -0
  54. package/dist/distributions/bvnorm.d.ts +4 -1
  55. package/dist/distributions/bvnorm.js +4 -1
  56. package/dist/distributions/cauchy.d.ts +24 -0
  57. package/dist/distributions/cauchy.js +24 -0
  58. package/dist/distributions/chisq.d.ts +18 -0
  59. package/dist/distributions/chisq.js +18 -0
  60. package/dist/distributions/exponential.d.ts +29 -1
  61. package/dist/distributions/exponential.js +24 -0
  62. package/dist/distributions/f.d.ts +18 -0
  63. package/dist/distributions/f.js +18 -0
  64. package/dist/distributions/gamma.d.ts +20 -0
  65. package/dist/distributions/gamma.js +18 -0
  66. package/dist/distributions/geometric.d.ts +24 -0
  67. package/dist/distributions/geometric.js +24 -0
  68. package/dist/distributions/hypergeometric.d.ts +24 -0
  69. package/dist/distributions/hypergeometric.js +24 -0
  70. package/dist/distributions/invgamma.d.ts +32 -4
  71. package/dist/distributions/invgamma.js +27 -3
  72. package/dist/distributions/kumaraswamy.d.ts +31 -3
  73. package/dist/distributions/kumaraswamy.js +31 -3
  74. package/dist/distributions/laplace.d.ts +36 -4
  75. package/dist/distributions/laplace.js +31 -3
  76. package/dist/distributions/logistic.d.ts +29 -1
  77. package/dist/distributions/logistic.js +24 -0
  78. package/dist/distributions/lognormal.d.ts +29 -1
  79. package/dist/distributions/lognormal.js +24 -0
  80. package/dist/distributions/multinomial.d.ts +7 -1
  81. package/dist/distributions/multinomial.js +2 -0
  82. package/dist/distributions/negbinomial.d.ts +29 -1
  83. package/dist/distributions/negbinomial.js +24 -0
  84. package/dist/distributions/normal.d.ts +11 -1
  85. package/dist/distributions/normal.js +6 -0
  86. package/dist/distributions/pareto.d.ts +36 -4
  87. package/dist/distributions/pareto.js +31 -3
  88. package/dist/distributions/poisson.d.ts +18 -0
  89. package/dist/distributions/poisson.js +18 -0
  90. package/dist/distributions/signrank.d.ts +24 -0
  91. package/dist/distributions/signrank.js +24 -0
  92. package/dist/distributions/summary.d.ts +20 -2
  93. package/dist/distributions/summary.js +4 -0
  94. package/dist/distributions/t.d.ts +18 -0
  95. package/dist/distributions/t.js +18 -0
  96. package/dist/distributions/triangular.d.ts +36 -4
  97. package/dist/distributions/triangular.js +31 -3
  98. package/dist/distributions/tukey.d.ts +15 -1
  99. package/dist/distributions/tukey.js +10 -0
  100. package/dist/distributions/uniform.d.ts +29 -1
  101. package/dist/distributions/uniform.js +24 -0
  102. package/dist/distributions/weibull.d.ts +29 -1
  103. package/dist/distributions/weibull.js +24 -0
  104. package/dist/distributions/wilcox.d.ts +24 -0
  105. package/dist/distributions/wilcox.js +24 -0
  106. package/dist/distributions.js +2 -2
  107. package/dist/entries/descriptive.d.ts +1 -1
  108. package/dist/entries/mixed.d.ts +1 -0
  109. package/dist/entries/mixed.js +2 -0
  110. package/dist/entries/numerics.d.ts +1 -1
  111. package/dist/entries/tests.js +1 -1
  112. package/dist/htest/agreement.d.ts +61 -23
  113. package/dist/htest/agreement.js +19 -9
  114. package/dist/htest/ansariTest.d.ts +8 -2
  115. package/dist/htest/aov.d.ts +43 -10
  116. package/dist/htest/aov.js +17 -3
  117. package/dist/htest/binomTest.d.ts +12 -2
  118. package/dist/htest/binomTest.js +2 -0
  119. package/dist/htest/brunnerMunzelTest.d.ts +9 -3
  120. package/dist/htest/brunnerMunzelTest.js +4 -2
  121. package/dist/htest/chisqTest.d.ts +19 -3
  122. package/dist/htest/cor.d.ts +20 -4
  123. package/dist/htest/effectSize.d.ts +70 -12
  124. package/dist/htest/effectSize.js +40 -7
  125. package/dist/htest/fisherTest.d.ts +9 -1
  126. package/dist/htest/fisherTest.js +2 -0
  127. package/dist/htest/groups.d.ts +5 -1
  128. package/dist/htest/ksTest.d.ts +20 -3
  129. package/dist/htest/leveneTest.d.ts +15 -4
  130. package/dist/htest/leveneTest.js +5 -2
  131. package/dist/htest/mantelhaenTest.d.ts +25 -3
  132. package/dist/htest/mantelhaenTest.js +15 -1
  133. package/dist/htest/mcnemarTest.d.ts +14 -4
  134. package/dist/htest/mcnemarTest.js +4 -2
  135. package/dist/htest/multipleComparisons.d.ts +173 -29
  136. package/dist/htest/multipleComparisons.js +123 -19
  137. package/dist/htest/normalityTests.d.ts +56 -9
  138. package/dist/htest/normalityTests.js +40 -6
  139. package/dist/htest/onewayTest.d.ts +32 -3
  140. package/dist/htest/onewayTest.js +10 -0
  141. package/dist/htest/pAdjust.d.ts +9 -1
  142. package/dist/htest/pAdjust.js +2 -0
  143. package/dist/htest/pairwise.d.ts +50 -5
  144. package/dist/htest/pairwise.js +25 -0
  145. package/dist/htest/poissonTest.d.ts +12 -2
  146. package/dist/htest/poissonTest.js +2 -0
  147. package/dist/htest/polycor.d.ts +29 -10
  148. package/dist/htest/power.d.ts +60 -6
  149. package/dist/htest/power.js +6 -0
  150. package/dist/htest/propTest.d.ts +13 -2
  151. package/dist/htest/propTest.js +2 -0
  152. package/dist/htest/pwr.d.ts +286 -36
  153. package/dist/htest/pwr.js +116 -15
  154. package/dist/htest/rankTests.d.ts +80 -12
  155. package/dist/htest/rankTests.js +11 -2
  156. package/dist/htest/tTest.d.ts +13 -3
  157. package/dist/htest/testFormula.js +6 -3
  158. package/dist/htest/trendTests.d.ts +29 -8
  159. package/dist/htest/trendTests.js +8 -4
  160. package/dist/htest/types.d.ts +14 -2
  161. package/dist/htest/varTest.d.ts +25 -8
  162. package/dist/htest/wilcoxTest.d.ts +10 -2
  163. package/dist/internal/dpq.d.ts +4 -0
  164. package/dist/internal/noncentral.d.ts +2 -0
  165. package/dist/internal/vectorize.d.ts +4 -0
  166. package/dist/linalg/basic.d.ts +39 -5
  167. package/dist/linalg/basic.js +15 -0
  168. package/dist/linalg/chol.d.ts +26 -5
  169. package/dist/linalg/chol.js +7 -0
  170. package/dist/linalg/eigen.d.ts +16 -7
  171. package/dist/linalg/eigen.js +6 -5
  172. package/dist/linalg/expm.d.ts +15 -5
  173. package/dist/linalg/expm.js +5 -3
  174. package/dist/linalg/kappa.d.ts +21 -1
  175. package/dist/linalg/kappa.js +16 -0
  176. package/dist/linalg/lu.d.ts +30 -6
  177. package/dist/linalg/lu.js +15 -3
  178. package/dist/linalg/matrix.d.ts +4 -0
  179. package/dist/linalg/norm.d.ts +16 -1
  180. package/dist/linalg/norm.js +9 -0
  181. package/dist/linalg/ops.d.ts +156 -35
  182. package/dist/linalg/ops.js +96 -15
  183. package/dist/linalg/qr.d.ts +87 -12
  184. package/dist/linalg/qr.js +31 -0
  185. package/dist/linalg/schur.d.ts +8 -2
  186. package/dist/linalg/schur.js +3 -1
  187. package/dist/linalg/solve.d.ts +42 -6
  188. package/dist/linalg/solve.js +22 -0
  189. package/dist/linalg/svd.d.ts +12 -2
  190. package/dist/linalg/svd.js +2 -0
  191. package/dist/linalg.js +2 -2
  192. package/dist/mixed.js +3 -0
  193. package/dist/models/anovaSequential.d.ts +26 -4
  194. package/dist/models/anovaSequential.js +3 -1
  195. package/dist/models/aovEz.d.ts +29 -6
  196. package/dist/models/aovEz.js +5 -2
  197. package/dist/models/aovStrata.d.ts +13 -3
  198. package/dist/models/aovStrata.js +5 -1
  199. package/dist/models/carAnova.d.ts +9 -3
  200. package/dist/models/carAnova.js +4 -2
  201. package/dist/models/coxph.d.ts +33 -7
  202. package/dist/models/coxph.js +8 -3
  203. package/dist/models/formula.d.ts +26 -1
  204. package/dist/models/formula.js +125 -9
  205. package/dist/models/glm.d.ts +128 -21
  206. package/dist/models/glm.js +71 -14
  207. package/dist/models/glmAnova.d.ts +30 -5
  208. package/dist/models/glmAnova.js +15 -2
  209. package/dist/models/glmConfint.d.ts +16 -2
  210. package/dist/models/glmConfint.js +9 -1
  211. package/dist/models/glmFamily.d.ts +27 -5
  212. package/dist/models/lm.d.ts +77 -19
  213. package/dist/models/lm.js +22 -4
  214. package/dist/models/lmer.d.ts +162 -0
  215. package/dist/models/lmer.js +457 -0
  216. package/dist/models/mauchly.d.ts +20 -5
  217. package/dist/models/mauchly.js +7 -3
  218. package/dist/models/mixedDeviance.d.ts +44 -0
  219. package/dist/models/mixedDeviance.js +872 -0
  220. package/dist/models/mixedStructure.d.ts +82 -0
  221. package/dist/models/mixedStructure.js +309 -0
  222. package/dist/models/modelFrame.d.ts +17 -2
  223. package/dist/models/modelFrame.js +36 -21
  224. package/dist/models/modelMatrix.d.ts +33 -8
  225. package/dist/models/modelMatrix.js +21 -5
  226. package/dist/models/survival.d.ts +41 -9
  227. package/dist/models/survival.js +10 -4
  228. package/dist/numerics/deriv.d.ts +21 -6
  229. package/dist/numerics/deriv.js +16 -5
  230. package/dist/numerics/integrate.d.ts +37 -7
  231. package/dist/numerics/integrate.js +8 -2
  232. package/dist/numerics/interp.d.ts +63 -12
  233. package/dist/numerics/interp.js +30 -6
  234. package/dist/numerics/ode.d.ts +15 -5
  235. package/dist/numerics/ode.js +5 -3
  236. package/dist/numerics.js +2 -2
  237. package/dist/optim/optim.d.ts +32 -8
  238. package/dist/optim/optim.js +8 -4
  239. package/dist/random/beta.d.ts +8 -0
  240. package/dist/random/beta.js +8 -0
  241. package/dist/random/binomial.d.ts +16 -0
  242. package/dist/random/binomial.js +16 -0
  243. package/dist/random/continuous.d.ts +51 -0
  244. package/dist/random/continuous.js +51 -0
  245. package/dist/random/extra.d.ts +66 -6
  246. package/dist/random/extra.js +66 -6
  247. package/dist/random/gamma.d.ts +33 -0
  248. package/dist/random/gamma.js +33 -0
  249. package/dist/random/hyper.d.ts +8 -0
  250. package/dist/random/hyper.js +8 -0
  251. package/dist/random/poisson.d.ts +25 -0
  252. package/dist/random/poisson.js +25 -0
  253. package/dist/random/r2dtable.d.ts +2 -0
  254. package/dist/random/r2dtable.js +2 -0
  255. package/dist/random/rank.d.ts +16 -0
  256. package/dist/random/rank.js +16 -0
  257. package/dist/random/rng.d.ts +49 -6
  258. package/dist/random/rng.js +29 -2
  259. package/dist/random/sample.d.ts +10 -2
  260. package/dist/random/sample.js +5 -1
  261. package/dist/random/streams.d.ts +13 -0
  262. package/dist/random/streams.js +13 -0
  263. package/dist/rstats.js +14 -14
  264. package/dist/special/besselIK.d.ts +11 -3
  265. package/dist/special/besselIK.js +6 -2
  266. package/dist/special/besselJY.d.ts +6 -2
  267. package/dist/special/besselJY.js +6 -2
  268. package/dist/special/beta.d.ts +16 -2
  269. package/dist/special/beta.js +16 -2
  270. package/dist/special/choose.d.ts +13 -5
  271. package/dist/special/choose.js +13 -5
  272. package/dist/special/erf.d.ts +8 -3
  273. package/dist/special/erf.js +8 -3
  274. package/dist/special/extra.d.ts +30 -10
  275. package/dist/special/extra.js +25 -9
  276. package/dist/special/gamma.d.ts +18 -2
  277. package/dist/special/gamma.js +18 -2
  278. package/dist/special/log1p.d.ts +16 -7
  279. package/dist/special/log1p.js +16 -7
  280. package/dist/special/psigamma.d.ts +9 -3
  281. package/dist/special/psigamma.js +9 -3
  282. package/dist/special/rCompatible.d.ts +5 -1
  283. package/dist/special.js +2 -2
  284. package/dist/tests.js +12 -12
  285. package/llms.txt +13 -3
  286. package/package.json +5 -1
  287. package/dist/chunks/chunk-7GQMKH3Z.js +0 -2
  288. package/dist/chunks/chunk-AHHS6AC4.js +0 -3
  289. package/dist/chunks/chunk-ALM3VHFP.js +0 -2
@@ -1,5 +1,6 @@
1
1
  /**
2
- * log(1 + x) - x, accurate for small |x| (where log1p(x) - x would cancel). As `log1pmx` in R's C API (Rmath.h).
2
+ * log(1 + x) - x, accurate for small |x| (where log1p(x) - x would cancel).
3
+ * Not an R function. R has it only in its C API (Rmath.h), as `log1pmx`.
3
4
  *
4
5
  * @param x A number >= -1.
5
6
  * @returns log(1 + x) - x; `-Infinity` at x = -1 and x = Infinity, `NaN` for x < -1.
@@ -8,11 +9,13 @@
8
9
  * ```ts
9
10
  * log1pmx(1e-5); // -4.9999666669166655e-11
10
11
  * ```
12
+ *
13
+ * @category Special functions
11
14
  */
12
15
  export declare function log1pmx(x: number): number;
13
16
  /**
14
- * lgamma(1 + x) = log|Gamma(1 + x)|, accurate near x = 0 and x = 1, where it is near 0. As `lgamma1p` in R's C
15
- * API (Rmath.h).
17
+ * lgamma(1 + x) = log|Gamma(1 + x)|, accurate near x = 0 and x = 1, where it is near 0.
18
+ * Not an R function. R has it only in its C API (Rmath.h), as `lgamma1p`.
16
19
  *
17
20
  * @param x A number.
18
21
  * @returns log|Gamma(1 + x)|; `Infinity` at the poles (x a negative integer) and at x = Infinity, `NaN` for
@@ -22,11 +25,13 @@ export declare function log1pmx(x: number): number;
22
25
  * ```ts
23
26
  * lgamma1p(1e-10); // -5.7721566481928616e-11 (lgamma(1 + 1e-10) keeps only about 6 digits)
24
27
  * ```
28
+ *
29
+ * @category Special functions
25
30
  */
26
31
  export declare function lgamma1p(x: number): number;
27
32
  /**
28
- * log(1 - exp(-x)) for x >= 0, accurate for both small and large x. As `log1mexp` in R's C API (Rmath.h) and the DPQ
29
- * package; note the sign of the argument.
33
+ * log(1 - exp(-x)) for x >= 0, accurate for both small and large x; note the sign of the argument.
34
+ * Not an R function. R has it only in its C API (Rmath.h), as `log1mexp`; the DPQ package also has it.
30
35
  *
31
36
  * @param x A number >= 0.
32
37
  * @returns log(1 - exp(-x)); `-Infinity` at x = 0, 0 at x = Infinity, `NaN` for x < 0.
@@ -35,11 +40,13 @@ export declare function lgamma1p(x: number): number;
35
40
  * ```ts
36
41
  * log1mexp(1e-10); // -23.025850929990458
37
42
  * ```
43
+ *
44
+ * @category Special functions
38
45
  */
39
46
  export declare function log1mexp(x: number): number;
40
47
  /**
41
- * log(1 + exp(x)), without overflow for large x and accurate for very negative x. As `log1pexp` in R's C API
42
- * (Rmath.h) and the DPQ package.
48
+ * log(1 + exp(x)), without overflow for large x and accurate for very negative x.
49
+ * Not an R function. R has it only in its C API (Rmath.h), as `log1pexp`; the DPQ package also has it.
43
50
  *
44
51
  * @param x A number.
45
52
  * @returns log(1 + exp(x)); 0 at x = -Infinity, `Infinity` at x = Infinity.
@@ -49,5 +56,7 @@ export declare function log1mexp(x: number): number;
49
56
  * log1pexp(800); // 800
50
57
  * log1pexp(-40); // 4.248354255291589e-18
51
58
  * ```
59
+ *
60
+ * @category Special functions
52
61
  */
53
62
  export declare function log1pexp(x: number): number;
@@ -7,7 +7,8 @@ import { log1mExp } from "../internal/ddexp.js";
7
7
  import { lgamma1p as lgamma1pKernel } from "./gamma.js";
8
8
  import { log1pmx as log1pmxKernel } from "./log1pmx.js";
9
9
  /**
10
- * log(1 + x) - x, accurate for small |x| (where log1p(x) - x would cancel). As `log1pmx` in R's C API (Rmath.h).
10
+ * log(1 + x) - x, accurate for small |x| (where log1p(x) - x would cancel).
11
+ * Not an R function. R has it only in its C API (Rmath.h), as `log1pmx`.
11
12
  *
12
13
  * @param x A number >= -1.
13
14
  * @returns log(1 + x) - x; `-Infinity` at x = -1 and x = Infinity, `NaN` for x < -1.
@@ -16,6 +17,8 @@ import { log1pmx as log1pmxKernel } from "./log1pmx.js";
16
17
  * ```ts
17
18
  * log1pmx(1e-5); // -4.9999666669166655e-11
18
19
  * ```
20
+ *
21
+ * @category Special functions
19
22
  */
20
23
  export function log1pmx(x) {
21
24
  if (Number.isNaN(x) || x < -1)
@@ -25,8 +28,8 @@ export function log1pmx(x) {
25
28
  return log1pmxKernel(x);
26
29
  }
27
30
  /**
28
- * lgamma(1 + x) = log|Gamma(1 + x)|, accurate near x = 0 and x = 1, where it is near 0. As `lgamma1p` in R's C
29
- * API (Rmath.h).
31
+ * lgamma(1 + x) = log|Gamma(1 + x)|, accurate near x = 0 and x = 1, where it is near 0.
32
+ * Not an R function. R has it only in its C API (Rmath.h), as `lgamma1p`.
30
33
  *
31
34
  * @param x A number.
32
35
  * @returns log|Gamma(1 + x)|; `Infinity` at the poles (x a negative integer) and at x = Infinity, `NaN` for
@@ -36,6 +39,8 @@ export function log1pmx(x) {
36
39
  * ```ts
37
40
  * lgamma1p(1e-10); // -5.7721566481928616e-11 (lgamma(1 + 1e-10) keeps only about 6 digits)
38
41
  * ```
42
+ *
43
+ * @category Special functions
39
44
  */
40
45
  export function lgamma1p(x) {
41
46
  if (Number.isNaN(x) || x === -Infinity)
@@ -47,8 +52,8 @@ export function lgamma1p(x) {
47
52
  return lgamma1pKernel(x);
48
53
  }
49
54
  /**
50
- * log(1 - exp(-x)) for x >= 0, accurate for both small and large x. As `log1mexp` in R's C API (Rmath.h) and the DPQ
51
- * package; note the sign of the argument.
55
+ * log(1 - exp(-x)) for x >= 0, accurate for both small and large x; note the sign of the argument.
56
+ * Not an R function. R has it only in its C API (Rmath.h), as `log1mexp`; the DPQ package also has it.
52
57
  *
53
58
  * @param x A number >= 0.
54
59
  * @returns log(1 - exp(-x)); `-Infinity` at x = 0, 0 at x = Infinity, `NaN` for x < 0.
@@ -57,6 +62,8 @@ export function lgamma1p(x) {
57
62
  * ```ts
58
63
  * log1mexp(1e-10); // -23.025850929990458
59
64
  * ```
65
+ *
66
+ * @category Special functions
60
67
  */
61
68
  export function log1mexp(x) {
62
69
  if (Number.isNaN(x) || x < 0)
@@ -68,8 +75,8 @@ export function log1mexp(x) {
68
75
  return log1mExp(-x);
69
76
  }
70
77
  /**
71
- * log(1 + exp(x)), without overflow for large x and accurate for very negative x. As `log1pexp` in R's C API
72
- * (Rmath.h) and the DPQ package.
78
+ * log(1 + exp(x)), without overflow for large x and accurate for very negative x.
79
+ * Not an R function. R has it only in its C API (Rmath.h), as `log1pexp`; the DPQ package also has it.
73
80
  *
74
81
  * @param x A number.
75
82
  * @returns log(1 + exp(x)); 0 at x = -Infinity, `Infinity` at x = Infinity.
@@ -79,6 +86,8 @@ export function log1mexp(x) {
79
86
  * log1pexp(800); // 800
80
87
  * log1pexp(-40); // 4.248354255291589e-18
81
88
  * ```
89
+ *
90
+ * @category Special functions
82
91
  */
83
92
  export function log1pexp(x) {
84
93
  if (Number.isNaN(x))
@@ -1,6 +1,6 @@
1
1
  import type { RCompatibleOptions } from "./rCompatible.js";
2
2
  /**
3
- * Digamma function, the derivative of `lgamma`. Equivalent to R's `digamma(x)` for a single number.
3
+ * Digamma function, the derivative of `lgamma`. Equivalent to R's `digamma()`. Takes a single number.
4
4
  *
5
5
  * @param x - Argument.
6
6
  * @returns psi(x) (`NaN` at zero and the negative integers).
@@ -9,10 +9,12 @@ import type { RCompatibleOptions } from "./rCompatible.js";
9
9
  * ```ts
10
10
  * digamma(1); // -0.5772156649015329 (minus Euler's constant)
11
11
  * ```
12
+ *
13
+ * @category Special functions
12
14
  */
13
15
  export declare function digamma(x: number): number;
14
16
  /**
15
- * Trigamma function, the second derivative of `lgamma`. Equivalent to R's `trigamma(x)` for a single number.
17
+ * Trigamma function, the second derivative of `lgamma`. Equivalent to R's `trigamma()`. Takes a single number.
16
18
  *
17
19
  * `trigamma(-Infinity)` is `Infinity` as in R (`NaN` with `rCompatible: false`).
18
20
  *
@@ -24,11 +26,13 @@ export declare function digamma(x: number): number;
24
26
  * ```ts
25
27
  * trigamma(1); // 1.6449340668482264 (pi^2 / 6)
26
28
  * ```
29
+ *
30
+ * @category Special functions
27
31
  */
28
32
  export declare function trigamma(x: number, options?: RCompatibleOptions): number;
29
33
  /**
30
34
  * Polygamma function, the derivative of order `deriv` of `digamma`. Equivalent to R's
31
- * `psigamma(x, deriv)` for a single number.
35
+ * `psigamma()`. Takes a single number.
32
36
  *
33
37
  * `psigamma(-Infinity, deriv)` is `Infinity` for odd `deriv` as in R, which treats it like the poles
34
38
  * (`NaN` with `rCompatible: false`). Unlike R, which returns `NaN` for `x < 0` with `deriv >= 6` and
@@ -44,5 +48,7 @@ export declare function trigamma(x: number, options?: RCompatibleOptions): numbe
44
48
  * ```ts
45
49
  * psigamma(2, 2); // -0.40411380631918853 (-2 (zeta(3) - 1))
46
50
  * ```
51
+ *
52
+ * @category Special functions
47
53
  */
48
54
  export declare function psigamma(x: number, deriv?: number, options?: RCompatibleOptions): number;
@@ -257,7 +257,7 @@ function polygamma(n, x, rCompatible) {
257
257
  return (n % 2 === 0 ? refl : -refl) - Math.pow(Math.PI, n + 1) * cotDeriv(n, cotpi(x));
258
258
  }
259
259
  /**
260
- * Digamma function, the derivative of `lgamma`. Equivalent to R's `digamma(x)` for a single number.
260
+ * Digamma function, the derivative of `lgamma`. Equivalent to R's `digamma()`. Takes a single number.
261
261
  *
262
262
  * @param x - Argument.
263
263
  * @returns psi(x) (`NaN` at zero and the negative integers).
@@ -266,6 +266,8 @@ function polygamma(n, x, rCompatible) {
266
266
  * ```ts
267
267
  * digamma(1); // -0.5772156649015329 (minus Euler's constant)
268
268
  * ```
269
+ *
270
+ * @category Special functions
269
271
  */
270
272
  export function digamma(x) {
271
273
  if (Math.abs(x - NEGROOT) < 0.3)
@@ -273,7 +275,7 @@ export function digamma(x) {
273
275
  return psi(x);
274
276
  }
275
277
  /**
276
- * Trigamma function, the second derivative of `lgamma`. Equivalent to R's `trigamma(x)` for a single number.
278
+ * Trigamma function, the second derivative of `lgamma`. Equivalent to R's `trigamma()`. Takes a single number.
277
279
  *
278
280
  * `trigamma(-Infinity)` is `Infinity` as in R (`NaN` with `rCompatible: false`).
279
281
  *
@@ -285,13 +287,15 @@ export function digamma(x) {
285
287
  * ```ts
286
288
  * trigamma(1); // 1.6449340668482264 (pi^2 / 6)
287
289
  * ```
290
+ *
291
+ * @category Special functions
288
292
  */
289
293
  export function trigamma(x, options) {
290
294
  return polygamma(1, x, options?.rCompatible ?? true);
291
295
  }
292
296
  /**
293
297
  * Polygamma function, the derivative of order `deriv` of `digamma`. Equivalent to R's
294
- * `psigamma(x, deriv)` for a single number.
298
+ * `psigamma()`. Takes a single number.
295
299
  *
296
300
  * `psigamma(-Infinity, deriv)` is `Infinity` for odd `deriv` as in R, which treats it like the poles
297
301
  * (`NaN` with `rCompatible: false`). Unlike R, which returns `NaN` for `x < 0` with `deriv >= 6` and
@@ -307,6 +311,8 @@ export function trigamma(x, options) {
307
311
  * ```ts
308
312
  * psigamma(2, 2); // -0.40411380631918853 (-2 (zeta(3) - 1))
309
313
  * ```
314
+ *
315
+ * @category Special functions
310
316
  */
311
317
  export function psigamma(x, deriv = 0, options) {
312
318
  const n = roundHalfEven(deriv);
@@ -1,4 +1,8 @@
1
- /** Option shared by functions whose edge cases R defines differently from the mathematical function */
1
+ /**
2
+ * Option shared by functions whose edge cases R defines differently from the mathematical function
3
+ *
4
+ * @category Special functions
5
+ */
2
6
  export interface RCompatibleOptions {
3
7
  /**
4
8
  * `true` (default) returns what R returns at the edge cases listed for each function; `false` returns the
package/dist/special.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! rStats.js 0.11.0 | MIT License | includes code ported from SciPy, Boost.Math, statsmodels, LAPACK and others: see THIRD_PARTY_NOTICES.md at https://github.com/numero-uno-jpn/rStats.js */
2
- import{a as wt,b as Lt,c as _t,d as Et}from"./chunks/chunk-YSWGDOWK.js";import{c as G,d as St,e as jt,j as ht}from"./chunks/chunk-TOGXTCZO.js";import{A as v,C as Dt,D as Ft,b as $,c as qt,h as ft,k as d,l as q,m as U,n as _,o as C,p as Z,q as ct,u as z,v as lt,w as mt,y as ut}from"./chunks/chunk-JWBO5WVN.js";import{b as E,d as j,f as T,g as J,h as at,i as O,k as L}from"./chunks/chunk-EZWBRCJL.js";var Mt=22250738585072014e-324;function W(t,e,n){if(t<10)return Math.pow(e/2,t)/q(t+1)*n;let s=e/2,r=z(t,s,!1);if(r>=Mt&&s<700){let a=r*Math.exp(s)*n;if(Math.abs(a)>=Mt)return a}let o=z(t,s,!0)+s+Math.log(Math.abs(n));return Math.sign(n)*Math.exp(o)}var D=Number.EPSILON,H=1e6;function pt(t){return Math.expm1(C(t))}function Tt(t,e){let n=pt(t),s=pt(-t),r=Math.log(e/2),o=Math.exp(t*r),a=-r*t,i=Math.abs(t)<D?1:d(t)/(t*Math.PI),c=Math.abs(a)<D?1:Math.sinh(a)/a,l=Math.abs(t)<D?-.5772156649015329:.5/t*(n-s)*i,f=(2+n+s)*i/2,m=(n+1)/(2*o),u=(1+s)*o/2,M=(Math.cosh(a)*l+c*-r*f)/i,p=m,h=1,S=h*M,k=h*p;for(let I=1;I<H&&(M=(I*M+m+u)/(I*I-t*t),m/=I-t,u/=I+t,p=m-I*M,h*=e*e/(4*I),S+=h*M,k+=h*p,!(Math.abs(h*M)<Math.abs(S)*D));I++);return[S,2*k/e]}function At(t,e){let n=Math.sqrt(Number.MIN_VALUE*4503599627370496),s=n,r=n,o=0;for(let a=1;a<H;a++){let i=2*(t+a)/e;s=i+1/s,o=i+o,s===0&&(s=n),o===0&&(o=n),o=1/o;let c=s*o;if(r*=c,Math.abs(c-1)<=2*D)break}return r}function Jt(t,e){let n=t*t-.25,s=2*(e+1),r=1/s,o=r,a=r,i=0,c=1,l=-n,f=l,m=1+f*a;for(let p=2;p<H;p++){n-=2*(p-1),s+=2,r=1/(s+n*r),a*=s*r-1,o+=a;let h=(i-(s-2)*c)/n;if(i=c,c=h,l*=-n/p,f+=l*h,m+=f*a,h<D&&(l*=h,i/=h,c/=h),Math.abs(f*a)<Math.abs(m)*D)break}let u=(.5+t+e+(t*t-.25)*o)/e,M=Math.sqrt(Math.PI/(2*e))/m;return[M,M*u]}function V(t,e){if(!Number.isFinite(e))return e>0?t*(1/0):t*0;for(;e>1e3;)t*=2**1e3,e-=1e3;for(;e<-1e3;)t*=2**-1e3,e+=1e3;return t*2**e}function bt(t,e){let n=Math.round(t),s=t-n,r,o;if(s===-.5)r=o=Math.sqrt(Math.PI/(2*e));else if(e<=2){let[i,c]=Tt(s,e),l=Math.exp(e);r=i*l,o=c*l}else[r,o]=Jt(s,e);let a=0;for(let i=1;i<=n;i++){let c=2*(s+i)/e,l=Math.log2(Math.abs(o))+Math.log2(c);if(l>900&&Number.isFinite(l)){let m=Math.ceil(l-800);r=V(r,-m),o=V(o,-m),a+=m}let f=c*o+r;r=o,o=f}return{k:r,k1:o,exp2:a}}function Kt(t,e){let n=e*e/4,s=1,r=0;for(let o=1;o<H&&(r+=s,s*=n/o,s/=o+t,!(Math.abs(s)<=D*Math.abs(r)));o++);return W(t,e,r+s)}function Rt(t,e,n){if(t===0||!Number.isFinite(t))return t;let s=t,r=e,o=n>0?700:-700,a=Math.exp(o);for(;Math.abs(n)>700;){n-=o,s*=a;let i=Math.floor(Math.log2(Math.abs(s)));s=V(s,-i),r+=i}return V(s*Math.exp(n),r)}function x(t,e,n){let s=t.ex+n;return s===0?V(t.m,t.e2):Rt(t.m,t.e2,s*e)}function Yt(t,e){if(t===.5)return{m:Math.sqrt(2/(e*Math.PI))*(-Math.expm1(-2*e)/2),e2:0,ex:1};if(t>0&&e/t<.25)return{m:Kt(t,e),e2:0,ex:0};let n=(4*t*t+10)/(8*e);if(n*=n,n*=n,n/=24,n<D*10&&e>100){let i=4*t*t,c=8*e,l=i-1,f=c,m=1-l/f;return l*=i-9,f*=c*2,m+=l/f,l*=i-25,f*=c*3,m-=l/f,{m:m/Math.sqrt(2*e*Math.PI),e2:0,ex:1}}let{k:s,k1:r,exp2:o}=bt(t,e),a=At(t,e);return{m:1/(e*(s*a+r)),e2:-o,ex:1}}function Nt(t,e){let n=4*t*t,s=8*e,r=(n-1)/s,o=r*(n-9)/(2*s),a=o*(n-25)/(3*s),i=a*(n-49)/(4*s),c=1+r+o+a;if(Math.abs(i)<D*Math.abs(c))return{m:c*Math.sqrt(Math.PI)/Math.sqrt(2*e),e2:0,ex:-1};let{k:l,exp2:f}=bt(t,e);return{m:l,e2:f,ex:-1}}function Ct(t,e,n={}){let s=n.exponScaled??!1;if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let r=Math.abs(e),o=e<0&&e!==Math.floor(e);if(t===0)return o?d(r)>0?1/0:-1/0:e===0?1:0;if(t===1/0)return s?0:1/0;let a=s?-1:0,i=x(Yt(r,t),t,a);if(!o)return i;let c=Nt(r,t);return i+x({...c,m:2/Math.PI*d(r)*c.m},t,a)}function Qt(t,e,n={}){let s=n.exponScaled??!1;if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let r=Math.abs(e);return t===0?1/0:t===1/0?0:x(Nt(r,t),t,s?1:0)}var y=Number.EPSILON;function A(t,e){if(!Number.isFinite(e))return e>0?t*(1/0):t*0;for(;e>1e3;)t*=2**1e3,e-=1e3;for(;e<-1e3;)t*=2**-1e3,e+=1e3;return t*2**e}function gt(t,e,n,s,r){let o=s,a=r,i=0;for(let c=1;c<=n;c++){let l=2*(t+c)/e,f=Math.log2(Math.abs(a))+Math.log2(l);if(f>900&&Number.isFinite(f)){let u=Math.ceil(f-800);o=A(o,-u),a=A(a,-u),i+=u}let m=l*a-o;o=a,a=m}return{y:o,y1:a,e2:i}}var K=1e6,g=Math.sqrt(22250738585072014e-324),Ut=Number.MAX_VALUE;function It(t){return Math.expm1(C(t))}function Q(t){return d(.5-Math.abs(t%2))}function dt(t,e){let n=-(e/2)*(e/2),s=1,r=0;for(let o=1;o<K&&(r+=s,s*=n/(o*(o+t)),!(Math.abs(s)<=y*Math.abs(r)));o++);return W(t,e,r+s)}function Vt(t,e){let n=Math.log(e/2),s=0,r=t>=170||709.78/t<Math.abs(n),o;if(r){let u=_(t);if(n=t*n,o=u-Math.log(Math.PI)-n,709.78<o){let M=Math.ceil((o-700)/Math.LN2);o-=M*Math.LN2,s=M}o=-Math.exp(o)}else{let u=q(t);n=Math.pow(e/2,t),Ut*n<u&&(u*=2**-1e3,s=1e3),o=-u/(Math.PI*n)}let a=-(e/2)*(e/2),i=1,c=0;for(let u=1;u<K&&(c+=i,i*=a/(u*(u-t)),!(Math.abs(i)<=y*Math.abs(c)));u++);let l=(c+i)*o,f;if(!r)f=q(-t)*Q(t)*n/Math.PI;else{let u=U(-t);f=Math.exp(u.value+n)*u.sign/Math.PI}i=1;let m=0;for(let u=1;u<K&&(m+=i,i*=a/(u*(u+t)),!(Math.abs(i)<=y*Math.abs(m)));u++);return m+=i,l-=A(f*m,-s),{m:l,e2:s}}function Xt(t,e){let n=1,s=0,r=1,o=8*e,a=1,i=4*t*t,c=1,l=!0;do{c*=(i-a*a)/(r*o),s+=c,r+=1,a+=2;let f=(a*a-i)/(r*o);l=Math.abs(f)<.5,c*=f,n+=c,r+=1,a+=2}while(Math.abs(c)>2*y*n&&l);return l?{p:n,q:s}:void 0}function Bt(t,e){let n=It(t),s=It(-t),r=d(t),o=d(t/2),a=Math.pow(e/2,t),i=Math.log(e/2),c=-i*t,l=Math.abs(c)<y?1:Math.sinh(c)/c,f=Math.abs(t)<y?t*Math.PI*Math.PI/2:2*o*o/t,m=t===0?-.5772156649015329:(n-s)/((1+n)*(1+s)*2*t),u=(2+n+s)/((1+n)*(1+s)*2),M=Math.abs(t)<y?1/Math.PI:t/r,p=(m*Math.cosh(c)-u*i*l)*2*M,h=M/(a*(1+s)),S=M*a/(1+n),k=p+f*S,I=h,F=1,R=F*k,X=F*I,B=t*t,b=-e*e/4;for(let N=1;N<K&&(p=(N*p+h+S)/(N*N-B),h/=N-t,S/=N+t,k=p+f*S,I=h-N*k,F*=b/N,R+=F*k,X+=F*I,!(Math.abs(F*k)<Math.abs(R)*y));N++);return[-R,-2*X/e]}function Ot(t,e){let n=[g,0],s=[g,0],r=[0,0],o=1,a=[e,0];for(let i=1;i<K*100;i++){let c=E(t,i),l=O([2*c[0],2*c[1]],a);n=T(l,O([1,0],n)),r=T(l,r),n[0]===0&&(n=[g,0]),r[0]===0&&(r=[g,0]),r=O([1,0],r);let f=J(n,r);if(s=J(s,f),r[0]<0&&(o=-o),Math.abs(f[0]-1+f[1])<y*y)break}return{fv:-(s[0]+s[1]),sign:o}}function yt(t,e){if(e>30)return Ot(t,e);let n=g,s=g,r=0,o=1;for(let a=1;a<K*100;a++){let i=2*(t+a)/e;n=i-1/n,r=i-r,n===0&&(n=g),r===0&&(r=g),r=1/r;let c=n*r;if(s*=c,r<0&&(o=-o),Math.abs(c-1)<2*y)break}return{fv:-s,sign:o}}function Pt(t,e){let n=-.5/e,s=1,r=n,o=s,a=t*t,i=(.25-a)/e,c=2*e,l=2,f=r*r+1;o=l+i*r/f,r=c+i/f;let m=c,u=l;Math.abs(r)+Math.abs(o)<g&&(r=g),Math.abs(m)+Math.abs(u)<g&&(m=g),f=m*m+u*u,m=m/f,u=-u/f;let M=r*m-o*u,p=o*m+r*u;f=n,n=f*M-s*p,s=f*p+s*M;for(let h=2;h<K&&(i=h-.5,i*=i,i-=a,l+=2,f=r*r+o*o,r=c+i*r/f,o=l-i*o/f,m=c+i*m,u=l+i*u,Math.abs(r)+Math.abs(o)<g&&(r=g),Math.abs(m)+Math.abs(u)<g&&(m=g),f=m*m+u*u,m=m/f,u=-u/f,M=r*m-o*u,p=o*m+r*u,f=n,n=f*M-s*p,s=f*p+s*M,!(Math.abs(M-1)+Math.abs(p)<2*y));h++);return{p:n,q:s}}function Zt(t,e){let n=1,s=4*t*t,r=2*e;return r*=r,n+=(s-1)/(2*r),n+=3*(s-1)*(s-9)/(r*r*8),n+=15*(s-1)*(s-9)*(s-25)/(r*r*r*8*6),Math.sqrt(n*2/(Math.PI*e))}function Gt(t,e){let n=4*t*t,s=4*e,r=s*s,o=0;return o+=(n-1)/(2*s),s*=r,o+=(n-1)*(n-25)/(6*s),s*=r,o+=(n-1)*(n*n-114*n+1073)/(5*s),s*=r,o+=(n-1)*(5*n*n*n-1535*n*n+54703*n-375733)/(14*s),o}function Wt(t,e){let n=Zt(t,e),s=Gt(t,e),r=Math.cos(e),o=Math.sin(e),a=Q(t/2+.25),i=d(t/2+.25),c=Math.sin(s),l=Math.cos(s),f=(c*(r*a+o*i)+l*(o*a-r*i))*n;return{j:(l*(r*a+o*i)-c*(o*a-r*i))*n,y:f}}function tt(t,e,n){let s=Math.round(t),r=t-s,o=2/(e*Math.PI);if(!n&&(e<5||t>e*e/4))return{j:dt(t,e),y:{m:NaN,e2:0}};if(e<1&&r!==0&&Math.log(y/2)>t*Math.log(e/2*(e/2)/t))return{j:dt(t,e),y:Vt(t,e)};if(Math.max(t,1)<e*.011048543456039806){let b=Wt(t,e);return{j:b.j,y:{m:b.y,e2:0}}}if(e>8){let b=Xt(t,e);if(b!==void 0){let N=(t/2+.25)%2,P=Math.sin(e),w=Math.cos(e),Y=d(N),rt=Q(N),st=P*rt-Y*w,ot=w*rt+P*Y,it=Math.SQRT2/(Math.sqrt(Math.PI)*Math.sqrt(e));return{j:it*(b.p*ot-b.q*st),y:{m:it*(b.p*st+b.q*ot),e2:0}}}}if(e<=2){let[b,N]=Bt(r,e),P=gt(r,e,s,b,N),{fv:w}=yt(t,e);return{j:A(o/(P.y*w-P.y1),-P.e2),y:{m:P.y,e2:P.e2}}}let{fv:a,sign:i}=yt(t,e);if(e>=t&&t>2){let{p:b,q:N}=Pt(t,e),P=t/e-a,w=(b-P)/N;w===0&&(w=t*y/e);let Y=i*Math.sqrt(o/(N+w*(b-P)));return{j:Y,y:{m:w*Y,e2:0}}}let c=g,l=a*i*c,f=i*c,m=0;for(let b=s;b>0;b--){let N=2*(r+b)/e;Math.abs(f)>2**900&&(l*=2**-900,f*=2**-900,m+=900);let P=N*f-l;P===0&&(P=l*y/2),l=f,f=P}let u=A(i*c/f,-m),M=l/f,{p,q:h}=Pt(r,e),S=r/e-M,k=(p-S)/h;k===0&&(k=r*y/e);let I=Math.sign(f)*Math.sqrt(o/(h+k*(p-S))),F=I*u,R=k*I,X=R*(r/e-p-h/k);if(!n)return{j:F,y:{m:NaN,e2:0}};let B=gt(r,e,s,R,X);return{j:F,y:{m:B.y,e2:B.e2}}}function Ht(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let n=Math.abs(e),s=e<0&&e!==Math.floor(e);if(t===0)return e===0?1:s?d(n)>0?1/0:-1/0:0;if(t===1/0)return 0;if(!s){let o=tt(n,t,!1).j;return e<0&&n%2===1?-o:o}let r=tt(n,t,!0);return Q(n)*r.j-A(d(n)*r.y.m,r.y.e2)}function $t(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let n=Math.abs(e),s=e<0;if(t===0){if(!s)return-1/0;let i=Q(n);return i===0?0:i>0?-1/0:1/0}if(t===1/0)return 0;let r=tt(n,t,!0);if(!s)return A(r.y.m,r.y.e2);let o=Q(n),a=d(n);return(a!==0?a*r.j:0)+(o===0?0:A(o*r.y.m,r.y.e2))}function zt(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||!(e>0))return{lower:NaN,upper:NaN,logLower:NaN,logUpper:NaN};let n=_(e),s=q(e),r=l=>{let f=v(e,t,l,!1),m=s*f;if(Number.isFinite(s)&&f>kt&&Number.isFinite(m)&&m>kt)return[m,Math.log(m)];let u=n+v(e,t,l,!0);return u<710&&u>-746&&t>0&&(l?t<e:t>e)?vt(t,e,l):[Math.exp(u),u]},[o,a]=r(!0),[i,c]=r(!1);return{lower:o,upper:i,logLower:a,logUpper:c}}var kt=22250738585072014e-324;function vt(t,e,n){let s=j(at(L([t,0]),e),[-t,0]);n?s=j(s,L([mt(e,t)/e,0])):s=j(s,L([ut(e,t),0]));let r=s[0]+s[1];return[s[0]>-708?Math.exp(s[0])*(1+s[1]):Math.exp(r),r]}function et(t){return Number.isNaN(t)||t<0||t>2?NaN:-ft(t/2)*Math.SQRT1_2}function xt(t){if(Number.isNaN(t)||t<-1||t>1)return NaN;let e=t<0?-1:1,n=Math.abs(t);if(n>=.5)return e*et(1-n);if(n<1e-8)return t*.886226925452758*(1+Math.PI/12*t*t);let s=et(1-n);for(let r=0;r<3;r++){let o=($(s)-n)/(1.1283791670955126*Math.exp(-s*s));if(s-=o,Math.abs(o)<=1e-17*s)break}return e*s}function te(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||e<0)return NaN;let n=e===Math.floor(e);return t===Math.floor(t)&&n&&e>t?0:!Number.isFinite(t)||!Number.isFinite(e)?ie(t,e):n&&e<=1e3?ee(t,e):ne(t,e)}function ee(t,e){let n=[1,0];for(let s=0;s<e;s++){let r=E(t,-s),o=n[0]*r[0];if(!Number.isFinite(o)){let a=Math.sign(o);for(let i=s+1;i<e;i++)t-i<0&&(a=-a);return a*(1/0)}n=Math.abs(n[0])>1e290||Math.abs(r[0])>1e290?[(n[0]+n[1])*(r[0]+r[1]),0]:J(n,r)}return n[0]+n[1]}function ne(t,e){let[n,s]=E(t,-e);if(n+1<=0)return re(t,n,s);if(t>1e280)return e*e<1e-17*t?Math.pow(t,e):1/0;let r;if(n>=15){if(e*Math.log(n+1)>720)return 1/0;let o=E(t,-n),a=T(J(o,L([t,0])),ct(n,[t,0]));a=j(a,[Z(t)-Z(n),0]),r=Math.sqrt(t/n)*Math.exp(a[0])*(1+a[1])}else if(t<30)r=q(t+1)/q(n+1);else{if(_(t+1)-_(n+1)>720)return 1/0;let o=T(nt(t+1),L([q(n+1),0]));r=Math.exp(o[0])*(1+o[1])}return s!==0&&Number.isFinite(r)&&r!==0&&(r*=Math.exp(-s*G(n+1))),r}function re(t,e,n){let s=j(E(e,1),[n,0]),r=d(s[0])+d(s[0]+.5)*Math.PI*s[1];if(r===0)return 0;let o=Math.sign(r),a=j(T(L([Math.abs(r),0]),oe),[-n*G(-e),0]);if(_(t+1)+_(-e)+a[0]>720)return o*(1/0);let i=j(j(nt(t+1),nt(-e)),a);return o*Math.exp(i[0])*(1+i[1])}var se=[.9189385332046728,-38782941580672414e-33],oe=[1.1447298858494002,10265951162707826e-33];function nt(t){if(t<15)return L([q(t),0]);let e=T(J(E(t,-.5),L([t,0])),[t,0]);return j(j(e,se),[Z(t),0])}function ie(t,e){let n=U(t+1),s=U(t-e+1);return n.sign*s.sign*Math.exp(n.value-s.value)}function ae(t){return Number.isNaN(t)||t<-1?NaN:t===-1||t===1/0?-1/0:lt(t)}function fe(t){return Number.isNaN(t)||t===-1/0?NaN:t===1/0||t<=-1&&t===Math.floor(t)?1/0:C(t)}function ce(t){return Number.isNaN(t)||t<0?NaN:t===0?-1/0:t===1/0?0:ht(-t)}function le(t){return Number.isNaN(t)?NaN:t<=-37?Math.exp(t):t<=18?Math.log1p(Math.exp(t)):t<=33.3?t+Math.exp(-t):t}export{Ct as besselI,Ht as besselJ,Qt as besselK,$t as besselY,Dt as beta,wt as choose,G as digamma,$ as erf,qt as erfc,et as erfcinv,xt as erfinv,_t as factorial,q as gamma,zt as gammainc,Ft as lbeta,Lt as lchoose,Et as lfactorial,_ as lgamma,fe as lgamma1p,ce as log1mexp,le as log1pexp,ae as log1pmx,te as perm,jt as psigamma,St as trigamma};
1
+ /*! rStats.js 0.12.0 | MIT License | includes code ported from SciPy, Boost.Math, statsmodels, LAPACK and others: see THIRD_PARTY_NOTICES.md at https://github.com/numero-uno-jpn/rStats.js */
2
+ import{a as wt,b as Lt,c as _t,d as Et}from"./chunks/chunk-LEIH4U5X.js";import{c as G,d as St,e as jt,j as ht}from"./chunks/chunk-VQHEOBTM.js";import{A as v,C as Dt,D as Ft,b as $,c as qt,h as ft,k as d,l as q,m as U,n as _,o as C,p as Z,q as ct,u as z,v as lt,w as mt,y as ut}from"./chunks/chunk-EDH53DXN.js";import{b as E,d as j,f as T,g as J,h as at,i as O,k as L}from"./chunks/chunk-OX3SBG5X.js";var Mt=22250738585072014e-324;function W(t,e,n){if(t<10)return Math.pow(e/2,t)/q(t+1)*n;let s=e/2,r=z(t,s,!1);if(r>=Mt&&s<700){let a=r*Math.exp(s)*n;if(Math.abs(a)>=Mt)return a}let o=z(t,s,!0)+s+Math.log(Math.abs(n));return Math.sign(n)*Math.exp(o)}var D=Number.EPSILON,H=1e6;function pt(t){return Math.expm1(C(t))}function Tt(t,e){let n=pt(t),s=pt(-t),r=Math.log(e/2),o=Math.exp(t*r),a=-r*t,i=Math.abs(t)<D?1:d(t)/(t*Math.PI),c=Math.abs(a)<D?1:Math.sinh(a)/a,l=Math.abs(t)<D?-.5772156649015329:.5/t*(n-s)*i,f=(2+n+s)*i/2,m=(n+1)/(2*o),u=(1+s)*o/2,M=(Math.cosh(a)*l+c*-r*f)/i,p=m,h=1,S=h*M,k=h*p;for(let I=1;I<H&&(M=(I*M+m+u)/(I*I-t*t),m/=I-t,u/=I+t,p=m-I*M,h*=e*e/(4*I),S+=h*M,k+=h*p,!(Math.abs(h*M)<Math.abs(S)*D));I++);return[S,2*k/e]}function At(t,e){let n=Math.sqrt(Number.MIN_VALUE*4503599627370496),s=n,r=n,o=0;for(let a=1;a<H;a++){let i=2*(t+a)/e;s=i+1/s,o=i+o,s===0&&(s=n),o===0&&(o=n),o=1/o;let c=s*o;if(r*=c,Math.abs(c-1)<=2*D)break}return r}function Jt(t,e){let n=t*t-.25,s=2*(e+1),r=1/s,o=r,a=r,i=0,c=1,l=-n,f=l,m=1+f*a;for(let p=2;p<H;p++){n-=2*(p-1),s+=2,r=1/(s+n*r),a*=s*r-1,o+=a;let h=(i-(s-2)*c)/n;if(i=c,c=h,l*=-n/p,f+=l*h,m+=f*a,h<D&&(l*=h,i/=h,c/=h),Math.abs(f*a)<Math.abs(m)*D)break}let u=(.5+t+e+(t*t-.25)*o)/e,M=Math.sqrt(Math.PI/(2*e))/m;return[M,M*u]}function V(t,e){if(!Number.isFinite(e))return e>0?t*(1/0):t*0;for(;e>1e3;)t*=2**1e3,e-=1e3;for(;e<-1e3;)t*=2**-1e3,e+=1e3;return t*2**e}function bt(t,e){let n=Math.round(t),s=t-n,r,o;if(s===-.5)r=o=Math.sqrt(Math.PI/(2*e));else if(e<=2){let[i,c]=Tt(s,e),l=Math.exp(e);r=i*l,o=c*l}else[r,o]=Jt(s,e);let a=0;for(let i=1;i<=n;i++){let c=2*(s+i)/e,l=Math.log2(Math.abs(o))+Math.log2(c);if(l>900&&Number.isFinite(l)){let m=Math.ceil(l-800);r=V(r,-m),o=V(o,-m),a+=m}let f=c*o+r;r=o,o=f}return{k:r,k1:o,exp2:a}}function Kt(t,e){let n=e*e/4,s=1,r=0;for(let o=1;o<H&&(r+=s,s*=n/o,s/=o+t,!(Math.abs(s)<=D*Math.abs(r)));o++);return W(t,e,r+s)}function Rt(t,e,n){if(t===0||!Number.isFinite(t))return t;let s=t,r=e,o=n>0?700:-700,a=Math.exp(o);for(;Math.abs(n)>700;){n-=o,s*=a;let i=Math.floor(Math.log2(Math.abs(s)));s=V(s,-i),r+=i}return V(s*Math.exp(n),r)}function x(t,e,n){let s=t.ex+n;return s===0?V(t.m,t.e2):Rt(t.m,t.e2,s*e)}function Yt(t,e){if(t===.5)return{m:Math.sqrt(2/(e*Math.PI))*(-Math.expm1(-2*e)/2),e2:0,ex:1};if(t>0&&e/t<.25)return{m:Kt(t,e),e2:0,ex:0};let n=(4*t*t+10)/(8*e);if(n*=n,n*=n,n/=24,n<D*10&&e>100){let i=4*t*t,c=8*e,l=i-1,f=c,m=1-l/f;return l*=i-9,f*=c*2,m+=l/f,l*=i-25,f*=c*3,m-=l/f,{m:m/Math.sqrt(2*e*Math.PI),e2:0,ex:1}}let{k:s,k1:r,exp2:o}=bt(t,e),a=At(t,e);return{m:1/(e*(s*a+r)),e2:-o,ex:1}}function Nt(t,e){let n=4*t*t,s=8*e,r=(n-1)/s,o=r*(n-9)/(2*s),a=o*(n-25)/(3*s),i=a*(n-49)/(4*s),c=1+r+o+a;if(Math.abs(i)<D*Math.abs(c))return{m:c*Math.sqrt(Math.PI)/Math.sqrt(2*e),e2:0,ex:-1};let{k:l,exp2:f}=bt(t,e);return{m:l,e2:f,ex:-1}}function Ct(t,e,n={}){let s=n.exponScaled??!1;if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let r=Math.abs(e),o=e<0&&e!==Math.floor(e);if(t===0)return o?d(r)>0?1/0:-1/0:e===0?1:0;if(t===1/0)return s?0:1/0;let a=s?-1:0,i=x(Yt(r,t),t,a);if(!o)return i;let c=Nt(r,t);return i+x({...c,m:2/Math.PI*d(r)*c.m},t,a)}function Qt(t,e,n={}){let s=n.exponScaled??!1;if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let r=Math.abs(e);return t===0?1/0:t===1/0?0:x(Nt(r,t),t,s?1:0)}var y=Number.EPSILON;function A(t,e){if(!Number.isFinite(e))return e>0?t*(1/0):t*0;for(;e>1e3;)t*=2**1e3,e-=1e3;for(;e<-1e3;)t*=2**-1e3,e+=1e3;return t*2**e}function gt(t,e,n,s,r){let o=s,a=r,i=0;for(let c=1;c<=n;c++){let l=2*(t+c)/e,f=Math.log2(Math.abs(a))+Math.log2(l);if(f>900&&Number.isFinite(f)){let u=Math.ceil(f-800);o=A(o,-u),a=A(a,-u),i+=u}let m=l*a-o;o=a,a=m}return{y:o,y1:a,e2:i}}var K=1e6,g=Math.sqrt(22250738585072014e-324),Ut=Number.MAX_VALUE;function It(t){return Math.expm1(C(t))}function Q(t){return d(.5-Math.abs(t%2))}function dt(t,e){let n=-(e/2)*(e/2),s=1,r=0;for(let o=1;o<K&&(r+=s,s*=n/(o*(o+t)),!(Math.abs(s)<=y*Math.abs(r)));o++);return W(t,e,r+s)}function Vt(t,e){let n=Math.log(e/2),s=0,r=t>=170||709.78/t<Math.abs(n),o;if(r){let u=_(t);if(n=t*n,o=u-Math.log(Math.PI)-n,709.78<o){let M=Math.ceil((o-700)/Math.LN2);o-=M*Math.LN2,s=M}o=-Math.exp(o)}else{let u=q(t);n=Math.pow(e/2,t),Ut*n<u&&(u*=2**-1e3,s=1e3),o=-u/(Math.PI*n)}let a=-(e/2)*(e/2),i=1,c=0;for(let u=1;u<K&&(c+=i,i*=a/(u*(u-t)),!(Math.abs(i)<=y*Math.abs(c)));u++);let l=(c+i)*o,f;if(!r)f=q(-t)*Q(t)*n/Math.PI;else{let u=U(-t);f=Math.exp(u.value+n)*u.sign/Math.PI}i=1;let m=0;for(let u=1;u<K&&(m+=i,i*=a/(u*(u+t)),!(Math.abs(i)<=y*Math.abs(m)));u++);return m+=i,l-=A(f*m,-s),{m:l,e2:s}}function Xt(t,e){let n=1,s=0,r=1,o=8*e,a=1,i=4*t*t,c=1,l=!0;do{c*=(i-a*a)/(r*o),s+=c,r+=1,a+=2;let f=(a*a-i)/(r*o);l=Math.abs(f)<.5,c*=f,n+=c,r+=1,a+=2}while(Math.abs(c)>2*y*n&&l);return l?{p:n,q:s}:void 0}function Bt(t,e){let n=It(t),s=It(-t),r=d(t),o=d(t/2),a=Math.pow(e/2,t),i=Math.log(e/2),c=-i*t,l=Math.abs(c)<y?1:Math.sinh(c)/c,f=Math.abs(t)<y?t*Math.PI*Math.PI/2:2*o*o/t,m=t===0?-.5772156649015329:(n-s)/((1+n)*(1+s)*2*t),u=(2+n+s)/((1+n)*(1+s)*2),M=Math.abs(t)<y?1/Math.PI:t/r,p=(m*Math.cosh(c)-u*i*l)*2*M,h=M/(a*(1+s)),S=M*a/(1+n),k=p+f*S,I=h,F=1,R=F*k,X=F*I,B=t*t,b=-e*e/4;for(let N=1;N<K&&(p=(N*p+h+S)/(N*N-B),h/=N-t,S/=N+t,k=p+f*S,I=h-N*k,F*=b/N,R+=F*k,X+=F*I,!(Math.abs(F*k)<Math.abs(R)*y));N++);return[-R,-2*X/e]}function Ot(t,e){let n=[g,0],s=[g,0],r=[0,0],o=1,a=[e,0];for(let i=1;i<K*100;i++){let c=E(t,i),l=O([2*c[0],2*c[1]],a);n=T(l,O([1,0],n)),r=T(l,r),n[0]===0&&(n=[g,0]),r[0]===0&&(r=[g,0]),r=O([1,0],r);let f=J(n,r);if(s=J(s,f),r[0]<0&&(o=-o),Math.abs(f[0]-1+f[1])<y*y)break}return{fv:-(s[0]+s[1]),sign:o}}function yt(t,e){if(e>30)return Ot(t,e);let n=g,s=g,r=0,o=1;for(let a=1;a<K*100;a++){let i=2*(t+a)/e;n=i-1/n,r=i-r,n===0&&(n=g),r===0&&(r=g),r=1/r;let c=n*r;if(s*=c,r<0&&(o=-o),Math.abs(c-1)<2*y)break}return{fv:-s,sign:o}}function Pt(t,e){let n=-.5/e,s=1,r=n,o=s,a=t*t,i=(.25-a)/e,c=2*e,l=2,f=r*r+1;o=l+i*r/f,r=c+i/f;let m=c,u=l;Math.abs(r)+Math.abs(o)<g&&(r=g),Math.abs(m)+Math.abs(u)<g&&(m=g),f=m*m+u*u,m=m/f,u=-u/f;let M=r*m-o*u,p=o*m+r*u;f=n,n=f*M-s*p,s=f*p+s*M;for(let h=2;h<K&&(i=h-.5,i*=i,i-=a,l+=2,f=r*r+o*o,r=c+i*r/f,o=l-i*o/f,m=c+i*m,u=l+i*u,Math.abs(r)+Math.abs(o)<g&&(r=g),Math.abs(m)+Math.abs(u)<g&&(m=g),f=m*m+u*u,m=m/f,u=-u/f,M=r*m-o*u,p=o*m+r*u,f=n,n=f*M-s*p,s=f*p+s*M,!(Math.abs(M-1)+Math.abs(p)<2*y));h++);return{p:n,q:s}}function Zt(t,e){let n=1,s=4*t*t,r=2*e;return r*=r,n+=(s-1)/(2*r),n+=3*(s-1)*(s-9)/(r*r*8),n+=15*(s-1)*(s-9)*(s-25)/(r*r*r*8*6),Math.sqrt(n*2/(Math.PI*e))}function Gt(t,e){let n=4*t*t,s=4*e,r=s*s,o=0;return o+=(n-1)/(2*s),s*=r,o+=(n-1)*(n-25)/(6*s),s*=r,o+=(n-1)*(n*n-114*n+1073)/(5*s),s*=r,o+=(n-1)*(5*n*n*n-1535*n*n+54703*n-375733)/(14*s),o}function Wt(t,e){let n=Zt(t,e),s=Gt(t,e),r=Math.cos(e),o=Math.sin(e),a=Q(t/2+.25),i=d(t/2+.25),c=Math.sin(s),l=Math.cos(s),f=(c*(r*a+o*i)+l*(o*a-r*i))*n;return{j:(l*(r*a+o*i)-c*(o*a-r*i))*n,y:f}}function tt(t,e,n){let s=Math.round(t),r=t-s,o=2/(e*Math.PI);if(!n&&(e<5||t>e*e/4))return{j:dt(t,e),y:{m:NaN,e2:0}};if(e<1&&r!==0&&Math.log(y/2)>t*Math.log(e/2*(e/2)/t))return{j:dt(t,e),y:Vt(t,e)};if(Math.max(t,1)<e*.011048543456039806){let b=Wt(t,e);return{j:b.j,y:{m:b.y,e2:0}}}if(e>8){let b=Xt(t,e);if(b!==void 0){let N=(t/2+.25)%2,P=Math.sin(e),w=Math.cos(e),Y=d(N),rt=Q(N),st=P*rt-Y*w,ot=w*rt+P*Y,it=Math.SQRT2/(Math.sqrt(Math.PI)*Math.sqrt(e));return{j:it*(b.p*ot-b.q*st),y:{m:it*(b.p*st+b.q*ot),e2:0}}}}if(e<=2){let[b,N]=Bt(r,e),P=gt(r,e,s,b,N),{fv:w}=yt(t,e);return{j:A(o/(P.y*w-P.y1),-P.e2),y:{m:P.y,e2:P.e2}}}let{fv:a,sign:i}=yt(t,e);if(e>=t&&t>2){let{p:b,q:N}=Pt(t,e),P=t/e-a,w=(b-P)/N;w===0&&(w=t*y/e);let Y=i*Math.sqrt(o/(N+w*(b-P)));return{j:Y,y:{m:w*Y,e2:0}}}let c=g,l=a*i*c,f=i*c,m=0;for(let b=s;b>0;b--){let N=2*(r+b)/e;Math.abs(f)>2**900&&(l*=2**-900,f*=2**-900,m+=900);let P=N*f-l;P===0&&(P=l*y/2),l=f,f=P}let u=A(i*c/f,-m),M=l/f,{p,q:h}=Pt(r,e),S=r/e-M,k=(p-S)/h;k===0&&(k=r*y/e);let I=Math.sign(f)*Math.sqrt(o/(h+k*(p-S))),F=I*u,R=k*I,X=R*(r/e-p-h/k);if(!n)return{j:F,y:{m:NaN,e2:0}};let B=gt(r,e,s,R,X);return{j:F,y:{m:B.y,e2:B.e2}}}function Ht(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let n=Math.abs(e),s=e<0&&e!==Math.floor(e);if(t===0)return e===0?1:s?d(n)>0?1/0:-1/0:0;if(t===1/0)return 0;if(!s){let o=tt(n,t,!1).j;return e<0&&n%2===1?-o:o}let r=tt(n,t,!0);return Q(n)*r.j-A(d(n)*r.y.m,r.y.e2)}function $t(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||!Number.isFinite(e))return NaN;let n=Math.abs(e),s=e<0;if(t===0){if(!s)return-1/0;let i=Q(n);return i===0?0:i>0?-1/0:1/0}if(t===1/0)return 0;let r=tt(n,t,!0);if(!s)return A(r.y.m,r.y.e2);let o=Q(n),a=d(n);return(a!==0?a*r.j:0)+(o===0?0:A(o*r.y.m,r.y.e2))}function zt(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||!(e>0))return{lower:NaN,upper:NaN,logLower:NaN,logUpper:NaN};let n=_(e),s=q(e),r=l=>{let f=v(e,t,l,!1),m=s*f;if(Number.isFinite(s)&&f>kt&&Number.isFinite(m)&&m>kt)return[m,Math.log(m)];let u=n+v(e,t,l,!0);return u<710&&u>-746&&t>0&&(l?t<e:t>e)?vt(t,e,l):[Math.exp(u),u]},[o,a]=r(!0),[i,c]=r(!1);return{lower:o,upper:i,logLower:a,logUpper:c}}var kt=22250738585072014e-324;function vt(t,e,n){let s=j(at(L([t,0]),e),[-t,0]);n?s=j(s,L([mt(e,t)/e,0])):s=j(s,L([ut(e,t),0]));let r=s[0]+s[1];return[s[0]>-708?Math.exp(s[0])*(1+s[1]):Math.exp(r),r]}function et(t){return Number.isNaN(t)||t<0||t>2?NaN:-ft(t/2)*Math.SQRT1_2}function xt(t){if(Number.isNaN(t)||t<-1||t>1)return NaN;let e=t<0?-1:1,n=Math.abs(t);if(n>=.5)return e*et(1-n);if(n<1e-8)return t*.886226925452758*(1+Math.PI/12*t*t);let s=et(1-n);for(let r=0;r<3;r++){let o=($(s)-n)/(1.1283791670955126*Math.exp(-s*s));if(s-=o,Math.abs(o)<=1e-17*s)break}return e*s}function te(t,e){if(Number.isNaN(t)||Number.isNaN(e)||t<0||e<0)return NaN;let n=e===Math.floor(e);return t===Math.floor(t)&&n&&e>t?0:!Number.isFinite(t)||!Number.isFinite(e)?ie(t,e):n&&e<=1e3?ee(t,e):ne(t,e)}function ee(t,e){let n=[1,0];for(let s=0;s<e;s++){let r=E(t,-s),o=n[0]*r[0];if(!Number.isFinite(o)){let a=Math.sign(o);for(let i=s+1;i<e;i++)t-i<0&&(a=-a);return a*(1/0)}n=Math.abs(n[0])>1e290||Math.abs(r[0])>1e290?[(n[0]+n[1])*(r[0]+r[1]),0]:J(n,r)}return n[0]+n[1]}function ne(t,e){let[n,s]=E(t,-e);if(n+1<=0)return re(t,n,s);if(t>1e280)return e*e<1e-17*t?Math.pow(t,e):1/0;let r;if(n>=15){if(e*Math.log(n+1)>720)return 1/0;let o=E(t,-n),a=T(J(o,L([t,0])),ct(n,[t,0]));a=j(a,[Z(t)-Z(n),0]),r=Math.sqrt(t/n)*Math.exp(a[0])*(1+a[1])}else if(t<30)r=q(t+1)/q(n+1);else{if(_(t+1)-_(n+1)>720)return 1/0;let o=T(nt(t+1),L([q(n+1),0]));r=Math.exp(o[0])*(1+o[1])}return s!==0&&Number.isFinite(r)&&r!==0&&(r*=Math.exp(-s*G(n+1))),r}function re(t,e,n){let s=j(E(e,1),[n,0]),r=d(s[0])+d(s[0]+.5)*Math.PI*s[1];if(r===0)return 0;let o=Math.sign(r),a=j(T(L([Math.abs(r),0]),oe),[-n*G(-e),0]);if(_(t+1)+_(-e)+a[0]>720)return o*(1/0);let i=j(j(nt(t+1),nt(-e)),a);return o*Math.exp(i[0])*(1+i[1])}var se=[.9189385332046728,-38782941580672414e-33],oe=[1.1447298858494002,10265951162707826e-33];function nt(t){if(t<15)return L([q(t),0]);let e=T(J(E(t,-.5),L([t,0])),[t,0]);return j(j(e,se),[Z(t),0])}function ie(t,e){let n=U(t+1),s=U(t-e+1);return n.sign*s.sign*Math.exp(n.value-s.value)}function ae(t){return Number.isNaN(t)||t<-1?NaN:t===-1||t===1/0?-1/0:lt(t)}function fe(t){return Number.isNaN(t)||t===-1/0?NaN:t===1/0||t<=-1&&t===Math.floor(t)?1/0:C(t)}function ce(t){return Number.isNaN(t)||t<0?NaN:t===0?-1/0:t===1/0?0:ht(-t)}function le(t){return Number.isNaN(t)?NaN:t<=-37?Math.exp(t):t<=18?Math.log1p(Math.exp(t)):t<=33.3?t+Math.exp(-t):t}export{Ct as besselI,Ht as besselJ,Qt as besselK,$t as besselY,Dt as beta,wt as choose,G as digamma,$ as erf,qt as erfc,et as erfcinv,xt as erfinv,_t as factorial,q as gamma,zt as gammainc,Ft as lbeta,Lt as lchoose,Et as lfactorial,_ as lgamma,fe as lgamma1p,ce as log1mexp,le as log1pexp,ae as log1pmx,te as perm,jt as psigamma,St as trigamma};