@numero-uno-jpn/rstats 0.0.0-stage → 0.6.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.
- package/CHANGELOG.md +144 -0
- package/LICENSE +21 -0
- package/README.ja.md +197 -0
- package/README.md +188 -2
- package/THIRD_PARTY_NOTICES.md +317 -0
- package/dist/chunks/chunk-2JCIB5H2.js +2 -0
- package/dist/chunks/chunk-7JVSDGQQ.js +2 -0
- package/dist/chunks/chunk-7NK4SA6B.js +2 -0
- package/dist/chunks/chunk-AJYQNFXK.js +2 -0
- package/dist/chunks/chunk-DRNMIEYH.js +2 -0
- package/dist/chunks/chunk-NAYDS7CL.js +2 -0
- package/dist/chunks/chunk-NOCEAM44.js +2 -0
- package/dist/chunks/chunk-QNAIK4PY.js +2 -0
- package/dist/chunks/chunk-TPC6MTYC.js +2 -0
- package/dist/chunks/chunk-UGUQYWRQ.js +2 -0
- package/dist/chunks/chunk-XM2TVD63.js +2 -0
- package/dist/chunks/chunk-Y4IZV7XK.js +2 -0
- package/dist/chunks/chunk-ZWJ42QN6.js +2 -0
- package/dist/descriptive/basic.d.ts +73 -0
- package/dist/descriptive/basic.js +256 -0
- package/dist/descriptive/cov.d.ts +39 -0
- package/dist/descriptive/cov.js +105 -0
- package/dist/descriptive/hist.d.ts +64 -0
- package/dist/descriptive/hist.js +304 -0
- package/dist/descriptive/moments.d.ts +63 -0
- package/dist/descriptive/moments.js +158 -0
- package/dist/descriptive/quantile.d.ts +50 -0
- package/dist/descriptive/quantile.js +131 -0
- package/dist/descriptive/rank.d.ts +23 -0
- package/dist/descriptive/rank.js +72 -0
- package/dist/descriptive/table.d.ts +54 -0
- package/dist/descriptive/table.js +160 -0
- package/dist/descriptive.js +2 -0
- package/dist/distributions/arcsine.d.ts +24 -0
- package/dist/distributions/arcsine.js +73 -0
- package/dist/distributions/beta.d.ts +62 -0
- package/dist/distributions/beta.js +246 -0
- package/dist/distributions/binomial.d.ts +41 -0
- package/dist/distributions/binomial.js +136 -0
- package/dist/distributions/cauchy.d.ts +34 -0
- package/dist/distributions/cauchy.js +139 -0
- package/dist/distributions/chisq.d.ts +42 -0
- package/dist/distributions/chisq.js +60 -0
- package/dist/distributions/exponential.d.ts +34 -0
- package/dist/distributions/exponential.js +93 -0
- package/dist/distributions/f.d.ts +47 -0
- package/dist/distributions/f.js +214 -0
- package/dist/distributions/gamma.d.ts +61 -0
- package/dist/distributions/gamma.js +188 -0
- package/dist/distributions/geometric.d.ts +38 -0
- package/dist/distributions/geometric.js +116 -0
- package/dist/distributions/hypergeometric.d.ts +38 -0
- package/dist/distributions/hypergeometric.js +234 -0
- package/dist/distributions/invgamma.d.ts +29 -0
- package/dist/distributions/invgamma.js +85 -0
- package/dist/distributions/kumaraswamy.d.ts +17 -0
- package/dist/distributions/kumaraswamy.js +96 -0
- package/dist/distributions/laplace.d.ts +23 -0
- package/dist/distributions/laplace.js +69 -0
- package/dist/distributions/logistic.d.ts +36 -0
- package/dist/distributions/logistic.js +94 -0
- package/dist/distributions/lognormal.d.ts +39 -0
- package/dist/distributions/lognormal.js +158 -0
- package/dist/distributions/multinomial.d.ts +24 -0
- package/dist/distributions/multinomial.js +70 -0
- package/dist/distributions/nbeta.d.ts +7 -0
- package/dist/distributions/nbeta.js +330 -0
- package/dist/distributions/nchisq.d.ts +3 -0
- package/dist/distributions/nchisq.js +234 -0
- package/dist/distributions/negbinomial.d.ts +54 -0
- package/dist/distributions/negbinomial.js +325 -0
- package/dist/distributions/normal.d.ts +66 -0
- package/dist/distributions/normal.js +184 -0
- package/dist/distributions/nt.d.ts +3 -0
- package/dist/distributions/nt.js +491 -0
- package/dist/distributions/pareto.d.ts +23 -0
- package/dist/distributions/pareto.js +76 -0
- package/dist/distributions/poisson.d.ts +41 -0
- package/dist/distributions/poisson.js +104 -0
- package/dist/distributions/signrank.d.ts +38 -0
- package/dist/distributions/signrank.js +216 -0
- package/dist/distributions/summary.d.ts +25 -0
- package/dist/distributions/summary.js +289 -0
- package/dist/distributions/t.d.ts +49 -0
- package/dist/distributions/t.js +235 -0
- package/dist/distributions/triangular.d.ts +25 -0
- package/dist/distributions/triangular.js +87 -0
- package/dist/distributions/tukey.d.ts +43 -0
- package/dist/distributions/tukey.js +985 -0
- package/dist/distributions/uniform.d.ts +36 -0
- package/dist/distributions/uniform.js +90 -0
- package/dist/distributions/weibull.d.ts +37 -0
- package/dist/distributions/weibull.js +125 -0
- package/dist/distributions/wilcox.d.ts +47 -0
- package/dist/distributions/wilcox.js +270 -0
- package/dist/distributions.js +2 -0
- package/dist/entries/descriptive.d.ts +7 -0
- package/dist/entries/descriptive.js +8 -0
- package/dist/entries/distributions.d.ts +41 -0
- package/dist/entries/distributions.js +41 -0
- package/dist/entries/linalg.d.ts +11 -0
- package/dist/entries/linalg.js +11 -0
- package/dist/entries/numerics.d.ts +8 -0
- package/dist/entries/numerics.js +6 -0
- package/dist/entries/special.d.ts +9 -0
- package/dist/entries/special.js +9 -0
- package/dist/entries/tests.d.ts +21 -0
- package/dist/entries/tests.js +20 -0
- package/dist/htest/ansariTest.d.ts +13 -0
- package/dist/htest/ansariTest.js +80 -0
- package/dist/htest/aov.d.ts +85 -0
- package/dist/htest/aov.js +178 -0
- package/dist/htest/binomTest.d.ts +36 -0
- package/dist/htest/binomTest.js +121 -0
- package/dist/htest/chisqTest.d.ts +55 -0
- package/dist/htest/chisqTest.js +160 -0
- package/dist/htest/cor.d.ts +95 -0
- package/dist/htest/cor.js +437 -0
- package/dist/htest/core/ansari.d.ts +18 -0
- package/dist/htest/core/ansari.js +121 -0
- package/dist/htest/core/kolmogorov.d.ts +26 -0
- package/dist/htest/core/kolmogorov.js +221 -0
- package/dist/htest/core/mantelhaen.d.ts +26 -0
- package/dist/htest/core/mantelhaen.js +145 -0
- package/dist/htest/core/shapiro.d.ts +24 -0
- package/dist/htest/core/shapiro.js +142 -0
- package/dist/htest/core/smirnov.d.ts +20 -0
- package/dist/htest/core/smirnov.js +75 -0
- package/dist/htest/fisherTest.d.ts +48 -0
- package/dist/htest/fisherTest.js +482 -0
- package/dist/htest/groups.d.ts +20 -0
- package/dist/htest/groups.js +62 -0
- package/dist/htest/ksTest.d.ts +31 -0
- package/dist/htest/ksTest.js +106 -0
- package/dist/htest/mantelhaenTest.d.ts +26 -0
- package/dist/htest/mantelhaenTest.js +196 -0
- package/dist/htest/mcnemarTest.d.ts +26 -0
- package/dist/htest/mcnemarTest.js +99 -0
- package/dist/htest/onewayTest.d.ts +26 -0
- package/dist/htest/onewayTest.js +97 -0
- package/dist/htest/pAdjust.d.ts +34 -0
- package/dist/htest/pAdjust.js +147 -0
- package/dist/htest/pairwise.d.ts +64 -0
- package/dist/htest/pairwise.js +152 -0
- package/dist/htest/poissonTest.d.ts +35 -0
- package/dist/htest/poissonTest.js +170 -0
- package/dist/htest/propTest.d.ts +37 -0
- package/dist/htest/propTest.js +164 -0
- package/dist/htest/rankTests.d.ts +52 -0
- package/dist/htest/rankTests.js +234 -0
- package/dist/htest/tTest.d.ts +57 -0
- package/dist/htest/tTest.js +153 -0
- package/dist/htest/types.d.ts +51 -0
- package/dist/htest/types.js +26 -0
- package/dist/htest/varTest.d.ts +48 -0
- package/dist/htest/varTest.js +118 -0
- package/dist/htest/wilcoxTest.d.ts +61 -0
- package/dist/htest/wilcoxTest.js +433 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/integrate/quadpack.d.ts +29 -0
- package/dist/integrate/quadpack.js +525 -0
- package/dist/internal/ddexp.d.ts +19 -0
- package/dist/internal/ddexp.js +94 -0
- package/dist/internal/discrete.d.ts +14 -0
- package/dist/internal/discrete.js +85 -0
- package/dist/internal/dpq.d.ts +43 -0
- package/dist/internal/dpq.js +54 -0
- package/dist/internal/integer.d.ts +4 -0
- package/dist/internal/integer.js +17 -0
- package/dist/internal/invert.d.ts +36 -0
- package/dist/internal/invert.js +124 -0
- package/dist/internal/noncentral.d.ts +12 -0
- package/dist/internal/noncentral.js +2 -0
- package/dist/internal/poissonMixture.d.ts +31 -0
- package/dist/internal/poissonMixture.js +401 -0
- package/dist/internal/seq.d.ts +5 -0
- package/dist/internal/seq.js +14 -0
- package/dist/internal/summary.d.ts +21 -0
- package/dist/internal/summary.js +125 -0
- package/dist/internal/uniroot.d.ts +11 -0
- package/dist/internal/uniroot.js +14 -0
- package/dist/internal/vectorize.d.ts +12 -0
- package/dist/internal/vectorize.js +7 -0
- package/dist/linalg/basic.d.ts +95 -0
- package/dist/linalg/basic.js +152 -0
- package/dist/linalg/chol.d.ts +83 -0
- package/dist/linalg/chol.js +200 -0
- package/dist/linalg/eigen.d.ts +52 -0
- package/dist/linalg/eigen.js +753 -0
- package/dist/linalg/kappa.d.ts +51 -0
- package/dist/linalg/kappa.js +199 -0
- package/dist/linalg/lu.d.ts +45 -0
- package/dist/linalg/lu.js +88 -0
- package/dist/linalg/matrix.d.ts +29 -0
- package/dist/linalg/matrix.js +65 -0
- package/dist/linalg/norm.d.ts +32 -0
- package/dist/linalg/norm.js +92 -0
- package/dist/linalg/ops.d.ts +90 -0
- package/dist/linalg/ops.js +320 -0
- package/dist/linalg/qr.d.ts +264 -0
- package/dist/linalg/qr.js +494 -0
- package/dist/linalg/solve.d.ts +123 -0
- package/dist/linalg/solve.js +380 -0
- package/dist/linalg/svd.d.ts +38 -0
- package/dist/linalg/svd.js +275 -0
- package/dist/linalg.js +2 -0
- package/dist/models/lm.d.ts +98 -0
- package/dist/models/lm.js +187 -0
- package/dist/numerics/deriv.d.ts +37 -0
- package/dist/numerics/deriv.js +150 -0
- package/dist/numerics/integrate.d.ts +91 -0
- package/dist/numerics/integrate.js +264 -0
- package/dist/numerics/interp.d.ts +103 -0
- package/dist/numerics/interp.js +581 -0
- package/dist/numerics/ode.d.ts +23 -0
- package/dist/numerics/ode.js +59 -0
- package/dist/numerics.js +2 -0
- package/dist/optim/localmin.d.ts +16 -0
- package/dist/optim/localmin.js +97 -0
- package/dist/random/as241.d.ts +2 -0
- package/dist/random/as241.js +58 -0
- package/dist/random/beta.d.ts +14 -0
- package/dist/random/beta.js +117 -0
- package/dist/random/binomial.d.ts +25 -0
- package/dist/random/binomial.js +224 -0
- package/dist/random/common.d.ts +4 -0
- package/dist/random/common.js +35 -0
- package/dist/random/continuous.d.ts +91 -0
- package/dist/random/continuous.js +138 -0
- package/dist/random/extra.d.ts +33 -0
- package/dist/random/extra.js +62 -0
- package/dist/random/gamma.d.ts +52 -0
- package/dist/random/gamma.js +217 -0
- package/dist/random/hyper.d.ts +12 -0
- package/dist/random/hyper.js +240 -0
- package/dist/random/mt.d.ts +16 -0
- package/dist/random/mt.js +96 -0
- package/dist/random/poisson.d.ts +33 -0
- package/dist/random/poisson.js +203 -0
- package/dist/random/rank.d.ts +19 -0
- package/dist/random/rank.js +62 -0
- package/dist/random/rng.d.ts +46 -0
- package/dist/random/rng.js +148 -0
- package/dist/random/sample.d.ts +45 -0
- package/dist/random/sample.js +255 -0
- package/dist/rstats.js +2 -0
- package/dist/special/besselIK.d.ts +38 -0
- package/dist/special/besselIK.js +315 -0
- package/dist/special/besselJY.d.ts +32 -0
- package/dist/special/besselJY.js +508 -0
- package/dist/special/besselSeries.d.ts +8 -0
- package/dist/special/besselSeries.js +24 -0
- package/dist/special/beta.d.ts +30 -0
- package/dist/special/beta.js +169 -0
- package/dist/special/choose.d.ts +75 -0
- package/dist/special/choose.js +233 -0
- package/dist/special/constants.d.ts +16 -0
- package/dist/special/constants.js +19 -0
- package/dist/special/dd.d.ts +29 -0
- package/dist/special/dd.js +693 -0
- package/dist/special/erf.d.ts +35 -0
- package/dist/special/erf.js +112 -0
- package/dist/special/extra.d.ts +47 -0
- package/dist/special/extra.js +220 -0
- package/dist/special/gamma.d.ts +32 -0
- package/dist/special/gamma.js +270 -0
- package/dist/special/igam.d.ts +15 -0
- package/dist/special/igam.js +346 -0
- package/dist/special/igamAsympCoeff.d.ts +4 -0
- package/dist/special/igamAsympCoeff.js +233 -0
- package/dist/special/igami.d.ts +2 -0
- package/dist/special/igami.js +135 -0
- package/dist/special/incbet.d.ts +25 -0
- package/dist/special/incbet.js +381 -0
- package/dist/special/lgammaDiff.d.ts +9 -0
- package/dist/special/lgammaDiff.js +47 -0
- package/dist/special/loader.d.ts +43 -0
- package/dist/special/loader.js +456 -0
- package/dist/special/log1pmx.d.ts +2 -0
- package/dist/special/log1pmx.js +20 -0
- package/dist/special/ndtri.d.ts +4 -0
- package/dist/special/ndtri.js +82 -0
- package/dist/special/polevl.d.ts +4 -0
- package/dist/special/polevl.js +17 -0
- package/dist/special/psigamma.d.ts +48 -0
- package/dist/special/psigamma.js +318 -0
- package/dist/special/rCompatible.d.ts +8 -0
- package/dist/special/rCompatible.js +1 -0
- package/dist/special.js +2 -0
- package/dist/tests.js +2 -0
- package/package.json +93 -4
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
rStats.js contains code ported (translated into TypeScript) from the projects
|
|
4
|
+
listed below. Each ported file names its source at the top.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## xsf
|
|
9
|
+
|
|
10
|
+
- Source: https://github.com/scipy/xsf (commit c6a3afe)
|
|
11
|
+
- Used in: `src/special/beta.ts`, `src/special/constants.ts`, `src/special/erf.ts`, `src/special/gamma.ts`, `src/special/igam.ts`, `src/special/igamAsympCoeff.ts`, `src/special/igami.ts`, `src/special/incbet.ts`, `src/special/log1pmx.ts`, `src/special/ndtri.ts`, `src/special/polevl.ts`, `src/special/psigamma.ts`
|
|
12
|
+
- License: BSD-3-Clause
|
|
13
|
+
- `include/xsf/ndtri_exp.h` (used in `src/special/ndtri.ts`): Copyright Albert Steppi,
|
|
14
|
+
distributed under the same license as SciPy (BSD-3-Clause)
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
BSD 3-Clause License
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2024, SciPy
|
|
20
|
+
|
|
21
|
+
Redistribution and use in source and binary forms, with or without
|
|
22
|
+
modification, are permitted provided that the following conditions are met:
|
|
23
|
+
|
|
24
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
25
|
+
list of conditions and the following disclaimer.
|
|
26
|
+
|
|
27
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
28
|
+
this list of conditions and the following disclaimer in the documentation
|
|
29
|
+
and/or other materials provided with the distribution.
|
|
30
|
+
|
|
31
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
32
|
+
contributors may be used to endorse or promote products derived from
|
|
33
|
+
this software without specific prior written permission.
|
|
34
|
+
|
|
35
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
36
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
37
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
38
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
39
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
40
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
41
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
42
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
43
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
44
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Cephes Math Library (as bundled in xsf)
|
|
50
|
+
|
|
51
|
+
- Source: `include/xsf/cephes/*` in xsf
|
|
52
|
+
- Used in: the files above that cite `include/xsf/cephes/*`
|
|
53
|
+
- License: BSD-3-Clause, distributed with permission from the author
|
|
54
|
+
(see https://lists.debian.org/debian-legal/2004/12/msg00295.html)
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
Distributed under 3-clause BSD license with permission from the author,
|
|
58
|
+
see https://lists.debian.org/debian-legal/2004/12/msg00295.html
|
|
59
|
+
|
|
60
|
+
Cephes Math Library Release 2.8: June, 2000
|
|
61
|
+
Copyright 1984, 1995, 2000 by Stephen L. Moshier
|
|
62
|
+
|
|
63
|
+
This software is derived from the Cephes Math Library and is
|
|
64
|
+
incorporated herein by permission of the author.
|
|
65
|
+
|
|
66
|
+
All rights reserved.
|
|
67
|
+
|
|
68
|
+
Redistribution and use in source and binary forms, with or without
|
|
69
|
+
modification, are permitted provided that the following conditions are met:
|
|
70
|
+
* Redistributions of source code must retain the above copyright
|
|
71
|
+
notice, this list of conditions and the following disclaimer.
|
|
72
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
73
|
+
notice, this list of conditions and the following disclaimer in the
|
|
74
|
+
documentation and/or other materials provided with the distribution.
|
|
75
|
+
* Neither the name of the <organization> nor the
|
|
76
|
+
names of its contributors may be used to endorse or promote products
|
|
77
|
+
derived from this software without specific prior written permission.
|
|
78
|
+
|
|
79
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
80
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
81
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
82
|
+
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
83
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
84
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
85
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
86
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
87
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
88
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Boost.Math
|
|
95
|
+
|
|
96
|
+
- Source: https://github.com/boostorg/math (commit 4a6ce78)
|
|
97
|
+
- `include/boost/math/distributions/non_central_chi_squared.hpp`
|
|
98
|
+
- `include/boost/math/distributions/non_central_t.hpp`
|
|
99
|
+
- Used in: `src/internal/poissonMixture.ts`, `src/distributions/nt.ts` (consulted as a reference for the
|
|
100
|
+
algorithms — Poisson-mixture summation starting near the mode, and the integral
|
|
101
|
+
P[T <= t] = E[Φ(tS - δ)] for the non-central t; the TypeScript code was written independently)
|
|
102
|
+
- License: Boost Software License 1.0
|
|
103
|
+
- Also: the rational approximation of digamma on [1, 2] in `src/special/psigamma.ts`, which xsf's
|
|
104
|
+
`include/xsf/cephes/psi.h` takes from Boost ((C) Copyright John Maddock 2006)
|
|
105
|
+
- Ported (Boost.Math commit 0a0fb4e): `include/boost/math/special_functions/detail/bessel_ik.hpp`,
|
|
106
|
+
`detail/bessel_jy.hpp`, `detail/bessel_jy_series.hpp`, `detail/bessel_jy_asym.hpp` and the
|
|
107
|
+
dispatch in `bessel.hpp`, in `src/special/besselIK.ts` and `src/special/besselJY.ts`
|
|
108
|
+
(Copyright (c) 2006 Xiaogang Zhang, (c) 2007 John Maddock, (c) 2024 Matt Borland)
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
112
|
+
|
|
113
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
114
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
115
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
116
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
117
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
118
|
+
do so, all subject to the following:
|
|
119
|
+
|
|
120
|
+
The copyright notices in the Software and this entire statement, including
|
|
121
|
+
the above license grant, this restriction and the following disclaimer,
|
|
122
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
123
|
+
all derivative works of the Software, unless such copies or derivative
|
|
124
|
+
works are solely in the form of machine-executable object code generated by
|
|
125
|
+
a source language processor.
|
|
126
|
+
|
|
127
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
128
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
129
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
130
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
131
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
132
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
133
|
+
DEALINGS IN THE SOFTWARE.
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Boost.Math: Copyright John Maddock 2008, Matt Borland 2024 (and other contributors).
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## SciPy (scipy.stats, scipy.integrate)
|
|
141
|
+
|
|
142
|
+
- Source: https://github.com/scipy/scipy (commit a087e61)
|
|
143
|
+
- `scipy/stats/_stats_py.py` (ttest_1samp / ttest_ind / ttest_rel, chisquare, pearsonr)
|
|
144
|
+
- `scipy/stats/contingency.py` (chi2_contingency, expected_freq)
|
|
145
|
+
- `scipy/stats/_wilcoxon.py`, `scipy/stats/_mannwhitneyu.py`
|
|
146
|
+
- `scipy/stats/_mstats_basic.py` (kendalltau, `_kendall_p_exact`)
|
|
147
|
+
- Used in: `src/htest/tTest.ts`, `src/htest/chisqTest.ts`, `src/htest/wilcoxTest.ts`, `src/htest/cor.ts`
|
|
148
|
+
- License: BSD-3-Clause
|
|
149
|
+
- Ported (SciPy commit 5ccd743): `scipy/integrate/__quadpack.c`, SciPy's C translation of QUADPACK
|
|
150
|
+
(`dqagse`, `dqagie` and their rules), in `src/integrate/quadpack.ts` (Copyright (C) 2024 SciPy
|
|
151
|
+
developers, BSD-3-Clause; QUADPACK itself is in the public domain, see below)
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
Copyright (c) 2001-2002 Enthought, Inc. 2003, SciPy Developers.
|
|
155
|
+
All rights reserved.
|
|
156
|
+
|
|
157
|
+
Redistribution and use in source and binary forms, with or without
|
|
158
|
+
modification, are permitted provided that the following conditions
|
|
159
|
+
are met:
|
|
160
|
+
|
|
161
|
+
1. Redistributions of source code must retain the above copyright
|
|
162
|
+
notice, this list of conditions and the following disclaimer.
|
|
163
|
+
|
|
164
|
+
2. Redistributions in binary form must reproduce the above
|
|
165
|
+
copyright notice, this list of conditions and the following
|
|
166
|
+
disclaimer in the documentation and/or other materials provided
|
|
167
|
+
with the distribution.
|
|
168
|
+
|
|
169
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
170
|
+
contributors may be used to endorse or promote products derived
|
|
171
|
+
from this software without specific prior written permission.
|
|
172
|
+
|
|
173
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
174
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
175
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
176
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
177
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
178
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
179
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
180
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
181
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
182
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
183
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## statsmodels
|
|
189
|
+
|
|
190
|
+
- Source: https://github.com/statsmodels/statsmodels (commit 5c65604)
|
|
191
|
+
- `statsmodels/stats/multitest.py` (multipletests, method = "hommel")
|
|
192
|
+
- Used in: `src/htest/pAdjust.ts`
|
|
193
|
+
- License: BSD-3-Clause
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
Copyright (C) 2006, Jonathan E. Taylor
|
|
197
|
+
All rights reserved.
|
|
198
|
+
|
|
199
|
+
Copyright (c) 2006-2008 Scipy Developers.
|
|
200
|
+
All rights reserved.
|
|
201
|
+
|
|
202
|
+
Copyright (c) 2009-2018 statsmodels Developers.
|
|
203
|
+
All rights reserved.
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
Redistribution and use in source and binary forms, with or without
|
|
207
|
+
modification, are permitted provided that the following conditions are met:
|
|
208
|
+
|
|
209
|
+
a. Redistributions of source code must retain the above copyright notice,
|
|
210
|
+
this list of conditions and the following disclaimer.
|
|
211
|
+
b. Redistributions in binary form must reproduce the above copyright
|
|
212
|
+
notice, this list of conditions and the following disclaimer in the
|
|
213
|
+
documentation and/or other materials provided with the distribution.
|
|
214
|
+
c. Neither the name of statsmodels nor the names of its contributors
|
|
215
|
+
may be used to endorse or promote products derived from this software
|
|
216
|
+
without specific prior written permission.
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
220
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
221
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
222
|
+
ARE DISCLAIMED. IN NO EVENT SHALL STATSMODELS OR CONTRIBUTORS BE LIABLE FOR
|
|
223
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
224
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
225
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
226
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
227
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
228
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
229
|
+
DAMAGE.
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## LAPACK
|
|
235
|
+
|
|
236
|
+
- Source: https://github.com/Reference-LAPACK/lapack (tag v3.12.0)
|
|
237
|
+
- `BLAS/SRC/dtrsm.f`, `SRC/dlange.f`, `SRC/dpotf2.f`, `SRC/dpstf2.f`, `SRC/dpotri.f` (`dtrti2.f`, `dlauu2.f`),
|
|
238
|
+
`SRC/dgeqp3.f` (`dlaqp2.f`, `dlarfg.f`, `dlarf.f`), `SRC/dorm2r.f`, `SRC/dgetf2.f`, `SRC/dgetrs.f`,
|
|
239
|
+
`SRC/dgecon.f`, `SRC/dtrcon.f`, `SRC/dlacn2.f`
|
|
240
|
+
- Used in: `src/linalg/basic.ts`, `src/linalg/norm.ts`, `src/linalg/chol.ts`, `src/linalg/qr.ts`, `src/linalg/solve.ts`, `src/linalg/svd.ts`
|
|
241
|
+
- License: modified BSD
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
Copyright (c) 1992-2023 The University of Tennessee and The University
|
|
245
|
+
of Tennessee Research Foundation. All rights
|
|
246
|
+
reserved.
|
|
247
|
+
Copyright (c) 2000-2023 The University of California Berkeley. All
|
|
248
|
+
rights reserved.
|
|
249
|
+
Copyright (c) 2006-2023 The University of Colorado Denver. All rights
|
|
250
|
+
reserved.
|
|
251
|
+
|
|
252
|
+
$COPYRIGHT$
|
|
253
|
+
|
|
254
|
+
Additional copyrights may follow
|
|
255
|
+
|
|
256
|
+
$HEADER$
|
|
257
|
+
|
|
258
|
+
Redistribution and use in source and binary forms, with or without
|
|
259
|
+
modification, are permitted provided that the following conditions are
|
|
260
|
+
met:
|
|
261
|
+
|
|
262
|
+
- Redistributions of source code must retain the above copyright
|
|
263
|
+
notice, this list of conditions and the following disclaimer.
|
|
264
|
+
|
|
265
|
+
- Redistributions in binary form must reproduce the above copyright
|
|
266
|
+
notice, this list of conditions and the following disclaimer listed
|
|
267
|
+
in this license in the documentation and/or other materials
|
|
268
|
+
provided with the distribution.
|
|
269
|
+
|
|
270
|
+
- Neither the name of the copyright holders nor the names of its
|
|
271
|
+
contributors may be used to endorse or promote products derived from
|
|
272
|
+
this software without specific prior written permission.
|
|
273
|
+
|
|
274
|
+
The copyright holders provide no reassurances that the source code
|
|
275
|
+
provided does not infringe any patent, copyright, or any other
|
|
276
|
+
intellectual property rights of third parties. The copyright holders
|
|
277
|
+
disclaim any liability to any recipient for claims brought against
|
|
278
|
+
recipient by any third party for infringement of that parties
|
|
279
|
+
intellectual property rights.
|
|
280
|
+
|
|
281
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
282
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
283
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
284
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
285
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
286
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
287
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
288
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
289
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
290
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
291
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## Public-domain sources (listed for attribution)
|
|
297
|
+
|
|
298
|
+
The following algorithms come from public-domain software. No license terms apply;
|
|
299
|
+
they are listed so that readers can find the originals.
|
|
300
|
+
|
|
301
|
+
- LINPACK (Dongarra, Bunch, Moler, Stewart 1979): `dqrdc` (Householder QR, used with the
|
|
302
|
+
column-pivoting rule of R observed from its output) and `dtrco` (condition estimate) —
|
|
303
|
+
`src/linalg/qr.ts`, `src/linalg/kappa.ts`
|
|
304
|
+
- EISPACK / JAMA (NIST and The MathWorks): `svd` (Golub–Reinsch), `tred2`, `tql2`, `orthes`, `hqr2` —
|
|
305
|
+
`src/linalg/svd.ts`, `src/linalg/eigen.ts`
|
|
306
|
+
- FMM (Forsythe, Malcolm, Moler, "Computer Methods for Mathematical Computations", 1977; netlib
|
|
307
|
+
https://netlib.org/fmm/spline.f): `spline` (cubic spline coefficients with end third derivatives from
|
|
308
|
+
divided differences), the "fmm" method — `src/numerics/interp.ts`
|
|
309
|
+
- netlib go (https://netlib.org/go/zeroin.f; Brent, "Algorithms for Minimization without Derivatives",
|
|
310
|
+
1973, chapter 4): `zeroin` (Brent's root finder by bisection, secant and inverse quadratic
|
|
311
|
+
interpolation), the zero finder of `uniroot` — `src/numerics/integrate.ts`
|
|
312
|
+
- netlib fmm (https://netlib.org/fmm/fmin.f; Brent, "Algorithms for Minimization without Derivatives",
|
|
313
|
+
1973, chapter 5): `fmin` (Brent's localmin, golden-section search with parabolic interpolation),
|
|
314
|
+
the minimiser of `optimize` — `src/optim/localmin.ts`
|
|
315
|
+
- QUADPACK (Piessens, de Doncker-Kapenga, Überhuber, Kahaner 1983): `dqagse` and `dqagie` (adaptive
|
|
316
|
+
Gauss–Kronrod quadrature with extrapolation), behind `integrate` — `src/integrate/quadpack.ts`,
|
|
317
|
+
ported from SciPy's C translation (see SciPy above)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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 h,i as s,j as p}from"./chunk-QNAIK4PY.js";function L(t){return Math.abs(t-m(t))>1e-9*Math.max(1,Math.abs(t))}function m(t){if(!Number.isFinite(t))return t;let e=Math.round(t);return e-t===.5&&e%2!==0?e-1:e}var y=[.08333333333333333,-.021092796092796094,.007575757575757576,-.004166666666666667,.003968253968253968,-.008333333333333333,.08333333333333333],d=.9955816268920898,w=1569415565/1073741824,O=381566830/1073741824/1073741824,E=9016312093258695e-35,S=[-.002071332116774595,-.04525132144873906,-.28919126444774784,-.6503185377089651,-.3255503118680449,.25479851061131553],_=[-5578984132167551e-22,.0021284987017821146,.054151797245674226,.43593529692665967,1.4606242909763516,2.076711702373047,1];function v(t){let e=t-w;e-=O,e-=E;let r=h(t-1,S)/h(t-1,_);return e*d+e*r}function A(t){let e=0;if(t<1e17){let r=1/(t*t);e=r*h(r,y)}return Math.log(t)-.5/t-e}function k(t){let e=0;if(Number.isNaN(t)||t===1/0)return t;if(t===-1/0)return NaN;if(t===0)return NaN;if(t<0){let r=t-Math.trunc(t);if(r===0)return NaN;e=-Math.PI/Math.tan(Math.PI*r),t=1-t}if(t<=10&&t===Math.floor(t)){let r=t;for(let o=1;o<r;o++)e+=1/o;return e-p}if(t<1)e-=1/t,t+=1;else if(t<10)for(;t>2;)t-=1,e+=1/t;return t>=1&&t<=2?e+v(t):e+A(t)}var N=-.5040830082644554,R=7289763902976895e-32,b;function T(t){b??=Array.from({length:100},(n,i)=>C(i+2,N));let e=R,r=-1,o=t-N;for(let n=1;n<100;n++){r*=-o;let i=r*b[n-1];if(e+=i,Math.abs(i)<Number.EPSILON*Math.abs(e))break}return e}var g=[12,-720,30240,-1209600,47900160,-18924375803183792e-7,74724249600,-2950130727918164e-3,11646782814350067e-2,-4597978722407473,0x284e46fd8153bc0,-7166165256175667e3];function z(t,e){let r=1,o=e,n=1,i=0;for(;e<=1e8&&(i<9||o<=9||o<t);)if(i+=1,o+=1,n=Math.exp(-t*Math.log1p(i/e)),r+=n,Math.abs(n/r)<s)return r;let f=o;r+=n*f/(t-1),r-=.5*n;let u=1,a=0;for(let c=0;c<12;c++){u*=t+a,n/=f;let l=u*n/g[c];if(r+=l,Math.abs(l/r)<s)break;a+=1,u*=t+a,n/=f,a+=1}return r}function C(t,e){let r=Math.pow(e,-t),o=e,n=0,i=0;for(;i<9||o<=9||o<t;)if(i+=1,o+=1,n=Math.pow(o,-t),r+=n,Math.abs(n/r)<s)return r;let f=o;r+=n*f/(t-1),r-=.5*n;let u=1,a=0;for(let c=0;c<12;c++){u*=t+a,n/=f;let l=u*n/g[c];if(r+=l,Math.abs(l/r)<s)break;a+=1,u*=t+a,n/=f,a+=1}return r}function I(t,e){if(e===1/0)return t%2===0?-0:0;let r=1;for(let n=1;n<=t;n++)r*=n/e;let o=r*(z(t+1,e)/e);return t%2===0?-o:o}var M=[];function Z(t){if(M[t]!==void 0)return M[t];let e=[0,1];for(let n=0;n<t;n++){let i=e.slice(1).map((u,a)=>u*(a+1)),f=new Array(i.length+2).fill(0);i.forEach((u,a)=>{f[a]=f[a]-u,f[a+2]=f[a+2]-u}),e=f}let r=(t+1)%2,o=[];for(let n=r;n<e.length;n+=2)o.push(e[n]);return M[t]=o,o}function j(t,e){let r=Z(t),o=e*e,n=r[r.length-1];for(let i=r.length-2;i>=0;i--)n=n*o+r[i];return(t+1)%2===1?n*e:n}function D(t){let e=t-Math.round(t);return Math.sin(Math.PI*(.5-Math.abs(e)))/Math.sin(Math.PI*e)}function P(t,e,r){if(Number.isNaN(e))return NaN;if(e===-1/0)return r&&t%2===1?1/0:NaN;if(e<=0&&e===Math.floor(e))return t%2===1?1/0:NaN;if(e>0)return I(t,e);let o=I(t,1-e);return(t%2===0?o:-o)-Math.pow(Math.PI,t+1)*j(t,D(e))}function H(t){return Math.abs(t-N)<.3?T(t):k(t)}function V(t,e){return P(1,t,e?.rCompatible??!0)}function Y(t,e=0,r){let o=m(e);return Number.isNaN(o)||o<0||o>100?NaN:o===0?H(t):P(o,t,r?.rCompatible??!0)}export{L as a,m as b,H as c,V as d,Y as e};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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 I,b,c as y,d as L,e as S,f as W,g as Q,h as St,i as Zn,j as Bt}from"./chunk-XM2TVD63.js";import{a as U,b as C,c as pt}from"./chunk-2JCIB5H2.js";import{B as Z,C as wn,a as Jt,e as g,g as dt,h as R,j as kt,l as Vn,n as X,o as Ct,p as At,q as Rt,s as w,t as ut,u as A,x as Xn,y as O}from"./chunk-QNAIK4PY.js";import{b as E,c as K,d as F,e as P,f as Kn,g as q,h as zt,i as _,j as Mt,k as G}from"./chunk-UGUQYWRQ.js";function le(n,t){let r=[.213623493715853,4.28342155967104,11.6616720288968,3.31125922108741],e=[.03611708101884203,1.27364489782223,6.40691597760039,6.61053765625462,1],i=n<.5?Math.sqrt(-2*Math.log(n)):Math.sqrt(-2*Math.log(t)),o=i-Jt(i,r)/Jt(i,e);return n<.5?-o:o}function me(n,t,r,e){let i=1;if(r>=1){let o=t/(n+1);i+=o;for(let u=2;u<=r&&(o*=t/(n+u),i+=o,!(o<e));++u);}return i}function $n(n,t){let r=(n-1)*Math.log(t),e=r*r,i=e*r,o=e*e,u=n*n,s=u*n,f=(n-1)*(1+r),c=(n-1)*(-(e/2)+(n-2)*r+(3*n-5)/2),a=(n-1)*(i/3-(3*n-5)*e/2+(u-6*n+7)*r+(11*u-46*n+47)/6),N=(n-1)*(-(o/4)+(11*n-17)*i/6+(-3*u+13*n-13)*e+(2*s-25*u+72*n-61)*r/2+(25*s-195*u+477*n-379)/12),h=t*t,l=h*t,m=h*h;return t+r+f/t+c/h+a/l+N/m}function tn(n,t,r){if(n===1)return r>.9?-Math.log1p(-t):-Math.log(r);if(n<1){let M=Vn(n),p=r*M;if(p>.6||p>=.45&&n>=.3){let d=p*r>1e-8&&r>1e-5?Math.pow(t*M*n,1/n):Math.exp(-r/n-kt);return d/(1-d/(n+1))}if(n<.3&&p>=.35){let d=Math.exp(-kt-p),x=d*Math.exp(d);return d*Math.exp(x)}if(p>.15||n>=.3){let d=-Math.log(p),x=d-(1-n)*Math.log(d);return d-(1-n)*Math.log(x)-Math.log(1+(1-n)/(1+x))}if(p>.1){let d=-Math.log(p),x=d-(1-n)*Math.log(d);return d-(1-n)*Math.log(x)-Math.log((x*x+2*(3-n)*x+(2-n)*(3-n))/(x*x+(5-n)*x+2))}return $n(n,-Math.log(p))}let e=le(t,r),i=e*e,o=i*e,u=i*i,s=u*e,f=Math.sqrt(n),c=n+e*f+(i-1)/3;if(c+=(o-7*e)/(36*f),c-=(3*u+7*i-16)/(810*n),c+=(9*s+256*o-433*e)/(38880*n*f),n>=500&&Math.abs(1-c/n)<1e-6)return c;if(t>.5){if(c<3*n)return c;let M=Math.max(2,n*(n-1)),p=Math.log(r)+X(n);if(p<-M*2.3)return $n(n,-p);let d=-p+(n-1)*Math.log(c)-Math.log(1+(1-n)/(1+c));return-p+(n-1)*Math.log(d)-Math.log(1+(1-n)/(1+d))}let a=c,N=n+1,h=n+2;if(c<.15*N){let M=Math.log(t)+X(N);a=Math.exp((M+c)/n),e=Math.log1p(a/N*(1+a/h)),a=Math.exp((M+a-e)/n),e=Math.log1p(a/N*(1+a/h)),a=Math.exp((M+a-e)/n),e=Math.log1p(a/N*(1+a/h*(1+a/(n+3)))),a=Math.exp((M+a-e)/n)}if(a<=.01*N||a>.7*N)return a;let l=Math.log(me(n,a,100,1e-4)),m=Math.log(t)+X(N);return a=Math.exp((m+a-l)/n),a*(1-(n*Math.log(a)-a-m+l)/(n-a))}function nn(n){let{rate:t,scale:r}=n;if(t!==void 0&&r!==void 0){if(Math.abs(t*r-1)>=1e-15)throw new RangeError("rate and scale can both be given only when scale = 1 / rate");return r}return r!==void 0?r:t!==void 0?1/t:1}function Me(n,t){if(t<1){let r=A(t,n,!0),e=t/n;return r+(Number.isFinite(e)?Math.log(e):Math.log(t)-Math.log(n))}return A(t-1,n,!0)}function st(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(t<0||r<=0)return NaN;if(n<0)return y(e);if(t===0)return n===0?1/0:y(e);if(n===0)return t<1?1/0:t>1?y(e):e?-Math.log(r):1/r;if(t<1){let o=A(t,n/r,e);if(e){let u=t/n;return o+(Number.isFinite(u)?Math.log(u):Math.log(t)-Math.log(n))}return o*t/n}let i=A(t-1,n/r,e);return e?i-Math.log(r):i/r}function qt(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(t<0||r<=0)return NaN;let o=n/r;return Number.isNaN(o)?o:t===0?o<=0?I(e,i):b(e,i):o<=0?I(e,i):O(t,o,e,i)}function de(n,t,r,e){let{lower:i,logTarget:o,linearTarget:u}=S(n,r,e),s=O(t,Number.MIN_VALUE,i,!0);if(i?s>=o:s<=o)return 0;let f;if(t>1&&o<=-700){let c=R(o,{lowerTail:i,logP:!0}),a=1-1/(9*t)+c/Math.sqrt(9*t);f=a>0?t*a*a*a:t*.001}else if(o>-700){let c=Math.exp(o),a=-Math.expm1(o);f=i?tn(t,c,a):tn(t,a,c)}else if(i)f=Math.exp((o+Ct(t))/t);else{f=-o;for(let c=0;c<3;c++)f=-o-X(t)+(t-1)*Math.log(f)}return W({logTarget:o,...u!==void 0&&{linearTarget:u},lower:i,cdf:(c,a)=>O(t,c,a,!1),cdfLog:(c,a)=>O(t,c,a,!0),cdfBoth:(c,a)=>Xn(t,c,a),pdfLog:c=>Me(c,t),dlogPdf:c=>(t-1)/c-1,x0:f,lo:0,hi:1/0,positive:!0})}function J(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;let o=L(n,0,1/0,e,i);return o!==void 0?o:t<0||r<=0?NaN:t===0?0:de(n,t,e,i)*r}function wi(n,t,r={}){let e=nn(r),i=r.log??!1;return g(n,o=>st(o,t,e,i))}function Zi(n,t,r={}){let e=nn(r),{lowerTail:i=!0,logP:o=!1}=r;return g(n,u=>qt(u,t,e,i,o))}function $i(n,t,r={}){let e=nn(r),{lowerTail:i=!0,logP:o=!1}=r;return g(n,u=>J(u,t,e,i,o))}var gt=8*Number.EPSILON,Yn=2*Number.EPSILON,pe=1e-290;function j(n){let{p:t,lowerTail:r,logP:e,cdf:i,lo:o,hi:u}=n,s;if(e||t<pe){let N;e?N=r?t*(1+Yn):t*(1-Yn):N=Math.log(t)+Math.log1p(r?-gt:gt),s=r?h=>i(h,!0,!0)>=N:h=>i(h,!1,!0)<=N}else{let N;if(r?N=t*(1-gt):N=1-t>4*gt?t*(1+gt):t,N>.5){let h=1-N;s=r?l=>i(l,!1,!1)<=h:l=>i(l,!0,!1)>=h}else s=r?h=>i(h,!0,!1)>=N:h=>i(h,!1,!1)<=N}let f=Math.round(n.y0);if(Number.isFinite(f)||(f=o),f=Math.min(Math.max(f,o),u),s(f)){let N=1,h=f-N;for(;h>=o&&s(h);)f=h,N*=2,h=f-N;if(h<o){if(f===o)return o;h=o-1}return Tn(h,f,s)}let c=1,a=f+c;for(;a<=u&&!s(a);)f=a,c*=2,a=f+c;return a>u&&(a=u),Tn(f,a,s)}function Tn(n,t,r){for(;t-n>1;){let e=Math.floor(n+(t-n)/2);if(e===n||e===t)break;r(e)?t=e:n=e}return t}var Wt=U;function ge(n,t,r){return Number.isNaN(n)||Number.isNaN(t)?NaN:t<0?NaN:Wt(n)?y(r):n<0||!Number.isFinite(n)?y(r):A(Math.round(n),t,r)}function be(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t))return NaN;if(t<0)return NaN;if(n<0)return I(r,e);if(t===0)return b(r,e);if(!Number.isFinite(n))return b(r,e);let i=Math.floor(n+1e-7);return O(i+1,t,!r,e)}function Ie(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t))return NaN;if(!Number.isFinite(t)||t<0)return NaN;let i=L(n,0,1/0,r,e);if(i!==void 0)return t===0&&!Number.isNaN(i)?0:i;if(t===0)return 0;let o=Math.sqrt(t),u=R(n,{lowerTail:r,logP:e}),s=t+o*(u+(u*u-1)/(6*o));return j({p:n,lowerTail:r,logP:e,cdf:(f,c,a)=>O(f+1,t,!c,a),y0:Number.isFinite(s)?s:t,lo:0,hi:1/0})}function eo(n,t,r={}){let e=r.log??!1;return g(n,i=>ge(i,t,e))}function io(n,t,r={}){let{lowerTail:e=!0,logP:i=!1}=r;return g(n,o=>be(o,t,e,i))}function oo(n,t,r={}){let{lowerTail:e=!0,logP:i=!1}=r;return g(n,o=>Ie(o,t,e,i))}var ye=1e-17,ve=Math.log(ye),Pn=2e7,en=500,rn=2**en,bt=2**-en,Fe=2**250,xe=2**-250,on=en*Math.LN2,Ft={h:0,l:0,k:0};function V(n,t,r,e=!1){if(n===0)return Ft;if(!Number.isFinite(n))return{h:n,l:0,k:r};for(;Math.abs(n)>Fe;)n*=bt,t*=bt,r++;for(;Math.abs(n)<xe;)n*=rn,t*=rn,r--;return e?{h:n,l:t,k:r,approx:e}:{h:n,l:t,k:r}}var Le=[346.5735902799727,-22599635089223323e-30];function Ht(n,t){if(n>1e-305||Number.isNaN(n))return V(n,0,0);let r=t(),[e,i]=typeof r=="number"?[r,0]:r;if(e===-1/0)return Ft;if(Number.isNaN(e))return{h:NaN,l:0,k:0};let o=Math.round(e/on),u=F([e,i],q(Le,[-o,0])),s=Math.exp(u[0]);return typeof r=="number"?V(s,0,o,!0):V(s,s*u[1],o)}function un(n,t){if(n===0)return[-t,0];let r=22250738585072014e-324;if(n<=t*r||t<n*r||!Number.isFinite(n))return F(q(G([t,0]),[n,0]),[-t-Ct(n),0]);let e=F(Rt(n,[t,0]),[At(n),0]);return F([-e[0],-e[1]],[-.5*(_e+Math.log(n)),0])}var _e=1.8378770664093456;function $(n,t){return n.approx===!0&&yt(n)>-700?t():n}function z(n,t){return It(n,V(t[0],t[1],0))}function De(n,t){if(n.h===0)return Ft;let r=V(t[0],t[1],0),e=_([n.h,n.l],[r.h,r.l]);return V(e[0],e[1],n.k-r.k,n.approx)}function Jn(n,t,r){let e=z(n,t.ratio(r));return t.ratioK?{...e,k:e.k+t.ratioK}:e}function zn(n,t,r){let e=De(n,t.ratio(r));return t.ratioK?{...e,k:e.k-t.ratioK}:e}function It(n,t){if(n.h===0||t.h===0)return Ft;let r=q([n.h,n.l],[t.h,t.l]);return V(r[0],r[1],n.k+t.k,n.approx===!0||t.approx===!0)}function Ot(n,t,r,e){for(let i=r;i<e&&n!==0;i++)n*=bt,t*=bt;return[n,t]}function kn(n,t){if(n.h===0)return t;if(t.h===0)return n;let r=Math.max(n.k,t.k),e=F(Ot(n.h,n.l,n.k,r),Ot(t.h,t.l,t.k,r));return V(e[0],e[1],r)}function yt(n){return n.h===0?-1/0:Math.log(n.h)+n.l/n.h+n.k*on}var vt=class{s=0;c=0;k=0;add(t){if(t.h===0)return;if(this.s===0&&this.c===0){this.s=t.h,this.c=t.l,this.k=t.k;return}t.k>this.k&&([this.s,this.c]=Ot(this.s,this.c,this.k,t.k),this.k=t.k);let[r,e]=Ot(t.h,t.l,t.k,this.k);this.addNum(r),this.addNum(e)}addNum(t){let r=this.s+t;Math.abs(this.s)>=Math.abs(t)?this.c+=this.s-r+t:this.c+=t-r+this.s,this.s=r}get log(){let t=this.s+this.c;return Number.isNaN(t)?NaN:t>0?Math.log(t)+this.k*on:-1/0}get linear(){let t=this.s+this.c;for(let r=0;r<this.k;r++)t*=rn;for(let r=0;r>this.k&&t!==0;r--)t*=bt;return t}value(t){return t?this.log:this.linear}divideBy(t){let r=V(t,0,0);this.s/=r.h,this.c/=r.h,this.k-=r.k}};function Ee(n){let t=Math.floor(n),r=1;for(;;){if(r*=n/(t+1),r/(1-n/(t+2))<3e-21)return t;t++}}function Ce(n){let t=Math.floor(n),r=1;for(;t>0;){if(r*=t/n,r/(1-(t-1)/n)<3e-21)return t;t--}return 0}function Ut(n,t,r){if(r===-1/0||!(n<t))return!1;let e=n-t;return n+e-Math.log(-Math.expm1(e))<=ve+r}function k(n,t){return Ht(A(n,t,!1),()=>un(n,t))}function H(n,t){return Ht(n.inc(t,!1),()=>n.incLogDD?n.incLogDD(t):n.inc(t,!0))}function ft(n,t,r,e){return(r?or(n,t):ur(n,t)).value(e)}function tr(n,t,r){let e=r?or(n,t):ur(n,t);return{lin:e.linear,log:e.log}}function nr(n,t,r,e){return A(r,t,!0)+n.cdf(r,e,!0)}function rr(n,t,r){for(;r-t>2;){let i=Math.floor(t+(r-t)/3),o=Math.ceil(r-(r-t)/3);n(i)<n(o)?t=i:r=o}let e=t;for(let i=t+1;i<=r;i++)n(i)>n(e)&&(e=i);return e}var Ae=60;function er(n,t,r,e){let i=n(t)-Ae;for(let o=1;;o*=2){let u=t+r*o;if(r>0?u>=e:u<=e)return e;if(n(u)<i)return u}}var ir=3e3;function or(n,t){let r=Ee(n);if(r>ir){let f=c=>nr(t,n,c,!0);r=er(f,rr(f,0,r),1,r)}let e=Ht(t.cdf(r,!0,!1),()=>t.cdf(r,!0,!0)),i=k(r,n),o=r>0?H(t,r-1):Ft,u=new vt,s=-1/0;for(let f=r;f>=0;f--){let c=It(i,e),a=yt(c);if(u.add(c),Ut(a,s,u.log)||(s=a,f===0))break;e=kn(e,o),i=$(z(i,Mt([f,0],n)),()=>k(f-1,n)),f>=2&&(o=o.h===0?H(t,f-2):$(zn(o,t,f-1),()=>H(t,f-2)))}return u}function ur(n,t){let r=Ce(n),e=!1;for(;;){let i=Ht(t.cdf(r,!1,!1),()=>t.cdf(r,!1,!0)),o=k(r,n),u=H(t,r),s=new vt,f=-1/0,c=-1;for(let a=r;a<r+Pn;a++){let N=It(o,i),h=yt(N);if(s.add(N),Ut(h,f,s.log)||h===-1/0&&a>n+50&&a>r+50)break;if(!e&&a-r>=ir&&h>=f){let l=d=>nr(t,n,d,!1),m=l(a),M=a+1;for(let d=1;l(M)>=m;d*=2)M=a+d;let p=er(l,rr(l,a,M),-1,a);if(e=!0,p>a){c=p;break}}f=h,i=kn(i,u),o=$(z(o,Mt([n,0],a+1)),()=>k(a+1,n)),u=u.h===0?H(t,a+1):$(Jn(u,t,a+1),()=>H(t,a+1))}if(c<0)return s;r=c}}function Gt(n,t,r,e,i,o){let u=Number.isFinite(e)?Math.max(0,Math.round(e)):0,s=new vt,f=k(u,n),c=H(t,u),a=f,N=c,h=-1/0;for(let l=u;l<u+Pn;l++){let m=z(It(a,N),[r(l),0]),M=yt(m);if(s.add(m),Ut(M,h,s.log)||M===-1/0&&l>n+50&&l>u+50)break;h=M,a=$(z(a,Mt([n,0],l+1)),()=>k(l+1,n)),N=N.h===0?H(t,l+1):$(Jn(N,t,l+1),()=>H(t,l+1))}a=f,N=c,h=-1/0;for(let l=u-1;l>=0;l--){a=$(z(a,Mt([l+1,0],n)),()=>k(l,n)),N=N.h===0?H(t,l):$(zn(N,t,l+1),()=>H(t,l));let m=z(It(a,N),[r(l),0]),M=yt(m);if(s.add(m),Ut(M,h,s.log))break;h=M}return s.divideBy(i),s.value(o)}function Re(n){return n<=.5?[[n,0],E(1,-n)]:[E(1,-(1-n)),[1-n,0]]}function Nr(n,t,r,e){let[i,o]=Re(n),{e:u,logDenom:s}=ut(t,r,i,o),f=F(P(F(G(i),G(o))),[Math.log(t*r/(t+r))-.5*s,0]),c=F(P(u),f);return e?c[0]+c[1]:Math.exp(c[0])*(1+c[1])}function Se(n,t,r,e){return Nr(n,r,e,!0)}function sn(n,t,r,e){return Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)?NaN:t<0||r<0?NaN:n<0||n>1?y(e):t===0||r===0||!Number.isFinite(t)||!Number.isFinite(r)?t===0&&r===0?n===0||n===1?1/0:y(e):t===0||r/t===1/0?n===0?1/0:y(e):r===0||t/r===1/0?n===1?1/0:y(e):n===.5?1/0:y(e):n===0?t>1?y(e):t<1?1/0:e?Math.log(r):r:n===1?r>1?y(e):r<1?1/0:e?Math.log(t):t:Nr(n,t,r,e)}function fn(n,t,r,e,i){return Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)?NaN:t<0||r<0?NaN:n>=1?b(e,i):t===0||r===0||!Number.isFinite(t)||!Number.isFinite(r)?t===0&&r===0?i?-Math.LN2:.5:t===0||r/t===1/0?b(e,i):r===0||t/r===1/0?I(e,i):n<.5?I(e,i):b(e,i):n<=0?I(e,i):Q(t,r,n,1-n,e,i)}function an(n,t,r,e){if(!(n>1&&t>1))return;let i=R(e,{logP:!0}),o=r?-i:i,u=1/(2*n-1),s=1/(2*t-1),f=2/(u+s),c=(o*o-3)/6;if(!(f+c>0))return;let a=o*Math.sqrt(f+c)/f-(s-u)*(c+5/6-2/(3*f)),N=n/(n+t*Math.exp(2*a));return N>0&&N<1?N:void 0}function sr(n,t,r,e,i){let o=Q(n,t,Number.MIN_VALUE,1,r,!0);if(r?o>=e:o<=e)return 0;let u=.25,s=1/0;if(r){let f=(e+Math.log(n)+Z(n,t))/n;s=Math.exp(Math.max(f,-745)),u=Math.min(s,.25)}if(!(s<.001)){let f=an(n,t,r,e);f!==void 0&&f<.5&&(u=f)}return W({logTarget:e,...i!==void 0&&{linearTarget:i},lower:r,cdf:(f,c)=>Q(n,t,f,1-f,c,!1),cdfLog:(f,c)=>Q(n,t,f,1-f,c,!0),cdfBoth:(f,c)=>Bt(n,t,f,1-f,c),pdfLog:f=>Se(f,1-f,n,t),dlogPdf:f=>(n-1)/f-(t-1)/(1-f),x0:u,lo:0,hi:.5,positive:!0})}function Qt(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(t<0||r<0)return NaN;let o=L(n,0,1,e,i);if(o!==void 0)return o;if(t===0||r===0||!Number.isFinite(t)||!Number.isFinite(r)){if(t===0&&r===0){let N=i?n:Math.log(n),h=e?N:Math.log1p(-Math.exp(N));return h<-Math.LN2?0:h>-Math.LN2?1:.5}return t===0||r/t===1/0?0:r===0||t/r===1/0?1:.5}let{lower:u,logTarget:s,linearTarget:f}=S(n,e,i),c=Q(t,r,.5,.5,u,!0);return(u?s<=c:s>=c)?sr(t,r,u,s,f):1-sr(r,t,!u,s,f)}function yo(n,t,r,e={}){let{log:i=!1,ncp:o}=e;return o!==void 0?g(n,u=>fr(u,t,r,o,i)):g(n,u=>sn(u,t,r,i))}function vo(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1,ncp:u}=e;return u!==void 0?g(n,s=>ar(s,t,r,u,i,o)):g(n,s=>fn(s,t,r,i,o))}function Fo(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1,ncp:u}=e;return u!==void 0?g(n,s=>cr(s,t,r,u,i,o)):g(n,s=>Qt(s,t,r,i,o))}function lr(n,t){let r=t<1e-250,e=r?t*2**500:t;return{ratioK:r?-1:0,cdf:(i,o,u)=>O(n+i,t,o,u),inc:(i,o)=>{let[u,s]=hr(n,i,t);return o?A(u,t,!0)+s:A(u,t,!1)*(1+s)},ratio:i=>_([e,0],E(n,i)),incLogDD:i=>{let[o,u]=hr(n,i,t);return F(un(o,t),[u,0])}}}function hr(n,t,r){let[e,i]=E(n,t);return[e,i===0?0:i*(Math.log(r)-pt(e+1))]}function mr(n,t){return n>=0&&t>=0&&Number.isFinite(n)&&Number.isFinite(t)}function Mr(n,t,r,e){let i=r/2;if(i*(n/2)>1e18){let s=Be(n,t,r);return e?{lin:-Math.expm1(s),log:Math.log1p(-Math.exp(s))}:{lin:Math.exp(s),log:s}}let o=lr(t/2,Math.max(n/2,Number.MIN_VALUE)),u=tr(i,o,e);if(u.lin>.5){let s;return{lin:u.lin,get log(){return s??=Math.log1p(-ft(i,o,!e,!1)),s}}}return u}function Be(n,t,r){let e=.5-Math.sqrt(r/n)/2-(t-3)/(4*n);return pr(n,t,r,!0)-Math.log(e)}function cn(n,t,r,e,i){let o=Mr(n,t,r,e);return i?o.log:o.lin}function qe(n,t){let r=NaN,e=!0,i={lin:NaN,log:NaN};return(o,u)=>((o!==r||u!==e)&&(i=Mr(o,n,t,u),r=o,e=u),i)}function dr(n,t,r,e){let i=t/2,o=n/2,u=r/2,s=(-(i-1)+Math.sqrt((i-1)*(i-1)+4*u*o))/2;return u*o>1e18?pr(n,t,r,e):Gt(u,lr(i,o),f=>i+f,s,n,e)}function pr(n,t,r,e){let i=t/2-1,o=Math.sqrt(r*n),u=4*i*i,s=1,f=1;for(let N=1;N<30&&(s*=-(u-(2*N-1)*(2*N-1))/(8*N*o),f+=s,!(Math.abs(s)<1e-17*Math.abs(f)));N++);let c=Math.sqrt(n)-Math.sqrt(r),a=-Math.LN2-c*c/2+i/2*Math.log(n/r)-.5*Math.log(2*Math.PI*o)+Math.log(f);return e?a:Math.exp(a)}function gr(n,t,r,e){return Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)?NaN:mr(t,r)?r===0?st(n,t/2,2,e):n<0||n===1/0?e?-1/0:0:n===0?t<2?1/0:t===2?e?-r/2-Math.LN2:Math.exp(-r/2)/2:e?-1/0:0:dr(n,t,r,e):NaN}function br(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(!mr(t,r))return NaN;if(n<0)return I(e,i);if(n===0){if(t>0)return I(e,i);let o=-r/2;return e?i?o:Math.exp(o):i?o<-Math.LN2?Math.log1p(-Math.exp(o)):Math.log(-Math.expm1(o)):-Math.expm1(o)}return r===0?n===1/0?b(e,i):O(t/2,Math.max(n/2,Number.MIN_VALUE),e,i):n===1/0?b(e,i):cn(n,t,r,e,i)}function Ir(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(!(t>=0&&r>=0&&Number.isFinite(t)))return NaN;let o=L(n,0,1/0,e,i);if(o!==void 0)return o;if(!Number.isFinite(r))return i&&Math.exp(n)===1?e?1/0:0:NaN;if(r===0)return J(n,t/2,2,e,i);let{lower:u,logTarget:s,linearTarget:f}=S(n,e,i),c=qe(t,r),a=cn(Number.MIN_VALUE,t,r,u,!0);if(u?a>=s:a<=s)return 0;let N=(t+2*r)/(t+r),h=(t+r)*(t+r)/(t+2*r),l=N*J(s,h/2,2,u,!0);(!(l>0)||!Number.isFinite(l))&&(l=t+r);let m=Math.max(l,t+r,1);for(let M=0;M<2e3;M++){let p=cn(m,t,r,u,!0);if(u?p>=s:p<=s)break;m*=2}return W({logTarget:s,...f!==void 0&&{linearTarget:f},lower:u,cdf:(M,p)=>c(M,p).lin,cdfLog:(M,p)=>c(M,p).log,pdfLog:M=>dr(M,t,r,!0),x0:Math.min(l,m),lo:0,hi:m,positive:!0})}function vr(n,t,r,e){let i=E(n,t),o=r[0]<1e-250,u=o?[r[0]*2**500,r[1]*2**500]:r;return{ratioK:o?-1:0,cdf:(s,f,c)=>St(n+s,t,r,e,f,c),inc:(s,f)=>{let[c,a]=yr(n,t,s,r),N=t/(c+t);return f?w(c,t,r,e,!0)+Math.log(N)+a:w(c,t,r,e,!1)*N*(1+a)},ratio:s=>_(q(u,F(i,[s-1,0])),E(n,s)),incLogDD:s=>{let[f,c]=yr(n,t,s,r);if(!(r[0]>1e-305&&e[0]>1e-305)){let h=We(f,t,r,e);return typeof h=="number"?h+c:F(h,[c,0])}let{e:a,logDenom:N}=ut(f,t,r,e);return F([-a[0],-a[1]],[-.5*N+Math.log(t/(f+t))+c,0])}}}function yr(n,t,r,e){let[i,o]=E(n,r);return o===0?[i,0]:[i,o*(Math.log(e[0])+e[1]/e[0]+pt(i+t)-pt(i+1))]}function We(n,t,r,e){if(!(r[0]>0&&e[0]>0))return-1/0;let i=F(zt(G(r),n),zt(G(e),t));return F(F(i,P(wn(n,t))),[-Math.log(n),0])}function hn(n){return n<=.5?[[n,0],E(1,-n)]:[E(1,-(1-n)),[1-n,0]]}function ln(n,t,r,e,i,o,u){let s=vr(n,t,e,i),f=r/2,c=ft(f,s,o,!1);return u?c>.5?Math.log1p(-ft(f,s,!o,!1)):c>=1e-280?Math.log(c):ft(f,s,o,!0):c}function Fr(n,t,r,e,i,o,u){let s=r/2,f=e[0],c=s*f,a=n-1-c,N=(-a+Math.sqrt(Math.max(0,a*a+4*c*(n+t-1))))/2;return Gt(s,vr(n,t,e,i),h=>n+h,N,o,u)}function mn(n,t,r){return n>0&&t>0&&Number.isFinite(n)&&Number.isFinite(t)&&r>=0&&Number.isFinite(r)}function xr(n,t,r,e,i){let[o,u]=hn(n),s=q(o,u);return Fr(t,r,e,o,u,s[0]+s[1],i)}function fr(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(e))return NaN;if(!mn(t,r,e))return NaN;if(e===0)return sn(n,t,r,i);if(n<0||n>1)return i?-1/0:0;let o=e/2;return n===0?t>1?i?-1/0:0:t<1?1/0:i?Math.log(r)-o:r*Math.exp(-o):n===1?r>1?i?-1/0:0:r<1?1/0:i?Math.log(t+o):t+o:xr(n,t,r,e,i)}function ar(n,t,r,e,i,o){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(e))return NaN;if(n<=0)return I(i,o);if(n>=1)return b(i,o);if(!mn(t,r,e))return NaN;if(e===0)return fn(n,t,r,i,o);let[u,s]=hn(n);return ln(t,r,e,u,s,i,o)}function cr(n,t,r,e,i,o){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(e))return NaN;if(!(t>0&&r>0&&e>=0))return NaN;let u=L(n,0,1,i,o);if(u!==void 0)return u;if(!mn(t,r,e))return NaN;if(e===0)return Qt(n,t,r,i,o);let{lower:s,logTarget:f,linearTarget:c}=S(n,i,o),a=(m,M,p)=>{let[d,x]=hn(m);return ln(t,r,e,d,x,M,p)},N=a(Number.MIN_VALUE,s,!0);if(s?N>=f:N<=f)return 0;let h=a(1-Number.EPSILON/2,s,!0);if(s?h<f:h>f)return 1;let l=Qt(f,t+e/2,r,s,!0);return l>0&&l<1||(l=.5),W({logTarget:f,...c!==void 0&&{linearTarget:c},lower:s,cdf:(m,M)=>a(m,M,!1),cdfLog:(m,M)=>a(m,M,!0),pdfLog:m=>xr(m,t,r,e,!0),x0:l,lo:0,hi:1,positive:!0})}function Lr(n,t,r){let e=K(t,n);if(Number.isFinite(e[0])&&Number.isFinite(e[1])&&Math.abs(e[0])<1e290){let o=F(e,[r,0]);return[_(e,o),_([r,0],o)]}let i=r/t/n;return[E(1,-i),[i,0]]}function _r(n,t,r,e,i){if(t/r*n<1e-306){let s=t/2,f=-e/2+s*(Math.log(t/r)+Math.log(n))-Z(s,r/2)-Math.log(n);return i?f:Math.exp(f)}let[o,u]=Lr(n,t,r);return Fr(t/2,r/2,e,o,u,n,i)}function Dr(n,t,r,e,i,o){let u=t/2,s=-e/2+u*(Math.log(t/r)+Math.log(n))-Math.log(u)-Z(u,r/2);return i?o?s:Math.exp(s):o?-Math.exp(s):-Math.expm1(s)}function xt(n,t,r,e,i,o){if(t/r*n<1e-306)return Dr(n,t,r,e,i,o);let[u,s]=Lr(n,t,r);return ln(t/2,r/2,e,u,s,i,o)}function Er(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(e))return NaN;if(!(t>0&&r>0&&e>=0))return NaN;if(n<0)return i?-1/0:0;if(!Number.isFinite(e))return NaN;if(t===1/0)return r===1/0?n===1?1/0:i?-1/0:0:n===0?NaN:jt(n,t,r,i);if(r===1/0){let o=gr(n*t,t,e,i);return i?o+Math.log(t):o*t}return n===1/0?NaN:n===0?t<2?1/0:t>2?i?-1/0:0:i?-e/2:Math.exp(-e/2):e===0?jt(n,t,r,i):_r(n,t,r,e,i)}function Cr(n,t,r,e,i,o){return Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(e)?NaN:!(t>0&&r>0&&e>=0)||!Number.isFinite(e)?NaN:t===1/0&&r===1/0?NaN:n<=0?I(i,o):n===1/0?b(i,o):t===1/0?NaN:r===1/0?br(n*t,t,e,i,o):t/r*n<1e-306?Dr(n,t,r,e,i,o):e===0?Nn(n,t,r,i,o):xt(n,t,r,e,i,o)}function Ar(n,t,r,e,i,o){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)||Number.isNaN(e))return NaN;if(!(t>0&&r>0&&e>=0)||!Number.isFinite(e))return NaN;let u=L(n,0,1/0,i,o);return u!==void 0?u:t===1/0?NaN:r===1/0?Ir(n,t,e,i,o)/t:e===0?Kt(n,t,r,i,o):Oe(n,t,r,e,i,o)}function Oe(n,t,r,e,i,o){let{lower:u,logTarget:s,linearTarget:f}=S(n,i,o),c=xt(Number.MIN_VALUE,t,r,e,u,!0);if(u?c>=s:c<=s)return 0;let a=xt(Number.MAX_VALUE,t,r,e,u,!0);if(u?a<s:a>s)return 1/0;let N=(t+e)*(t+e)/(t+2*e),h=(t+e)/t*Kt(s,N,r,u,!0);return(!(h>0)||!Number.isFinite(h))&&(h=1),W({logTarget:s,...f!==void 0&&{linearTarget:f},lower:u,cdf:(l,m)=>xt(l,t,r,e,m,!1),cdfLog:(l,m)=>xt(l,t,r,e,m,!0),pdfLog:l=>_r(l,t,r,e,!0),x0:h,lo:0,hi:1/0,positive:!0})}function Rr(n,t,r,e){let i=K(t,n),o,u;if(Number.isFinite(i[0])&&Number.isFinite(i[1])&&Math.abs(i[0])<1e290){let N=F(i,[r,0]);o=_(i,N),u=_([r,0],N)}else u=[r/t/n,0],o=[1,-u[0]];let s=o[0],f=u[0];if(t>=2){let N=t*f/2,h=w((t-2)/2,r/2,o,u,e);return e?Math.log(N)+h:N*h}let c=t/(r+t*n)*t*r/(2*(t+r)*s),a=w(t/2,r/2,o,u,e);return e?Math.log(c)+a:c*a}function jt(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(t<=0||r<=0)return NaN;if(n<0)return y(e);if(n===0)return t>2?y(e):t===2?e?0:1:1/0;if(!Number.isFinite(t)&&!Number.isFinite(r))return n===1?1/0:y(e);if(!Number.isFinite(r))return st(n,t/2,2/t,e);if(!Number.isFinite(t)){let i=st(1/n,r/2,2/r,e);return e?i-2*Math.log(n):i/(n*n)}return Number.isFinite(n)?Rr(n,t,r,e):t<2?NaN:y(e)}function Mn(n,t,r,e,i){let o=K(t,n);if(Number.isFinite(o[0])&&Number.isFinite(o[1])&&Math.abs(o[0])<1e290){let s=F(o,[r,0]);return St(t/2,r/2,_(o,s),_([r,0],s),e,i)}let u=r/t/n;return Q(t/2,r/2,1-u,u,e,i)}function Ue(n,t,r,e){let i=an(n/2,t/2,r,e);if(i===void 0)return 1;let o=t*i/(n*(1-i));return o>0&&Number.isFinite(o)?o:1}function He(n,t,r,e){let i=K(t,n);if(Number.isFinite(i[0])&&Number.isFinite(i[1])&&Math.abs(i[0])<1e290){let u=F(i,[r,0]);return Zn(t/2,r/2,_(i,u),_([r,0],u),e)}let o=r/t/n;return Bt(t/2,r/2,1-o,o,e)}function Nn(n,t,r,e,i){return Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r)?NaN:t<=0||r<=0?NaN:n<=0?I(e,i):n===1/0?b(e,i):!Number.isFinite(t)&&!Number.isFinite(r)?n===1?i?-Math.LN2:.5:n<1?I(e,i):b(e,i):Number.isFinite(r)?Number.isFinite(t)?Mn(n,t,r,e,i):qt(r/n,r/2,2,!e,i):qt(n*t,t/2,2,e,i)}function Kt(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(t<=0||r<=0)return NaN;let o=L(n,0,1/0,e,i);if(o!==void 0)return o;if(!Number.isFinite(t)&&!Number.isFinite(r))return 1;if(!Number.isFinite(r))return J(n,t/2,2,e,i)/t;if(!Number.isFinite(t))return r/J(n,r/2,2,!e,i);let{lower:u,logTarget:s,linearTarget:f}=S(n,e,i);return u&&(s+Math.log(t/2)+Z(t/2,r/2))/(t/2)+Math.log(r/t)<-746?0:!u&&-(s+Math.log(r/2)+Z(t/2,r/2))/(r/2)+Math.log(r/t)>709.78?1/0:W({logTarget:s,...f!==void 0&&{linearTarget:f},lower:u,cdf:(c,a)=>Mn(c,t,r,a,!1),cdfLog:(c,a)=>Mn(c,t,r,a,!0),cdfBoth:(c,a)=>He(c,t,r,a),pdfLog:c=>Rr(c,t,r,!0),dlogPdf:c=>(t/2-1)/c-(t+r)/2*(t/(r+t*c)),x0:Ue(t,r,u,s),lo:0,hi:1/0,positive:!0})}function ru(n,t,r,e={}){let{log:i=!1,ncp:o}=e;return o!==void 0?g(n,u=>Er(u,t,r,o,i)):g(n,u=>jt(u,t,r,i))}function eu(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1,ncp:u}=e;return u!==void 0?g(n,s=>Cr(s,t,r,u,i,o)):g(n,s=>Nn(s,t,r,i,o))}function iu(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1,ncp:u}=e;return u!==void 0?g(n,s=>Ar(s,t,r,u,i,o)):g(n,s=>Kt(s,t,r,i,o))}function dn(n,t){return Wt(n)||n<0||!Number.isFinite(n)||t<0||t>1}function Ge(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(dn(t,r))return NaN;if(Wt(n)||n<0||!Number.isFinite(n))return y(e);let i=Math.round(n),o=Math.round(t);if(i>o)return y(e);let u=r<=.5?[r,0]:E(1,-(1-r)),s=r<=.5?E(1,-r):[1-r,0];return w(i,o-i,u,s,e)}function Sr(n,t,r,e,i){return Q(n+1,t-n,r,1-r,!e,i)}function Qe(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(dn(t,r))return NaN;let o=Math.round(t);if(n<0)return I(e,i);let u=Math.floor(n+1e-7);return o<=u?b(e,i):r===0?b(e,i):r===1?I(e,i):Sr(u,o,r,e,i)}function je(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;if(!Number.isFinite(t)||!Number.isFinite(r)||r<0||r>1||t<0)return NaN;let o=L(n,0,Ke(t),e,i);if(o!==void 0)return o;if(dn(t,r))return NaN;let u=Math.round(t);if(r===0||u===0)return 0;if(r===1)return u;let s=1-r,f=u*r,c=Math.sqrt(u*r*s),a=(s-r)/c,N=R(n,{lowerTail:e,logP:i}),h=f+c*(N+a*(N*N-1)/6);return j({p:n,lowerTail:e,logP:i,cdf:(l,m,M)=>l>=u?b(m,M):Sr(l,u,r,m,M),y0:Number.isFinite(h)?h:f,lo:0,hi:u})}function mu(n,t,r,e={}){let i=e.log??!1;return g(n,o=>Ge(o,t,r,i))}function Mu(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1}=e;return g(n,u=>Qe(u,t,r,i,o))}function du(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1}=e;return g(n,u=>je(u,t,r,i,o))}function Ke(n){let t=Math.round(n);return Math.abs(n%1)===.5&&t%2!==0?t-1:t}function pn(n,t,r,e){if(n===0&&t===0)return{e:[0,0],logDenom:0};if(n===0||t===0){let i=n+t,[o,u]=n===0?[e,r]:[r,e];return{e:u[0]<.1?F(Rt(i,q([i,0],o)),q([i,0],u)):P(q([i,0],G(o))),logDenom:0}}return ut(n,t,r,e)}function Wr(n,t,r,e){let i=t+r,o=_([e,0],[i,0]),u=_([i-e,0],[i,0]),s=pn(n,t-n,o,u),f=pn(e-n,r-e+n,o,u),c=pn(e,i-e,o,u);return{e:Kn(F(s.e,f.e),c.e),logDenom:s.logDenom+f.logDenom-c.logDenom}}function Or(n,t){let[r,e]=n.e,i=t*Math.exp(-.5*n.logDenom);return r<700?Math.exp(-r)*(1-e)*i:Math.exp(700-r)*(1-e)*i*Math.exp(-700)}function Ur(n){return-n.e[0]-n.e[1]-.5*n.logDenom}function Vt(n,t,r){return[Math.max(0,r-t),Math.min(r,n)]}function Ve(n,t,r,e,i){if([n,t,r,e].some(Number.isNaN))return NaN;if(![t,r,e].every(Number.isFinite)||U(t)||U(r)||U(e))return NaN;if(t=C(t),r=C(r),e=C(e),t<0||r<0||e<0||e>t+r)return NaN;if(U(n))return y(i);n=C(n);let[o,u]=Vt(t,r,e);if(n<o||n>u)return y(i);if(e===0||e===t+r)return i?0:1;let s=Wr(n,t,r,e);return i?Ur(s):Or(s,1)}function Br(n,t,r,e){return _(K(n,t),K(r,e))}function Xe(n,t,r,e,i,o,u){let s=[1,0],f=[1,0],c=n;for(;!(i?c<=o:c>=u);){let a=i?Br(c,r-e+c,t-c+1,e-c+1):Br(t-c,e-c,c+1,r-e+c+1);s=q(s,a),f=F(f,s),c+=i?-1:1;let N=a[0];if(N<1&&s[0]*N/(1-N)<f[0]*2**-60)break}return f[0]+f[1]}function Hr(n,t,r,e,i,o){let[u,s]=Vt(t,r,e),f=t+r,c=n*f<e*t,a=qr(n,t,r,e,c,u,s);if(a.value>.5){let N=qr(n,t,r,e,!c,u,s);N.value<a.value&&(a=N,c=!c)}return c===i?o?a.value>1e-300?Math.log(a.value):Ur(a.form)+Math.log(a.sum):a.value:o?Math.log1p(-a.value):1-a.value}function qr(n,t,r,e,i,o,u){let s=i?n:n+1,f=Wr(s,t,r,e),c=Xe(s,t,r,e,i,o,u);return{form:f,sum:c,value:Or(f,c)}}function Gr(n,t,r){if([n,t,r].every(Number.isFinite)&&(n=C(n),t=C(t),r=C(r),!(n<0||t<0||r<0||r>n+t)))return[n,t,r]}function we(n,t,r,e,i,o){if([n,t,r,e].some(Number.isNaN))return NaN;let u=Gr(t,r,e);if(u===void 0)return NaN;[t,r,e]=u;let s=Math.floor(n+1e-7),[f,c]=Vt(t,r,e);return s<f?I(i,o):s>=c?b(i,o):Hr(s,t,r,e,i,o)}function Ze(n,t,r,e,i,o){if([n,t,r,e].some(Number.isNaN))return NaN;let u=Gr(t,r,e);if(u===void 0)return NaN;[t,r,e]=u;let[s,f]=Vt(t,r,e),c=L(n,s,f,i,o);if(c!==void 0)return c;if(s===f)return s;let a=t+r,N=e*t/a,h=Math.sqrt(e*t/a*(r/a)*(a-e)/Math.max(a-1,1)),l=R(n,{lowerTail:i,logP:o}),m=N+h*l;return j({p:n,lowerTail:i,logP:o,cdf:(M,p,d)=>M<s?I(p,d):M>=f?b(p,d):Hr(M,t,r,e,p,d),y0:Number.isFinite(m)?m:N,lo:s,hi:f})}function Lu(n,t,r,e,i={}){let o=i.log??!1;return g(n,u=>Ve(u,t,r,e,o))}function _u(n,t,r,e,i={}){let{lowerTail:o=!0,logP:u=!1}=i;return g(n,s=>we(s,t,r,e,o,u))}function Du(n,t,r,e,i={}){let{lowerTail:o=!0,logP:u=!1}=i;return g(n,s=>Ze(s,t,r,e,o,u))}var $e=2**900,Qr=-900,tt=new Map,Ye=2**21,Xt=0,Te=2**25;function Pe(n,t){if(t+1>Te)throw new RangeError(`signrank: n = ${n} needs too large a table (${t+1} entries)`);let r=new Float64Array(t+1);r[0]=1;let e=0,i=Math.min(n,t);for(let f=1;f<=i;f++){for(let c=t;c>=f;c--)r[c]+=r[c-f];if(r[Math.min(t,Math.floor(f*(f+1)/4))]>$e){let c=2**Qr;for(let a=0;a<=t;a++)r[a]*=c;e-=Qr}}let o=new Float64Array(t+1),u=0,s=0;for(let f=0;f<=t;f++){let c=r[f]-s,a=u+c;s=a-u-c,u=a,o[f]=u}return{n,len:t+1,count:r,cum:o,scale:e}}function gn(n,t){let r=tt.get(n);if(r!==void 0&&r.len>t)return tt.delete(n),tt.set(n,r),r;let e=Math.floor(n*(n+1)/4),i=Math.min(e,Math.max(t,r===void 0?0:2*r.len)),o=Pe(n,i);r!==void 0&&(tt.delete(n),Xt-=r.len),tt.set(n,o),Xt+=o.len;for(let[u,s]of tt){if(Xt<=Ye||u===n)break;tt.delete(u),Xt-=s.len}return o}function bn(n,t,r){let e=t.scale-t.n,i=Math.trunc(e/2),o=n*2**i*2**(e-i);return r?o>=1e-300?Math.log(o):Math.log(n)+e*Math.LN2:o}function In(n){return Number.isFinite(n)?(n=C(n),n<=0?NaN:n):NaN}function Je(n,t,r){if(Number.isNaN(n)||Number.isNaN(t))return NaN;if(t=In(t),Number.isNaN(t))return NaN;if(U(n))return y(r);n=C(n);let e=t*(t+1)/2;if(n<0||n>e)return y(r);let i=Math.min(n,e-n),o=gn(t,i);return bn(o.count[i],o,r)}function jr(n,t,r,e){let i=t*(t+1)/2,o=n,u=i-n-1,s=r?o:u,f=r?u:o;if(s<=f){let N=gn(t,s);return bn(N.cum[s],N,e)}let c=gn(t,f),a=bn(c.cum[f],c,!1);return e?Math.log1p(-a):1-a}function ze(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t))return NaN;if(t=In(t),Number.isNaN(t))return NaN;let i=C(n+1e-7),o=t*(t+1)/2;return i<0?I(r,e):i>=o?b(r,e):jr(i,t,r,e)}function ke(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t))return NaN;if(t=In(t),Number.isNaN(t))return NaN;let i=t*(t+1)/2,o=L(n,0,i,r,e);if(o!==void 0)return o;let u=i/2,s=Math.sqrt(t*(t+1)*(2*t+1)/24),f=u+s*R(n,{lowerTail:r,logP:e});return j({p:n,lowerTail:r,logP:e,cdf:(c,a,N)=>c<0?I(a,N):c>=i?b(a,N):jr(c,t,a,N),y0:Number.isFinite(f)?f:u,lo:0,hi:i})}function qu(n,t,r={}){let e=r.log??!1;return g(n,i=>Je(i,t,e))}function Wu(n,t,r={}){let{lowerTail:e=!0,logP:i=!1}=r;return g(n,o=>ze(o,t,e,i))}function Ou(n,t,r={}){let{lowerTail:e=!0,logP:i=!1}=r;return g(n,o=>ke(o,t,e,i))}var $t=960,ti=2**25,wt=134217729,nt=new Map,ni=2**21,Zt=0;function ri(n,t,r){if(r+1>ti)throw new RangeError(`wilcox: m = ${n}, n = ${t} needs too large a table (${r+1} entries)`);let e=new Float64Array(r+1),i=new Float64Array(r+1);e[0]=2**$t;for(let f=1;f<=n;f++){let c=Math.min(r,f*t),a=t+f,N=wt*f,h=N-(N-f),l=f-h;N=wt*a;let m=N-(N-a),M=a-m;for(let d=0;d<=c;d++){let x=e[d];if(x===0)continue;let v=x*f;N=wt*x;let D=N-(N-x),lt=x-D,mt=D*h-v+D*l+lt*h+lt*l+i[d]*f,B=v/a,et=B*a;N=wt*B;let it=N-(N-B),ot=B-it,he=it*m-et+it*M+ot*m+ot*M,Qn=(v-et-he+mt)/a,jn=B+Qn;i[d]=Qn-(jn-B),e[d]=jn}let p=t+f;for(let d=c;d>=p;d--)Kr(e,i,d,d-p,-1);for(let d=f;d<=c;d++)Kr(e,i,d,d-f,1)}let o=new Float64Array(r+1),u=0,s=0;for(let f=0;f<=r;f++){let c=e[f],a=u+c,N=a-u,h=u-(a-N)+(c-N);h+=s+i[f],u=a+h,s=h-(u-a),o[f]=u}return{m:n,n:t,len:r+1,prob:e,cum:o}}function Kr(n,t,r,e,i){let o=n[r],u=i*n[e],s=o+u,f=s-o,c=o-(s-f)+(u-f);c+=t[r]+i*t[e];let a=s+c;t[r]=c-(a-s),n[r]=a}function yn(n,t,r){n>t&&([n,t]=[t,n]);let e=`${n},${t}`,i=nt.get(e);if(i!==void 0&&i.len>r)return nt.delete(e),nt.set(e,i),i;let o=Math.floor(n*t/2),u=Math.min(o,Math.max(r,i===void 0?0:2*i.len)),s=ri(n,t,u);i!==void 0&&(nt.delete(e),Zt-=i.len),nt.set(e,s),Zt+=s.len;for(let[f,c]of nt){if(Zt<=ni||f===e)break;nt.delete(f),Zt-=c.len}return s}function vn(n,t){let r=n*2**-($t/2)*2**-($t/2);return t?r>=1e-300?Math.log(r):Math.log(n)-$t*Math.LN2:r}function Fn(n,t){if(!(!Number.isFinite(n)||!Number.isFinite(t)))return n=C(n),t=C(t),n<=0||t<=0?void 0:[n,t]}function ei(n,t,r,e){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;let i=Fn(t,r);if(i===void 0)return NaN;if([t,r]=i,U(n))return y(e);n=C(n);let o=t*r;if(n<0||n>o)return y(e);let u=Math.min(n,o-n);return vn(yn(t,r,u).prob[u],e)}function Vr(n,t,r,e,i){let o=t*r,u=e?n:o-n-1,s=e?o-n-1:n;if(u<=s)return vn(yn(t,r,u).cum[u],i);let f=vn(yn(t,r,s).cum[s],!1);return i?Math.log1p(-f):1-f}function ii(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;let o=Fn(t,r);if(o===void 0)return NaN;[t,r]=o;let u=Math.floor(n+1e-7);return u<0?I(e,i):u>=t*r?b(e,i):Vr(u,t,r,e,i)}function oi(n,t,r,e,i){if(Number.isNaN(n)||Number.isNaN(t)||Number.isNaN(r))return NaN;let o=Fn(t,r);if(o===void 0)return NaN;[t,r]=o;let u=t*r,s=L(n,0,u,e,i);if(s!==void 0)return s;let f=u/2,c=Math.sqrt(u*(t+r+1)/12),a=f+c*R(n,{lowerTail:e,logP:i});return j({p:n,lowerTail:e,logP:i,cdf:(N,h,l)=>N<0?I(h,l):N>=u?b(h,l):Vr(N,t,r,h,l),y0:Number.isFinite(a)?a:f,lo:0,hi:u})}function Vu(n,t,r,e={}){let i=e.log??!1;return g(n,o=>ei(o,t,r,i))}function Xu(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1}=e;return g(n,u=>ii(u,t,r,i,o))}function wu(n,t,r,e={}){let{lowerTail:i=!0,logP:o=!1}=e;return g(n,u=>oi(u,t,r,i,o))}var T=128,Sn=Number.EPSILON,Bn=Float64Array.from({length:2*T+1},(n,t)=>Math.cos(Math.PI*t/T));function ui(n){let t=new Float64Array(n+1);for(let r=0;r<=n;r++){let e=0;for(let i=0;i<=n;i+=2)e+=(i===0||i===n?.5:1)*Bn[i*r%(2*n)*(T/n)]*2/(1-i*i);t[r]=(r===0||r===n?.5:1)*2*e/n}return t}var si=new Map([16,32,64,128].map(n=>[n,ui(n)]));function fi(n,t){let r=si.get(t),e=T/t,i=0,o=0;for(let s=0;s<=t;s++)i+=r[s]*n[s],o+=Math.abs(r[s]*n[s]);let u=0;for(let s=t-7;s<=t;s++){let f=.5*(n[0]+(s%2===0?n[t]:-n[t]));for(let c=1;c<t;c++)f+=n[c]*Bn[s*c%(2*t)*e];f*=2/t,s===t&&(f*=.5),u=Math.max(u,Math.abs(f))}return{integral:i,tail:u,scale:o}}var _t=class{f;a;b;c;h;values=new Float64Array(T+1);have=new Uint8Array(T+1);N=0;integral=0;error=1/0;constructor(t,r,e){this.f=t,this.a=r,this.b=e,this.c=.5*(r+e),this.h=.5*(e-r)}advance(t){let r=T/t,e=new Float64Array(t+1);for(let o=0;o<=t;o++){let u=o*r;this.have[u]||(this.values[u]=this.f(this.c+this.h*Bn[u]),this.have[u]=1),e[o]=this.values[u]}let i=fi(e,t);this.N=t,this.integral=i.integral*this.h,this.error=Math.max(i.tail*4/t,4*Sn*i.scale)*Math.abs(this.h)}};function Tt(n,t,r){let e=[];for(let o=0;o+1<t.length;o++){let u=new _t(n,t[o],t[o+1]);u.advance(16),e.push(u)}for(let o=0;o<40;o++){let u=0;for(let a of e)u+=a.integral;let s=r*Math.abs(u)/e.length,f=!0,c=[];for(let a of e){if(a.error<=s||a.error<=4*Sn*Math.abs(a.integral)){c.push(a);continue}if(f=!1,a.N<T)a.advance(2*a.N),c.push(a);else{let N=new _t(n,a.a,a.c),h=new _t(n,a.c,a.b);N.advance(16),h.advance(16),c.push(N,h)}}if(e=c,f)break}let i=0;for(let o of e)i+=o.integral;return i}function wr(n,t,r){let e=Math.max(1,Math.ceil((t-n)/r));return Array.from({length:e+1},(i,o)=>o===e?t:n+(t-n)*o/e)}var Zr=2e-15,$r=1e-16,ai={lowerTail:!1},ci={logP:!0},Ni={lowerTail:!1,logP:!0},Et=.9189385332046728,Pt=n=>dt(n),ct=n=>dt(n,ai),qn=n=>dt(n,ci),Wn=n=>dt(n,Ni),hi=.3989422804014327;function Nt(n){let t=Math.round(n*16)/16,r=n-t;return hi*Math.exp(-.5*t*t)*Math.exp(-.5*r*(n+t))}var _n=[.1834346424956498,.525532409916329,.7966664774136267,.9602898564975363],Yr=[.362683783378362,.31370664587788727,.22238103445337448,.10122853629037626];function li(n,t){let r=n-.5*t,e=.5*t,i=0;for(let o=0;o<4;o++)i+=Yr[o]*(Nt(r-e*_n[o])+Nt(r+e*_n[o]));return i*e}function mi(n,t){let r=n-.5*t,e=.5*t,i=0;for(let o=0;o<4;o++){let u=e*_n[o];i+=Yr[o]*(Math.exp(r*u-u*u/2)+Math.exp(-r*u-u*u/2))}return-Et-r*r/2+Math.log(i*e)}var On=(n,t)=>t*Math.max(1,Math.abs(n),Math.abs(n-t))<.5;function ht(n,t){let r=n-t,e=r-n,i=n-(r-e)+(-t-e);return{ah:r,al:i}}function Dt(n,t){return Pt(n)+Nt(n)*t}function Mi(n,t){return ct(n)-Nt(n)*t}function Tr(n,t){if(On(n,t))return li(n,t);let{ah:r,al:e}=ht(n,t);return r>=0?Mi(r,e)-ct(n):n<=0?Pt(n)-Dt(r,e):1-Dt(r,e)-ct(n)}function di(n,t,r){if(n>0&&n-t<0&&!On(n,t)){let{ah:i,al:o}=ht(n,t);return Math.exp(r*Math.log1p(-(Dt(i,o)+ct(n))))}let e=Tr(n,t);return e>0?e**r:0}function pi(n,t){return n>0?Math.exp(t*Math.log1p(-ct(n))):Pt(n)**t}function Pr(n,t){let{ah:r,al:e}=ht(n,t),i=qn(r);return i+e*Math.exp(-Et-r*r/2-i)}function gi(n,t){let{ah:r,al:e}=ht(n,t),i=Wn(r);return i-e*Math.exp(-Et-r*r/2-i)}function Jr(n,t){if(On(n,t))return mi(n,t);if(n-t>=0){let o=gi(n,t);return o+Math.log(-Math.expm1(Wn(n)-o))}if(n<=0){let o=qn(n);return o+Math.log(-Math.expm1(Pr(n,t)-o))}let{ah:e,al:i}=ht(n,t);return Math.log1p(-Dt(e,i)-ct(n))}var zr=2,xn=1e-18;function kr(n,t,r){let e=wr(t,r,zr),i=e.map(n),o=0;for(let h=1;h<i.length;h++)i[h]>i[o]&&(o=h);let u=i[o];if(!(u>0))return 0;let s=Math.max(o-1,0),f=Math.min(o+1,i.length-1);for(;s>0&&i[s]>u*xn;)s--;for(;f<i.length-1&&i[f]>u*xn;)f++;let c=u*xn,a=e[s],N=e[f];if(i[s]<=c){let h=e[s+1];for(let l=0;l<2;l++){let m=.5*(a+h);n(m)<=c?a=m:h=m}}if(i[f]<=c){let h=e[f-1];for(let l=0;l<2;l++){let m=.5*(N+h);n(m)<=c?N=m:h=m}}return Tt(n,[a,N],$r)}function te(n,t,r){let e=wr(t,r,zr),i=e.map(n),o=0;for(let v=1;v<i.length;v++)i[v]>i[o]&&(o=v);if(!(i[o]>-1/0))return-1/0;let u=e[Math.max(o-1,0)],s=e[Math.min(o+1,e.length-1)],f=(Math.sqrt(5)-1)/2,c=s-f*(s-u),a=u+f*(s-u),N=n(c),h=n(a);for(let v=0;v<80&&s-u>1e-12*Math.max(1,Math.abs(u));v++)N<h?(u=c,c=a,N=h,a=u+f*(s-u),h=n(a)):(s=a,a=c,h=N,c=s-f*(s-u),N=n(c));let l=N>h?c:a,m=Math.max(N,h);i[o]>m&&(l=e[o],m=i[o]);let M=v=>{let D=v<0?t:r,lt=Math.max(1e-6,.001*(e[1]-e[0])),mt=l;for(;;){let B=l+v*lt;if(v<0?B<=D:B>=D)return D;if(n(B)<m-46){let et=B;for(let it=0;it<6;it++){let ot=.5*(mt+et);n(ot)<m-46?et=ot:mt=ot}return et}mt=B,lt*=2}},p=M(-1),d=M(1),x=[...new Set([p,l,d])].sort((v,D)=>v-D);return m+Math.log(Tt(v=>Math.exp(n(v)-m),x,$r))}var Un=-10,Hn=10;function bi(n,t){return n<=0?0:t*kr(r=>Nt(r)*di(r,n,t-1),Un,Hn)}function ne(n,t){if(n<=0)return 1;let r=o=>{let u=Pt(o);if(u===0)return 0;let{ah:s,al:f}=ht(o,n),c=Dt(s,f),a=c<.5*u?-Math.expm1((t-1)*Math.log1p(-c/u)):-Math.expm1((t-1)*Math.log(Tr(o,n)/u));return Nt(o)*pi(o,t-1)*a};if(n>60)return 0;let[e,i]=re(n);return t*kr(r,e,i)}function re(n){return n>40?[n/2-15,n/2+15]:[Un,n+Hn]}function ee(n,t){if(n>100)return-Math.exp(ie(n,t));let r=e=>-Et-e*e/2+(t-1)*Jr(e,n);return Math.log(t)+te(r,Un,Hn)}function ie(n,t){if(n>100)return Math.log(t*(t-1))+Wn(n/Math.SQRT2);let r=o=>{let u=qn(o),s=Pr(o,n)-u,f;return s<-40?f=Math.log(t-1)+s:s<-Math.LN2?f=Math.log(-Math.expm1((t-1)*Math.log1p(-Math.exp(s)))):f=Math.log(-Math.expm1((t-1)*(Jr(o,n)-u))),-Et-o*o/2+(t-1)*u+f},[e,i]=re(n);return Math.log(t)+te(r,e,i)}function Ii(n,t){let r=-1/0;for(let e of t)r=Math.max(r,n(e));for(let e=0;e+1<t.length;e++)r=Math.max(r,n(.5*(t[e]+t[e+1])));if(r===-1/0)return-1/0;for(let e=0;e<4;e++){let i=r,o=Tt(u=>{let s=n(u);return s>i&&(i=s),Math.exp(s-r)},t,Zr);if(Number.isFinite(o)&&i-r<300)return r+Math.log(o);r=i}return NaN}var Y=32,yi=1e-15,at=Math.log(.01),Gn=Math.log(20),oe=Math.log(40),ue=Float64Array.from({length:2*Y+1},(n,t)=>Math.cos(Math.PI*t/Y));function vi(n,t){let r=new Float64Array(t+1);for(let e=0;e<=t;e++){let i=.5*(n[0]+(e%2===0?n[t]:-n[t]));for(let o=1;o<t;o++)i+=n[o]*ue[e*o%(2*t)];i*=2/t,(e===0||e===t)&&(i*=.5),r[e]=i}return r}function Ln(n,t,r){let e=[],i=[[t,r,0]];for(;i.length>0;){let[o,u,s]=i.pop(),f=.5*(o+u),c=.5*(u-o),a=new Float64Array(Y+1),N=1/0;for(let m=0;m<=Y;m++)a[m]=n(f+c*ue[m]),N=Math.min(N,Math.max(1,Math.abs(a[m])));let h=vi(a,Y),l=0;for(let m=Y-3;m<=Y;m++)l=Math.max(l,Math.abs(h[m]));l<=yi*N||s>=14||!a.every(Number.isFinite)?e.push({a:o,b:u,coef:h}):i.push([f,u,s+1],[o,f,s+1])}return e.sort((o,u)=>o.a-u.a)}function Dn(n,t){let r=0,e=n.length-1;for(;r<e;){let a=r+e+1>>1;n[a].a<=t?r=a:e=a-1}let{a:i,b:o,coef:u}=n[r],s=(2*t-i-o)/(o-i),f=0,c=0;for(let a=Y;a>=1;a--){let N=2*s*f-c+u[a];c=f,f=N}return s*f-c+u[0]}var Lt=new Map,Fi=64,se=Math.log(1e-10);function fe(n){let t=Lt.get(n);if(t!==void 0)return t;let r=i=>{let o=bi(i,n);return o>1e-290?Math.log(o):ee(i,n)},e=i=>{let o=Math.exp(i);return ne(o,n)*ae(o)};return t={logW:Ln(i=>r(Math.exp(i)),at,Gn),scaledWc:Ln(e,at,oe),smallW:Ln(i=>r(Math.exp(i))-(n-1)*i,se,at)},Lt.size>=Fi&&Lt.delete(Lt.keys().next().value),Lt.set(n,t),t}function ae(n){let t=n*n,r=134217729*n,e=r-(r-n),i=n-e,o=e*e-t+2*e*i+i*i;return Math.exp(t/4)*(1+o/4)}function xi(n,t){let r=Math.log(n);if(r>=Gn)return 0;let e=fe(t);return r>=at?Dn(e.logW,r):Dn(e.smallW,Math.max(r,se))+(t-1)*r}function En(n,t){return Math.log(n)>=Gn?1:Math.exp(xi(n,t))}function Li(n,t){let r=Math.log(n);return r>=at&&r<=oe?Dn(fe(t).scaledWc,r)/ae(n):r<at?1-En(n,t):ne(n,t)}function Yt(n,t,r,e){if(!e){let o=Math.min(En(n,t),1);return r===1?o:o**r}let i=Math.min(Li(n,t),1);return i<=.5?r===1?i:-Math.expm1(r*Math.log1p(-i)):1-Math.min(En(n,t),1)**r}function Cn(n,t,r,e){if(!e)return r*ee(n,t);let i=ie(n,t);return r===1?i:Math.log(-Math.expm1(r*Math.log1p(-Math.exp(i))))}function An(n,t,r,e,i){if(r===1/0)return Yt(n,t,e,i);let o=r/2,u=Math.log(o),s=_i(o);return Tt(c=>{let{d:a,s:N}=s(c);return a===0?0:a*Yt(n*N,t,e,i)},ce(n,t,r,e,i).map(c=>c-u),Zr)}function _i(n){let t=At(n),r=Math.sqrt(n/(2*Math.PI));return e=>{let i;if(Math.abs(e)<.5){let o=e*e/2;i=o;for(let u=3;u<60&&(o*=e/u,i+=o,!(Math.abs(o)<1e-17*i));u++);}else i=Math.expm1(e)-e;return{d:r*Math.exp(-t-n*i),s:Math.exp(.5*e)}}}function Di(n,t,r,e,i){if(r===1/0)return Cn(n,t,e,i);let o=r/2,u=Math.log(o),s=X(o+1);return Ii(c=>{let a=Math.exp(c),N=a>1e-300?A(o,a,!0):o*c-a-s;return u+N+Cn(Math.exp(Math.log(n)+.5*(c-u)),t,e,i)},ce(n,t,r,e,i,!0))}function ce(n,t,r,e,i,o=!1){let u=r/2,s=u,f=Math.log(u);if(i){let v=2*Math.log(n)-Math.log(4*u);f-=v>30?v:Math.log1p(Math.exp(v))}else s=u+(t-1)*e/2,f=Math.log(s);let c=(v,D)=>[v-9/Math.sqrt(D)-41/D,v+9/Math.sqrt(D)+Math.log1p(41/D)],[a,N]=c(Math.log(u),u),[h,l]=c(f,s),m=o?Math.min(a,h):Math.max(Math.min(a,h),-740),M=Math.max(N,l),p=1/Math.sqrt(u),d=1/Math.sqrt(s),x=[m,Math.min(Math.log(u)-4*p,f-4*d),Math.max(Math.log(u)+4*p,f+4*d),M];return[...new Set(x.map(v=>Math.min(Math.max(v,m),M)))].sort((v,D)=>v-D)}function Ne(n,t,r){return n>=2&&t>=2&&r>=1&&Number.isFinite(n)&&Number.isFinite(r)&&!Number.isNaN(t)}function Rn(n,t,r,e,i,o){let u;return rt!==void 0&&rt.q===n&&rt.k===t&&rt.df===r&&rt.r===e?u=rt.tail:(u=Ei(n,t,r,e,!i),rt={q:n,k:t,df:r,r:e,tail:u}),u.upper===!i?o?u.log:u.value:o?Math.log1p(-u.value):1-u.value}var rt;function Ei(n,t,r,e,i){let o=i;r!==1/0&&Yt(n,t,e,o)>.5&&(o=!o);let u=An(n,t,r,e,o);if(u>.5){let s=An(n,t,r,e,!o);s<u&&(u=s,o=!o)}if(u<1e-290){let s=Di(n,t,r,e,o);return{upper:o,value:Math.exp(s),log:s}}return{upper:o,value:u,log:Math.log(u)}}function Ci(n,t,r,e,i,o){return[n,t,r,e].some(Number.isNaN)?NaN:Ne(t,r,e)?n<=0?I(i,o):n===1/0?b(i,o):Rn(n,t,r,e,i,o):NaN}function Ai(n,t,r,e,i,o){if([n,t,r,e].some(Number.isNaN))return NaN;if(!Ne(t,r,e))return NaN;let u=L(n,0,1/0,i,o);if(u!==void 0)return u;let{lower:s,logTarget:f,linearTarget:c}=S(n,i,o),a=h=>l=>{let m=Math.exp(l);if(c!==void 0&&c>1e-290){let p=h===1/0?An(m,t,h,e,!s):Rn(m,t,h,e,s,!1);if(p>0)return Math.log(p/c)}return(h===1/0?Ri(m,t,e,s):Rn(m,t,h,e,s,!0))-f},N=Xr(a(1/0),Math.log(3),s);return Math.exp(r===1/0?N:Xr(a(r),N,s))}function Ri(n,t,r,e){let i=Yt(n,t,r,!e);return i>1e-290?Math.log(i):Cn(n,t,r,!e)}function Xr(n,t,r){let e=t,i=n(e);if(i===0)return e;let o=i>0===r?-1:1,u=.05,s=e+o*u,f=n(s);for(let c=0;c<200&&Math.sign(f)===Math.sign(i)&&f!==0;c++)e=s,i=f,u*=2,s=e+o*u,f=n(s);return f===0?s:!Number.isFinite(f)||Math.sign(f)===Math.sign(i)?Number.isFinite(f)?s:e:Si(n,e,s,i,f)}function Si(n,t,r,e,i){let o=t,u=e,s=r-t,f=s;for(let c=0;c<100;c++){Math.sign(i)===Math.sign(u)&&(o=t,u=e,s=r-t,f=s),Math.abs(u)<Math.abs(i)&&(t=r,r=o,o=t,e=i,i=u,u=e);let a=2*Sn*Math.abs(r)+1e-300,N=.5*(o-r);if(Math.abs(N)<=a||i===0)return r;if(Math.abs(f)>=a&&Math.abs(e)>Math.abs(i)){let h=i/e,l,m;if(t===o)l=2*N*h,m=1-h;else{let M=e/u,p=i/u;l=h*(2*N*M*(M-p)-(r-t)*(p-1)),m=(M-1)*(p-1)*(h-1)}l>0?m=-m:l=-l,2*l<Math.min(3*N*m-Math.abs(a*m),Math.abs(f*m))?(f=s,s=l/m):(s=N,f=N)}else s=N,f=N;t=r,e=i,r+=Math.abs(s)>a?s:N>0?a:-a,i=n(r)}return r}function zu(n,t,r,e={}){let{nranges:i=1,lowerTail:o=!0,logP:u=!1}=e;return g(n,s=>Ci(s,t,r,i,o,u))}function ku(n,t,r,e={}){let{nranges:i=1,lowerTail:o=!0,logP:u=!1}=e;return g(n,s=>Ai(s,t,r,i,o,u))}export{nn as a,st as b,qt as c,J as d,wi as e,Zi as f,$i as g,gr as h,br as i,Ir as j,j as k,ge as l,be as m,Ie as n,eo as o,io as p,oo as q,Nn as r,Kt as s,ru as t,eu as u,iu as v,fn as w,Qt as x,yo as y,vo as z,Fo as A,Ge as B,Qe as C,mu as D,Mu as E,du as F,Ve as G,we as H,Ze as I,Lu as J,_u as K,Du as L,ze as M,ke as N,qu as O,Wu as P,Ou as Q,ii as R,oi as S,Vu as T,Xu as U,wu as V,zu as W,ku as X};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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{d as f,f as a,g,j as l}from"./chunk-UGUQYWRQ.js";function m(t){let n=t.length;if(!t.every(Number.isFinite))return[t.reduce((o,s)=>o+s,0)/n,0];let r=[0,0];for(let o of t)r=f(r,[o,0]);let i=l(r,n);if(!Number.isFinite(i[0]))return[r[0]/n,0];let e=[0,0];for(let o of t)e=f(e,a([o,0],i));return f(i,l(e,n))}function y(t){return t.length===0?NaN:m(t)[0]}function A(t){return M(t,t)}function M(t,n){let r=t.length;if(r<2)return NaN;let i=m(t),e=t===n?i:m(n);if(!Number.isFinite(i[0])||!Number.isFinite(e[0]))return NaN;let o=t.map(u=>a([u,0],i)),s=t===n?o:n.map(u=>a([u,0],e)),c=v(o),N=t===n?c:v(s),p=2**-c,d=2**-N,h=[0,0];for(let u=0;u<r;u++){let b=[o[u][0]*p,o[u][1]*p],w=[s[u][0]*d,s[u][1]*d];h=f(h,g(b,w))}return l(h,r-1)[0]*2**c*2**N}function v(t){let n=0;for(let r of t)n=Math.max(n,Math.abs(r[0]));return n===0||!Number.isFinite(n)?0:Math.max(-1022,Math.floor(Math.log2(n)))}function D(t){let n=[0,0];for(let r of t)n=f(n,[r,0]);return n[0]}function j(t){let n=t.length,r=Array.from({length:n},(o,s)=>s);r.sort((o,s)=>t[o]-t[s]||o-s);let i=new Array(n),e=0;for(;e<n;){let o=e;for(;o+1<n&&t[r[o+1]]===t[r[e]];)o++;let s=(e+o+2)/2;for(let c=e;c<=o;c++)i[r[c]]=s;e=o+1}return i}function E(t){let n=[...t].sort((e,o)=>e-o),r=[],i=0;for(;i<n.length;){let e=i;for(;e+1<n.length&&n[e+1]===n[i];)e++;e>i&&r.push(e-i+1),i=e+1}return r}function C(t){return t.filter(n=>!Number.isNaN(n))}function P(t,n){if(t.length!==n.length)throw new TypeError("x and y must have the same length");let r=[],i=[];for(let e=0;e<t.length;e++)!Number.isNaN(t[e])&&!Number.isNaN(n[e])&&(r.push(t[e]),i.push(n[e]));return[r,i]}export{m as a,y as b,A as c,M as d,D as e,j as f,E as g,C as h,P as i};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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{k as D}from"./chunk-XM2TVD63.js";import{a as I,f as $,g as L,i as K}from"./chunk-7NK4SA6B.js";import{g as v,h as O}from"./chunk-QNAIK4PY.js";import{b as z,c as H,d as w,f as C,g as F,i as j}from"./chunk-UGUQYWRQ.js";function Z(t){if(t===void 0)return"two.sided";let o=["two.sided","less","greater"].filter(r=>r.startsWith(t));if(t.length===0||o.length!==1)throw new RangeError(`invalid alternative "${t}" (expected "two.sided", "less" or "greater")`);return o[0]}function B(t){if(!(Number.isFinite(t)&&t>=0&&t<=1))throw new RangeError("confLevel must be a number between 0 and 1")}function ft(t){if(!(Number.isFinite(t)&&t>0&&t<1))throw new RangeError("'conf.level' must be a single number between 0 and 1")}var ot=["pearson","kendall","spearman"];function st(t){if(t===void 0)return"pearson";let e=ot.filter(o=>o.startsWith(t));if(t.length===0||e.length!==1)throw new RangeError(`invalid method "${t}"`);return e[0]}function G(t){if(!(t[0]>0))return[Math.sqrt(t[0]),0];let e=Math.sqrt(t[0]),o=C(t,H(e,e));return z(e,o[0]/(2*e))}function J(t){let e=I(t);if(!Number.isFinite(e[0]))return;let o=t.map(i=>C([i,0],e)),r=0;for(let i of o)r=Math.max(r,Math.abs(i[0]));if(r===0)return o;let a=2**-Math.max(-1022,Math.floor(Math.log2(r)));return o.map(i=>[i[0]*a,i[1]*a])}function Q(t,e){let o=t.length;if(o<2)return[NaN,0];let r=J(t),a=J(e);if(r===void 0||a===void 0)return[NaN,0];let i=[0,0],c=[0,0],s=[0,0];for(let u=0;u<o;u++)i=w(i,F(r[u],a[u])),c=w(c,F(r[u],r[u])),s=w(s,F(a[u],a[u]));if(c[0]===0||s[0]===0)return[NaN,0];let n=j(i,F(G(c),G(s)));return n[0]>=1?[1,0]:n[0]<=-1?[-1,0]:n}function U(t,e){let o=F(C([1,0],t),w([1,0],t));return Math.sqrt(e)*t[0]/Math.sqrt(o[0])}function at(t){return Math.abs(t[0])<.5?Math.atanh(t[0]):.5*Math.log(w([1,0],t)[0]/C([1,0],t)[0])}function X(t,e,o){return o==="less"?D(t,e,!0,!1):o==="greater"?D(t,e,!1,!1):2*Math.min(D(t,e,!0,!1),D(t,e,!1,!1))}function it(t,e){return e==="less"?v(t):e==="greater"?v(t,{lowerTail:!1}):2*Math.min(v(t),v(t,{lowerTail:!1}))}function ct(t,e){let o=t.length,r=0;for(let f=0;f<o;f++){let m=t[f],x=e[f];for(let p=f+1;p<o;p++){let N=(t[p]>m?1:0)-(t[p]<m?1:0),W=(e[p]>x?1:0)-(e[p]<x?1:0);r+=N*W}}let a=L(t),i=L(e),c=o*(o-1)/2,s=a.reduce((f,m)=>f+m*(m-1)/2,0),n=i.reduce((f,m)=>f+m*(m-1)/2,0),u=o<2||s===c||n===c?NaN:s===0&&n===0?r/c:r/Math.sqrt((c-s)*(c-n));return{s:r,tau:u,ties:a.length>0||i.length>0,tx:a,ty:i}}function Y(t,e){let o=t*(t-1)/2;if(e<0)return 0;if(e>=o)return 1;let r=new Float64Array(e+1);r[0]=1;for(let i=2;i<=t;i++){let c=new Float64Array(e+1),s=0;for(let u=0;u<=e;u++)s+=r[u],c[u]=s;let n=new Float64Array(e+1);for(let u=0;u<=e;u++)n[u]=(c[u]-(u>=i?c[u-i]:0))/i;r=n}let a=0;for(let i=e;i>=0;i--)a+=r[i];return Math.min(1,a)}var _=new Map;function ut(t){let e=_.get(t);if(e!==void 0)return e;let o=t*(t*t-1)/3,r=1<<t,a=new Array(r);a[0]=new Float64Array(o+1),a[0][0]=1;let i=s=>{let n=0;for(;s;s&=s-1)n++;return n};for(let s=0;s<r;s++){let n=a[s];if(n===void 0)continue;let u=i(s);for(let f=0;f<t;f++){if(s&1<<f)continue;let m=(f-u)**2,x=s|1<<f,p=a[x]??=new Float64Array(o+1);for(let N=0;N+m<=o;N++)n[N]&&(p[N+m]+=n[N])}s!==r-1&&(a[s]=void 0)}let c=a[r-1];return _.set(t,c),c}var d=[.2274,.2531,.1745,.0758,.1033,.3932,.0879,.0151,.0072,.0831,.0131,46e-5];function tt(t,e,o){let r=e;r%2!==0&&(r+=1);let a=1/t,i=(6*(r-1)*a/(t*t-1)-1)*Math.sqrt(1/a-1),c=i*i,n=i*a*(d[0]+a*(d[1]+d[2]*a)+c*(-d[3]+a*(d[4]+d[5]*a)-c*a*(d[6]+d[7]*a-c*(d[8]-d[9]*a+c*a*(d[10]-d[11]*c)))))/Math.exp(c/2),u=o?v(i)-n:n+v(i,{lowerTail:!1});return Math.min(1,Math.max(0,u))}function et(t,e,o){let r=t*(t*t-1)/3;if(t<=9){let a=ut(t),i=1;for(let s=2;s<=t;s++)i*=s;let c=0;if(o)for(let s=Math.min(e,r);s>=0;s--)c+=a[s];else for(let s=r;s>=Math.max(e,0);s--)c+=a[s];return c/i}return o?e+1>r?1:e+1<=0?0:tt(t,e+1,!0):e<=0?1:e>r?0:tt(t,e,!1)}function Mt(t,e,o={}){if(t.length!==e.length)throw new TypeError("x and y must have the same length");let r=Z(o.alternative),a=st(o.method),i=o.continuity??!1,[c,s]=K(Array.from(t),Array.from(e)),n=c.length;if(a==="pearson"){let l=o.confLevel??.95;if(B(l),n<3)throw new Error("not enough finite observations");let g=Q(c,s),y=n-2,M=Number.isNaN(g[0])?NaN:U(g,y),k={method:"Pearson's product-moment correlation",alternative:r,statistic:M,statisticName:"t",parameter:y,parameterName:"df",pValue:X(M,y,r),estimate:g[0],estimateNames:"cor",nullValue:0,nullValueName:"correlation"};if(n>3){let P=at(g),A=1/Math.sqrt(n-3),V=b=>Math.tanh(P+b),E;if(r==="less")E=[-1,V(A*O(l))];else if(r==="greater")E=[V(-A*O(l)),1];else{let b=A*O((1+l)/2);E=[V(-b),V(b)]}k.confInt=E,k.confLevel=l}return k}if(n<2)throw new Error("not enough finite observations");if(a==="kendall"){let l=ct(c,s),g={method:"Kendall's rank correlation tau",alternative:r,estimate:l.tau,estimateNames:"tau",nullValue:0,nullValueName:"tau"};if(Number.isNaN(l.tau))return{...g,statistic:NaN,statisticName:"T",pValue:NaN};if((o.exact??n<50)&&!l.ties){let h=n*(n-1)/2,S=(l.s+h)/2,q=Y(n,S),R=Y(n,h-S),rt=r==="less"?q:r==="greater"?R:Math.min(1,2*Math.min(q,R));return{...g,statistic:S,statisticName:"T",pValue:rt}}let M=(h,S)=>S.reduce((q,R)=>q+h(R),0),k=h=>h*(h-1),P=h=>h*(h-1)*(h-2),A=h=>h*(h-1)*(2*h+5),V=(n*(n-1)*(2*n+5)-M(A,l.tx)-M(A,l.ty))/18+M(P,l.tx)*M(P,l.ty)/(9*n*(n-1)*(n-2))+M(k,l.tx)*M(k,l.ty)/(2*n*(n-1)),b=(i?Math.sign(l.s)*(Math.abs(l.s)-1):l.s)/Math.sqrt(V);return{...g,statistic:b,statisticName:"z",pValue:it(b,r)}}let u=$(c),f=$(s),m=Q(u,f),x=n*n*n-n,p=x*(1-m[0])/6,N={method:"Spearman's rank correlation rho",alternative:r,statistic:p,statisticName:"S",estimate:m[0],estimateNames:"rho",nullValue:0,nullValueName:"rho"};if(Number.isNaN(m[0]))return{...N,pValue:NaN};let W=L(c).length>0||L(s).length>0;if((o.exact??n<=1290)&&!W&&n<=1290){let l=Math.round(p),g=et(n,l,!0),y=et(n,l,!1),M=r==="greater"?g:r==="less"?y:Math.min(1,2*Math.min(g,y));return{...N,pValue:M}}let T=m;if(i){let l=j([6,0],[x,0]);T=j(w(m,l),w([1,0],l)),Math.abs(T[0])>=1&&(T=[Math.sign(T[0]),0])}let nt=U(T,n-2);return{...N,pValue:X(nt,n-2,r)}}export{Z as a,B as b,ft as c,Q as d,ct as e,Mt as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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
|
+
var q=2220446049250313e-31,b0=22250738585072014e-324,z=17976931348623157e292,v0=[.06667134430868814,.1494513491505806,.21908636251598204,.26926671930999635,.29552422471475287],f0=[.9956571630258081,.9739065285171717,.9301574913557082,.8650633666889845,.7808177265864169,.6794095682990244,.5627571346686047,.4333953941292472,.2943928627014602,.14887433898163122,0],I=[.011694638867371874,.032558162307964725,.054755896574351995,.07503967481091996,.0931254545836976,.10938715880229764,.12349197626206584,.13470921731147334,.14277593857706009,.14773910490133849,.1494455540029169];function h0(a,o,i,s,t){let r=Math.abs((a-o)*i);return t!==0&&r!==0&&(r=t*Math.min(1,Math.pow(200*r/t,1.5))),s>b0/(50*q)&&(r=Math.max(q*50*s,r)),r}function g0(a,o,i){let s=.5*(o+i),t=.5*(i-o),r=Math.abs(t),w=new Array(10),u=new Array(10),p=a(s),M=0,c=I[10]*p,b=Math.abs(c);for(let e=0;e<5;e++){let n=2*e+1,l=t*f0[n],h=a(s-l),v=a(s+l);w[n]=h,u[n]=v;let g=h+v;M+=v0[e]*g,c+=I[n]*g,b+=I[n]*(Math.abs(h)+Math.abs(v))}for(let e=0;e<5;e++){let n=2*e,l=t*f0[n],h=a(s-l),v=a(s+l);w[n]=h,u[n]=v;let g=h+v;c+=I[n]*g,b+=I[n]*(Math.abs(h)+Math.abs(v))}let A=c*.5,f=I[10]*Math.abs(p-A);for(let e=0;e<10;e++)f+=I[e]*(Math.abs(w[e]-A)+Math.abs(u[e]-A));return b*=r,f*=r,{result:c*t,abserr:h0(c,M,t,b,f),resabs:b,resasc:f}}var l0=[0,.1294849661688697,0,.27970539148927664,0,.3818300505051189,0,.4179591836734694],x0=[.9914553711208126,.9491079123427585,.8648644233597691,.7415311855993945,.5860872354676911,.4058451513773972,.20778495500789848,0],U=[.022935322010529224,.06309209262997856,.10479001032225019,.14065325971552592,.1690047266392679,.19035057806478542,.20443294007529889,.20948214108472782];function A0(a,o,i,s,t){let r=i>1?1:i,w=.5*(s+t),u=.5*(t-s),p=new Array(7),M=new Array(7),c=h=>{let v=o+r*(1-h)/h,g=a(v);return i===2&&(g+=a(-v)),g},b=c(w)/w/w,A=b*l0[7],f=b*U[7],e=Math.abs(f);for(let h=0;h<7;h++){let v=u*x0[h],g=w-v,W=w+v,m=c(g),x=c(W);m=m/g/g,x=x/W/W,p[h]=m,M[h]=x;let K=m+x;A+=l0[h]*K,f+=U[h]*K,e+=U[h]*(Math.abs(m)+Math.abs(x))}let n=f*.5,l=U[7]*Math.abs(b-n);for(let h=0;h<7;h++)l+=U[h]*(Math.abs(p[h]-n)+Math.abs(M[h]-n));return e*=u,l*=u,{result:f*u,abserr:h0(f,A,u,e,l),resabs:e,resasc:l}}function j0(a){let o=a.epstab,i=a.n;a.nres+=1;let s=z,t=o[a.n];if(a.n<2)return s=Math.max(s,5*q*Math.abs(t)),[t,s];let r=49;o[a.n+2]=o[a.n];let w=Math.trunc(a.n/2);o[a.n]=z;let u=a.n;for(let c=0;c<w;c++){let b=u-1,A=u-2,f=o[u+2],e=o[A],n=o[b],l=f,h=Math.abs(n),v=l-n,g=Math.abs(v),W=Math.max(Math.abs(l),h)*q,m=n-e,x=Math.abs(m),K=Math.max(h,Math.abs(e))*q;if(!(g>W||x>K))return t=f,s=g+x,s=Math.max(s,5*q*Math.abs(t)),[t,s];let k=o[u];o[u]=n;let j=n-k,F=Math.abs(j),_=Math.max(h,Math.abs(k))*q;if(F<=_||g<=W||x<=K){a.n=c+c;break}let L=1/j+1/v-1/m;if(!(Math.abs(L*n)>1e-4)){a.n=c+c;break}f=n+1/L,o[u]=f,u-=2;let X=g+Math.abs(f-l)+x;X>s||(s=X,t=f)}a.n===r&&(a.n=2*Math.trunc(r/2));let p=i%2;for(let c=0;c<=w;c++)o[2*c+p]=o[2*c+2+p];if(a.n!==i){let c=i-a.n;for(let b=0;b<=a.n;b++)o[b]=o[c],c++}let M=a.res3la;return a.nres<4?(M[a.nres-1]=t,s=z):(s=Math.abs(t-M[2])+Math.abs(t-M[1])+Math.abs(t-M[0]),M[0]=M[1],M[1]=M[2],M[2]=t),s=Math.max(s,5*q*Math.abs(t)),[t,s]}function y0(a,o,i,s,t,r){if(o<=2){t[0]=0,t[1]=1;let e=t[r];return[e,s[e],r]}let w=s[i];for(;r>0&&w>s[t[r-1]];)t[r]=t[r-1],r-=1;let u=o>Math.trunc(a/2)+2?a-o+2:o-1,p=s[o-1],M=u-1,c=r+1,b=c,A=!1;if(c<=M)for(b=c;b<=M;b++){if(w>=s[t[b]]){A=!0;break}t[b-1]=t[b]}if(!A)t[M]=i,t[u]=o-1;else{t[b-1]=i;let e=M;for(let n=b;n<=M&&!(p<s[t[e]]);n++)t[e+1]=t[e],e--;p<s[t[e]]?t[e+1]=o-1:t[b]=o-1}let f=t[r];return[f,s[f],r]}function M0(a,o,i,s,t,r,w,u){let p=new Float64Array(r+1),M=new Float64Array(r+1),c=new Float64Array(r+1),b=new Float64Array(r+1),A=new Int32Array(r+1),f=0,e=0,n=0,l=0;if(p[0]=o,M[0]=i,s<=0&&t<Math.max(50*q,5e-29))return{result:0,abserr:0,neval:0,ier:6,last:0};let h=a(o,i);n=h.result,l=h.abserr;let v=h.resabs,g=h.resasc,W=Math.abs(n),m=Math.max(s,t*W);if(e=1,c[0]=n,b[0]=l,A[0]=0,l<=100*q*v&&l>m&&(f=2),r===1&&(f=1),f!==0||l<=m&&l!==g||l===0)return{result:n,abserr:l,neval:u(e),ier:f,last:e};let x={epstab:new Float64Array(52),res3la:new Float64Array(3),n:1,nres:0};x.epstab[0]=n;let K=l,k=0,j=n,F=l;l=z;let _=0,L=0,E=!1,X=!1,B=0,t0=0,R=0,s0=0,C=0,O=0,D=0,e0=0,u0=W>=(1-50*q)*v?1:-1,a0=!1,y=1;for(y=1;y<r;y++){e=y+1;let d=p[k],H=.5*(p[k]+M[k]),J=H,S=M[k],i0=K,T=a(d,H),V=a(J,S),Y=T.result,N=T.abserr,k0=T.resasc,Z=V.result,P=V.abserr,w0=V.resasc,$=Y+Z,Q=N+P;if(F=F+Q-K,j=j+$-c[k],k0!==N&&w0!==P&&(Math.abs(c[k]-$)>1e-5*Math.abs($)||Q<.99*K||(E?R++:t0++),y>9&&Q>K&&s0++),c[k]=Y,c[y]=Z,m=Math.max(s,t*Math.abs(j)),(t0+R>=10||s0>=20)&&(f=2),R>=5&&(B=3),e===r&&(f=1),Math.max(Math.abs(d),Math.abs(S))<=(1+100*q)*(Math.abs(J)+1e3*b0)&&(f=4),P>N?(p[k]=J,p[y]=d,M[y]=H,c[k]=Z,c[y]=Y,b[k]=P,b[y]=N):(p[y]=J,M[k]=H,M[y]=S,b[k]=N,b[y]=P),[k,K,_]=y0(r,e,k,b,A,_),F<=m){a0=!0;break}if(f!==0)break;if(y===1){C=w,O=F,D=m,x.epstab[1]=j;continue}if(X)continue;if(O-=i0,Math.abs(H-d)>C&&(O+=Q),!E){if(Math.abs(M[k]-p[k])>C)continue;E=!0,_=1}if(!(B===3||O<=D)){let p0=e>2+Math.trunc(r/2)?r+3-e:e,o0=!1;for(let c0=_;c0<p0;c0++){if(k=A[_],K=b[k],Math.abs(M[k]-p[k])>C){o0=!0;break}_++}if(o0)continue}x.n+=1,x.epstab[x.n]=j;let[n0,r0]=j0(x);if(L+=1,L>5&&l<.001*F&&(f=5),r0<l&&(L=0,l=r0,n=n0,e0=O,D=Math.max(s,t*Math.abs(n0)),l<=D)||(x.n===0&&(X=!0),f===5))break;k=A[0],K=b[k],_=0,E=!1,C*=.5,O=F}let G;if(a0||l===z?G=115:f+B===0?G=110:(B===3&&(l+=e0),f===0&&(f=3),n!==0&&j!==0?G=105:l>F?G=115:j===0?G=130:G=110),G===105&&(G=l/Math.abs(n)>F/Math.abs(j)?115:110),G===110)u0===-1&&Math.max(Math.abs(n),Math.abs(j))<=v*.01||(.01>n/j||n/j>100||F>Math.abs(j))&&(f=6);else if(G===115){n=0;for(let d=0;d<=y;d++)n+=c[d];l=F}return f>2&&(f-=1),{result:n,abserr:l,neval:u(e),ier:f,last:e}}function m0(a,o,i,s,t,r){return M0((w,u)=>g0(a,w,u),o,i,s,t,r,Math.abs(i-o)*.375,w=>42*w-21)}function K0(a,o,i,s,t,r){let w=i===2?0:o;return M0((u,p)=>A0(a,w,i,u,p),0,1,s,t,r,.375,u=>(30*u-15)*(i===2?2:1))}export{m0 as a,K0 as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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
|
+
var x=23283064365386963e-26,N=2328306437080797e-25,a=class{mt=new Uint32Array(624);mti=625;setSeed(t){let e=t>>>0;for(let r=0;r<50;r++)e=Math.imul(69069,e)+1>>>0;e=Math.imul(69069,e)+1>>>0;for(let r=0;r<624;r++)e=Math.imul(69069,e)+1>>>0,this.mt[r]=e;this.mti=624}sgenrand(t){for(let e=0;e<624;e++)this.mt[e]=t&4294901760,t=Math.imul(69069,t)+1>>>0,this.mt[e]=(this.mt[e]|(t&4294901760)>>>16)>>>0,t=Math.imul(69069,t)+1>>>0;this.mti=624}nextUint32(){let t=this.mt;if(this.mti>=624){this.mti===625&&this.sgenrand(4357);let r=0,i;for(;r<227;r++)i=t[r]&2147483648|t[r+1]&2147483647,t[r]=t[r+397]^i>>>1^(i&1?2567483615:0);for(;r<623;r++)i=t[r]&2147483648|t[r+1]&2147483647,t[r]=t[r+-227]^i>>>1^(i&1?2567483615:0);i=t[623]&2147483648|t[0]&2147483647,t[623]=t[396]^i>>>1^(i&1?2567483615:0),this.mti=0}let e=t[this.mti++];return e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,e^=e>>>18,e>>>0}nextDouble(){let t=this.nextUint32()*x;return t<=0?.5*N:1-t<=0?1-.5*N:t}getRandomSeed(t){let e=new Int32Array(626);e[0]=t,e[1]=this.mti;for(let r=0;r<624;r++)e[r+2]=this.mt[r]|0;return e}setRandomSeed(t){if(t.length!==626)throw new RangeError("the random seed state must have 626 integers");this.mti=t[1];for(let e=0;e<624;e++)this.mt[e]=t[e+2]>>>0}};var g=[3.3871328727963665,133.14166789178438,1971.5909503065513,13731.69376550946,45921.95393154987,67265.7709270087,33430.57558358813,2509.0809287301227],w=[1,42.31333070160091,687.1870074920579,5394.196021424751,21213.794301586597,39307.89580009271,28729.085735721943,5226.495278852854],A=[1.4234371107496835,4.630337846156546,5.769497221460691,3.6478483247632045,1.2704582524523684,.2417807251774506,.022723844989269184,.0007745450142783414],S=[1,2.053191626637759,1.6763848301838038,.6897673349851,.14810397642748008,.015198666563616457,.0005475938084995345,10507500716444169e-25],F=[6.657904643501103,5.463784911164114,1.7848265399172913,.29656057182850487,.026532189526576124,.0012426609473880784,27115555687434876e-21,20103343992922881e-23],E=[1,.599832206555888,.1369298809227358,.014875361290850615,.0007868691311456133,18463183175100548e-21,1421511758316446e-22,20442631033899397e-31];function s(n,t){let e=n[7];for(let r=6;r>=0;r--)e=e*t+n[r];return e}function h(n){let t=n-.5;if(Math.abs(t)<=.425){let i=.180625-t*t;return t*s(g,i)/s(w,i)}let e=t<0?n:1-n;e=Math.sqrt(-Math.log(e));let r;return e<=5?(e-=1.6,r=s(A,e)/s(S,e)):(e-=5,r=s(F,e)/s(E,e)),t<0?-r:r}var l=10403,f=new a,c=!1;function p(){if(c)return;let n=(Date.now()^Math.floor(Math.random()*2**32))>>>0;typeof globalThis.crypto?.getRandomValues=="function"&&(n=globalThis.crypto.getRandomValues(new Uint32Array(1))[0]),f.setSeed(n),c=!0}function U(n){if(!Number.isFinite(n))throw new RangeError("seed must be a finite number");let t=Math.trunc(n);if(Math.abs(t)>2147483647)throw new RangeError("seed must be a 32-bit integer");f.setSeed(t|0),c=!0}function v(){return p(),f.getRandomSeed(l)}function T(n){if(n[0]!==l)throw new RangeError(`only the default RNG kind (${l}) is supported`);f.setRandomSeed(n),c=!0}function o(){return p(),f.nextDouble()}function _(n){let t=0;for(let e=0;e<=n;e+=16){let r=Math.floor(o()*65536);t=65536*t+r}return t%2**n}function k(n){if(n<=0)return 0;let t=Math.ceil(Math.log2(n)),e;do e=_(t);while(n<=e);return e}var M=134217728;function b(){let n=o();return n=Math.trunc(M*n)+o(),h(n/M)}var m=(()=>{let n=[],t=1,e=0;for(let r=1;r<=16;r++)t*=Math.LN2/r,e+=t,n.push(e);return n})();function d(){let n=0,t=o();for(;t<=0||t>=1;)t=o();for(;t+=t,!(t>1);)n+=m[0];if(t-=1,t<=m[0])return n+t;let e=0,r=o(),i=r;do r=o(),i>r&&(i=r),e++;while(t>m[e]);return n+i*m[0]}function u(n,t){if(!Number.isFinite(n)||n<0)throw new RangeError("n must be a non-negative finite number");let e=Math.trunc(n),r=new Array(e);for(let i=0;i<e;i++)r[i]=t();return r}function L(n,t){let e=1;if(Number.isNaN(n))return n;if(t!==0){if(!Number.isFinite(n))return Math.pow(n,t);for(t<0&&(t=-t,n=1/n);t&1&&(e*=n),t>>=1,t;)n*=n}return e}function q(n,t={}){let{min:e=0,max:r=1}=t;return u(n,()=>{if(!Number.isFinite(e)||!Number.isFinite(r)||r<e)return NaN;if(e===r)return e;let i=o();return e+(r-e)*i})}function R(n,t){return Number.isNaN(n)||!Number.isFinite(t)||t<0?NaN:t===0||!Number.isFinite(n)?n:n+t*b()}function j(n,t={}){let{mean:e=0,sd:r=1}=t;return u(n,()=>R(e,r))}function B(n,t={}){let e=1/(t.rate??1);return u(n,()=>!Number.isFinite(e)||e<=0?e===0?0:NaN:e*d())}function G(n,t={}){let{meanlog:e=0,sdlog:r=1}=t;return u(n,()=>Number.isNaN(e)||!Number.isFinite(r)||r<0?NaN:Math.exp(R(e,r)))}function V(n,t={}){let{location:e=0,scale:r=1}=t;return u(n,()=>{if(Number.isNaN(e)||!Number.isFinite(r))return NaN;if(r===0||!Number.isFinite(e))return e;let i=o();return e+r*Math.log(i/(1-i))})}function $(n,t={}){let{location:e=0,scale:r=1}=t;return u(n,()=>Number.isNaN(e)||!Number.isFinite(r)||r<0?NaN:r===0||!Number.isFinite(e)?e:e+r*Math.tan(Math.PI*o()))}function C(n,t,e={}){let{scale:r=1}=e;return u(n,()=>!Number.isFinite(t)||!Number.isFinite(r)||t<=0||r<=0?r===0?0:NaN:r*Math.pow(-Math.log(o()),1/t))}export{U as a,v as b,T as c,o as d,k as e,b as f,d as g,u as h,L as i,q as j,R as k,j as l,B as m,G as n,V as o,$ as p,C as q};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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
|
+
function h(f,t,a){let n=Math.ceil(a);if(n===1)return[f];let i=(t-f)/(n-1),o=Array.from({length:n},(s,r)=>f+r*i);return n>0&&(o[n-1]=t),o}function g(f,t){let a=Array.from(f).map(o=>Math.trunc(o)),n=t??Math.max(1,...a.filter(o=>!Number.isNaN(o))),i=new Array(Math.max(0,n)).fill(0);for(let o of a)o>=1&&o<=n&&i[o-1]++;return i}function y(f,t={}){let a=t.useNA??"no",n=Array.from(f),i=new Map,o=0;for(let e of n)Number.isNaN(e)?o++:i.set(e===0?0:e,(i.get(e===0?0:e)??0)+1);let s=Array.from(i.keys()).sort((e,l)=>e-l),r=s.map(e=>i.get(e));return(a==="always"||a==="ifany"&&o>0)&&(s.push(NaN),r.push(o)),{values:s,counts:r}}function b(f){let t=new Set,a=[];for(let n of Array.from(f)){let i=n===0?0:n;t.has(i)||(t.add(i),a.push(n))}return a}function x(f,t,a={}){let n=a.right??!0,i=a.includeLowest??!1,o=Array.from(f),s;if(typeof t=="number"||t.length===1){let r=typeof t=="number"?t:t[0];if(!(r>=2))throw new RangeError("invalid number of intervals");let e=Math.trunc(r+1),l=o.filter(N=>!Number.isNaN(N)),u=Math.min(...l),c=Math.max(...l),m=c-u;m===0?(m=u!==0?Math.abs(u):1,s=h(u-m/1e3,c+m/1e3,e)):(s=h(u,c,e),s[0]=u-m/1e3,s[e-1]=c+m/1e3)}else s=[...t].sort((r,e)=>r-e);if(new Set(s).size<s.length)throw new RangeError("'breaks' are not unique");return d(o,s,n,i)}function d(f,t,a,n){let i=t.length;return f.map(o=>{if(Number.isNaN(o))return NaN;let s=0,r=i;for(;s<r;){let l=s+r>>1;(a?t[l]<o:t[l]<=o)?s=l+1:r=l}let e=s;return n&&(a&&o===t[0]&&(e=1),!a&&o===t[i-1]&&(e=i-1)),e>=1&&e<=i-1?e:NaN})}function A(f,t,a={}){let n=t.length;for(let r=1;r<n;r++)if(!(t[r]>=t[r-1]))throw new RangeError("'vec' must be sorted non-decreasingly and not contain NAs");if(t.some(Number.isNaN))throw new RangeError("'vec' must be sorted non-decreasingly and not contain NAs");let{rightmostClosed:i=!1,allInside:o=!1,leftOpen:s=!1}=a;return Array.from(f).map(r=>{if(Number.isNaN(r))return NaN;let e=0,l=n;for(;e<l;){let c=e+l>>1;(s?t[c]<r:t[c]<=r)?e=c+1:l=c}let u=e;return i&&n>0&&(!s&&u===n&&r===t[n-1]&&(u=n-1),s&&u===0&&r===t[0]&&(u=1)),o&&(u=Math.min(Math.max(u,1),n-1)),u})}export{h as a,g as b,y as c,b as d,x as e,A as f};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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 N3,b as w,c as p3,d as h,e as g3,f as H,g as I,h as d,i as b3,j as I3,k as g}from"./chunk-UGUQYWRQ.js";function v(e,t){let n=t[0];for(let o=1;o<t.length;o++)n=n*e+t[o];return n}function q(e,t){let n=e+t[0];for(let o=1;o<t.length;o++)n=n*e+t[o];return n}var y5=[2461969814735305e-25,.5641895648310689,7.463210564422699,48.63719709856814,196.5208329560771,526.4451949954773,934.5285271719576,1027.5518868951572,557.5353353693994],_5=[13.228195115474499,86.70721408859897,354.9377788878199,975.7085017432055,1823.9091668790973,2246.3376081871097,1656.6630919416134,557.5353408177277],P5=[.5641895835477551,1.275366707599781,5.019050422511805,6.160210979930536,7.4097426995044895,2.9788666537210022],F5=[2.2605286322011726,9.396035249380015,12.048953980809666,17.08144507475659,9.608968090632859,3.369076451000815],R5=[9.604973739870516,90.02601972038427,2232.005345946843,7003.325141128051,55592.30130103949],L5=[33.56171416475031,521.3579497801527,4594.323829709801,22629.000061389095,49267.39426086359],E5=709.782712893384,w5=.5641895835477563;function r1(e){if(Number.isNaN(e))return NaN;if(e<0)return-r1(-e);if(e>1)return 1-I1(e);let t=e*e;return e*v(t,R5)/q(t,L5)}function I1(e){if(Number.isNaN(e))return NaN;let t=Math.abs(e);if(t<1)return 1-r1(e);if(e<0)return 2-I1(t);let[n,o]=p3(t,t);if(n>E5+40)return 0;let r=d3(t)*(1-o);return n<700?Math.exp(-n)*r:Math.exp(700-n)*r*Math.exp(-700)}function d1(e){return Number.isNaN(e)?NaN:e<1?Math.exp(e*e)*(1-r1(e)):e>1e8?w5/e:d3(e)}function d3(e){return e<8?v(e,y5)/q(e,_5):v(e,P5)/q(e,F5)}var q5=[-59.96335010141079,98.00107541859997,-56.67628574690703,13.931260938727968,-1.2391658386738125],G5=[1.9544885833814176,4.676279128988815,86.36024213908905,-225.46268785411937,200.26021238006066,-82.03722561683334,15.90562251262117,-1.1833162112133],T5=[4.0554489230596245,31.525109459989388,57.16281922464213,44.08050738932008,14.684956192885803,2.1866330685079025,-.1402560791713545,-.03504246268278482,-.0008574567851546854],D5=[15.779988325646675,45.39076351288792,41.3172038254672,15.04253856929075,2.504649462083094,-.14218292285478779,-.03808064076915783,-.0009332594808954574],k5=[3.2377489177694603,6.915228890689842,3.9388102529247444,1.3330346081580755,.20148538954917908,.012371663481782003,.00030158155350823543,26580697468673755e-22,6239745391849833e-24],C5=[6.02427039364742,3.6798356385616087,1.3770209948908132,.21623699359449663,.013420400608854318,.00032801446468212774,28924786474538068e-22,6790194080099813e-24],A3=.1353352832366127,O5=2.5066282746310007;function S3(e){let t=e-Math.log(e)/e,n=1/e,o=e<8?n*v(n,T5)/q(n,D5):n*v(n,k5)/q(n,C5);return t-o}function A1(e){if(e===0)return-1/0;if(e===1)return 1/0;if(!(e>=0&&e<=1))return NaN;let t=e,n=!0;if(t>1-A3&&(t=1-t,n=!1),t>A3){t=t-.5;let r=t*t;return(t+t*(r*v(r,q5)/q(r,G5)))*O5}let o=S3(Math.sqrt(-2*Math.log(t)));return n?-o:o}function v3(e){if(e<-Number.MAX_VALUE)return-1/0;if(e<-2){let t=e>=-Number.MAX_VALUE*.5?Math.sqrt(-2*e):Math.SQRT2*Math.sqrt(-e);return-S3(t)}return e>-.14541345786885906?-A1(-Math.expm1(e)):A1(Math.exp(e))}function S1(e,t){return typeof e=="number"?t(e):e instanceof Float64Array?e.map(t):e.map(n=>t(n))}var v1=Math.SQRT1_2;function y3(e,t){let n=Math.floor(e*16)/16,o=e-n,r=n*n/2,s=t*Math.exp(-o*(e+n)/2);return r<=700?s*Math.exp(-r):s*Math.exp(700-r)*Math.exp(-700)}function S0(e){let t=-e;return t<Math.SQRT2?.5-.5*r1(t*v1):y3(t,.5*d1(t*v1))}function _3(e,t){if(!t)return e<=0?S0(e):1-S0(-e);if(e>-1)return Math.log1p(-S0(-e));let n=-e;return Math.log(.5*d1(n*v1))-n*n/2}function Q5(e,t,n,o,r){if(Number.isNaN(e)||Number.isNaN(t)||Number.isNaN(n))return NaN;if(!Number.isFinite(e)&&t===e)return NaN;let s=o?r?-1/0:0:r?0:1,i=o?r?0:1:r?-1/0:0;if(n<0)return NaN;if(n===0)return e<t?s:i;let c=(e-t)/n;return Number.isFinite(c)?_3(o?c:-c,r):e<t?s:i}function z5(e,t,n,o,r){if(Number.isNaN(e)||Number.isNaN(t)||Number.isNaN(n))return NaN;let s=o?-1/0:1/0;if(r){if(e>0)return NaN;if(e===0)return-s;if(e===-1/0)return s}else{if(e<0||e>1)return NaN;if(e===0)return s;if(e===1)return-s}if(n<0)return NaN;if(n===0)return t;let i=r?B5(e):A1(e);return t+n*(o?i:-i)}var X5=.7978845608028654;function B5(e){let t=v3(e);if(!(e<-2048)||!Number.isFinite(t))return t;let n=X5/d1(-t*v1),o=(_3(t,!0)-e)/n;return Number.isFinite(o)?t-o:t}var H5=.9189385332046728,V5=.3989422804014327;function Y5(e,t,n,o){if(Number.isNaN(e)||Number.isNaN(t)||Number.isNaN(n))return NaN;if(n<0)return NaN;if(!Number.isFinite(n))return o?-1/0:0;if(!Number.isFinite(e)&&t===e)return NaN;if(n===0)return e===t?1/0:o?-1/0:0;let r=(e-t)/n;return Number.isFinite(r)?o?-(H5+.5*r*r+Math.log(n)):y3(Math.abs(r),V5/n):o?-1/0:0}function Y6(e,t={}){let{mean:n=0,sd:o=1,log:r=!1}=t;return S1(e,s=>Y5(s,n,o,r))}function U6(e,t={}){let{mean:n=0,sd:o=1,lowerTail:r=!0,logP:s=!1}=t;return S1(e,i=>Q5(i,n,o,r,s))}function j6(e,t={}){let{mean:n=0,sd:o=1,lowerTail:r=!0,logP:s=!1}=t;return S1(e,i=>z5(i,n,o,r,s))}var G=11102230246251565e-32;var D=171.6243769563027,s1=.9189385332046728,P3=1.1447298858494002;var v0=.5772156649015329;var U5=[.00016011952247675185,.0011913514700658638,.010421379756176158,.04763678004571372,.20744822764843598,.4942148268014971,1],j5=[-23158187332412014e-21,.0005396055804933034,-.004456419138517973,.011813978522206043,.035823639860549865,-.23459179571824335,.0714304917030273,1];function E3(e){let t=1;e<0&&(e=-e,t=-1);let n=e%2;return n<.5?t*Math.sin(Math.PI*n):n>1.5?t*Math.sin(Math.PI*(n-2)):-t*Math.sin(Math.PI*(n-1))}function F3(e){if(e>=D)return 1/0;let t=e-1,n=h(d(g([t,0]),t),[-t+t6(t),0]);return Math.sqrt(2*Math.PI*t)*Math.exp(n[0])*(1+n[1])}function k(e){if(!Number.isFinite(e))return e>0?e:NaN;if(e===0)return NaN;let t=Math.abs(e);if(t>33){if(e<0){let o=Math.floor(t);if(o===t)return NaN;let r=o%2===0?-1:1,s=t-o;return s>.5&&(o+=1,s=t-o),s=t*E3(s),s===0?r*(1/0):r*Math.PI/(Math.abs(s)*F3(t))}return F3(e)}let n=1;for(;e>=3;)e-=1,n*=e;for(;e<0;){if(e>-1e-9)return R3(e,n);n/=e,e+=1}for(;e<2;){if(e<1e-9)return R3(e,n);n/=e,e+=1}return e===2?n:(e-=2,n*v(e,U5)/v(e,j5))}function R3(e,t){return e===0?NaN:t/((1+v0*e)*e)}var K5=[.0008116141674705085,-.0005950619042843014,.0007936503404577169,-.002777777777300997,.08333333333333319],Z5=[-1378.2515256912086,-38801.631513463784,-331612.9927388712,-1162370974927623e-9,-1.7217370082083966e6,-853555.6642457654],J5=[-351.81570143652345,-17064.210665188115,-220528.59055385445,-1.1393344436798252e6,-2.5325230717758294e6,-2.0188914143353277e6],W5=2556348e299;function $5(e){let t=(e-.5)*Math.log(e)-e+s1;if(e>1e8)return t;let n=1/(e*e);return t+((.0007936507936507937*n-.002777777777777778)*n+.08333333333333333)/e}function T(e){if(!Number.isFinite(e))return{value:e===-1/0?1/0:e,sign:1};if(e<-34){let o=-e,r=T(o).value,s=Math.floor(o);if(s===o)return{value:1/0,sign:1};let i=s%2===0?-1:1,c=o-s;return c>.5&&(s+=1,c=s-o),c=o*E3(c),c===0?{value:1/0,sign:1}:{value:P3-Math.log(c)-r,sign:i}}if(e<13){let o=1,r=0,s=e;for(;s>=3;)r-=1,s=e+r,o*=s;for(;s<2;){if(s===0)return{value:1/0,sign:1};o/=s,r+=1,s=e+r}let i=1;if(o<0&&(i=-1,o=-o),s===2)return{value:Math.log(o),sign:i};r-=2;let c=e+r;return{value:Math.log(o)+c*v(c,Z5)/q(c,J5),sign:i}}if(e>W5)return{value:1/0,sign:1};if(e>=1e3)return{value:$5(e),sign:1};let t=(e-.5)*Math.log(e)-e+s1,n=1/(e*e);return{value:t+v(n,K5)/e,sign:1}}function K(e){return Math.abs(e-1)<=.2?V(e-1):Math.abs(e-2)<=.2?V(e-2)+Math.log1p(e-2):T(e).value}var x5=[1.6449340668482264,1.2020569031595942,1.0823232337111381,1.03692775514337,1.0173430619844492,1.008349277381923,1.0040773561979444,1.0020083928260821,1.000994575127818,1.0004941886041194,1.000246086553308,1.0001227133475785,1.0000612481350588,1.000030588236307,1.0000152822594086,1.0000076371976379,1.000003817293265,1.0000019082127165,1.0000009539620338,1.0000004769329869,1.0000002384505027,1.000000119219926,1.000000059608189,1.0000000298035034,1.0000000149015549,1.0000000074507118,1.000000003725334,1.0000000018626598,1.0000000009313275,1.0000000004656628,1.000000000232831,1.0000000001164155,1.0000000000582077,1.0000000000291038,1.000000000014552,1.000000000007276,1.000000000003638,1.000000000001819,1.0000000000009095,1.0000000000004547];function L3(e){if(e===0)return 0;let t=-v0*e,n=-e;for(let o=2;o<42;o++){n*=-e;let r=x5[o-2]*n/o;if(t+=r,Math.abs(r)<G*Math.abs(t))break}return t}function V(e){return Math.abs(e)<=.2?L3(e):Math.abs(e-1)<=.2?Math.log(e)+L3(e-1):K(e+1)}var e6=[1/12,-1/360,1/1260,-1/1680,1/1188,-691/360360,1/156];function t6(e){let t=1/(e*e),n=0,o=1/e;for(let r of e6)n+=r*o,o*=t;return n}var w3=[1/12,-1/360,1/1260,-1/1680,1/1188,-691/360360,1/156];function q3(e,t){let n=y0(e,t);return n[0]+n[1]}function y0(e,t){if(e===0)return[0,0];let n=0,o=t;for(;o<=15;)n-=Math.log1p(e/o),o+=1;let r=Math.log1p(e/o),s=e*Math.log(o+e),i=Math.abs(s)>2&&Number.isFinite(s)&&e<1e300?d(g(w(o,e)),e):[s,0],c=(o-.5)*r-e,u=1/o,l=1/(o*o);for(let f=0;f<w3.length;f++){let a=2*f+1;c+=w3[f]*u*Math.expm1(-a*r),u*=l}return h(i,[n+c,0])}var G3=22250738585072014e-324,F0=1.8378770664093456,n6=[.15342640972002736,.08106146679532726,.05481412105191765,.0413406959554093,.03316287351993629,.02767792568499834,.023746163656297496,.020790672103765093,.018488450532673187,.016644691189821193,.015134973221917378,.013876128823070748,.012810465242920227,.01189670994589177,.011104559758206917,.010411265261972096,.009799416126158804,.009255462182712733,.008768700134139386,.00833056343336287,.00793411456431402,.007573675487951841,.007244554301320383,.00694284010720953,.006665247032707682,.006408994188004207,.006171712263039458,.0059513701127588475,.0057462165130101155,.005554733551962801],y1=1/12,_1=1/360,_0=1/1260,T3=1/1680,o6=1/1188,r6=691/360360,s6=1/156;function D3(e){let t=1/(e*e);return e>500?(y1-_1*t)/e:e>80?(y1-(_1-_0*t)*t)/e:e>35?(y1-(_1-(_0-T3*t)*t)*t)/e:(y1-(_1-(_0-(T3-(o6-(r6-s6*t)*t)*t)*t)*t)*t)/e}function A(e){if(e>15)return D3(e);let t=2*e;if(t===Math.floor(t)&&t>=1)return n6[t-1];if(e<1)return V(e)-(e+.5)*Math.log(e)+e-s1;let n=0,o=e;for(;o<=15;)n+=(o+.5)*Math.log1p(1/o)-1,o+=1;return n+D3(o)}function C(e,t){if(!N3())return i6(e,t);let n=-t[0],o=-t[1],r=e+n,s=r-e,i=e-(r-s)+(n-s),c=0+o,u=c-0,l=0-(c-u)+(o-u),f=i+c,a=r+f,b=f-(a-r)+l,S=a+b,y=b-(S-a),p=S,P=y;if(Math.abs(p)<.1*(e+t[0])){let R=e+t[0],Z=R-e,J=e-(R-Z)+(t[0]-Z),Y=0+t[1],O=Y-0,c1=0-(Y-O)+(t[1]-O),W=J+Y,w1=R+W,w0=W-(w1-R)+c1,_=w1+w0,q0=w0-(_-w1),Q=p/_,q1=_*Q,G0=134217729*_,G1=G0-(G0-_),T0=_-G1,D0=134217729*Q,T1=D0-(D0-Q),k0=Q-T1,C0=G1*T1-q1+G1*k0+T0*T1+T0*k0+q0*Q,O0=q1+C0,e5=C0-(O0-q1),Q0=-O0,z0=-e5,u1=p+Q0,X0=u1-p,t5=p-(u1-X0)+(Q0-X0),D1=P+z0,B0=D1-P,n5=P-(D1-B0)+(z0-B0),H0=t5+D1,k1=u1+H0,V0=H0-(k1-u1)+n5,$=k1+V0,C1=V0-($-k1),z=$/_,O1=_*z,Y0=134217729*_,Q1=Y0-(Y0-_),U0=_-Q1,j0=134217729*z,z1=j0-(j0-z),K0=z-z1,Z0=Q1*z1-O1+Q1*K0+U0*z1+U0*K0+q0*z,J0=O1+Z0,o5=Z0-(J0-O1),W0=-J0,$0=-o5,f1=$+W0,x0=f1-$,r5=$-(f1-x0)+(W0-x0),X1=C1+$0,e2=X1-C1,s5=C1-(X1-e2)+($0-e2),t2=r5+X1,B1=f1+t2,n2=t2-(B1-f1)+s5,o2=B1+n2,S6=n2-(o2-B1),r2=o2/_,a1=Q+z,H1=z-(a1-Q),l1=a1+r2,s2=l1-a1,i5=a1-(l1-s2)+(r2-s2),V1=H1+0,i2=V1-H1,c5=H1-(V1-i2)+(0-i2),c2=i5+V1,Y1=l1+c2,u2=c2-(Y1-l1)+c5,f2=Y1+u2,u5=u2-(f2-Y1),M=f2,h1=u5,U1=p*M,a2=134217729*p,j1=a2-(a2-p),l2=p-j1,h2=134217729*M,K1=h2-(h2-M),M2=M-K1,m2=j1*K1-U1+j1*M2+l2*K1+l2*M2+(p*h1+P*M),N2=U1+m2,f5=m2-(N2-U1),U=N2,j=f5,x=2*e,Z1=M*x,p2=134217729*M,J1=p2-(p2-M),g2=M-J1,b2=134217729*x,W1=b2-(b2-x),I2=x-W1,d2=J1*W1-Z1+J1*I2+g2*W1+g2*I2+h1*x,A2=Z1+d2,a5=d2-(A2-Z1),E=A2,e1=a5,$1=M*M,S2=134217729*M,x1=S2-(S2-M),v2=M-x1,y2=134217729*M,e0=y2-(y2-M),_2=M-e0,P2=x1*e0-$1+x1*_2+v2*e0+v2*_2+(M*h1+h1*M),F2=$1+P2,l5=P2-(F2-$1),t1=F2,h5=l5;for(let t0=1;t0<1e3;t0++){let n0=E*t1,R2=134217729*E,o0=R2-(R2-E),L2=E-o0,E2=134217729*t1,r0=E2-(E2-t1),w2=t1-r0,q2=o0*r0-n0+o0*w2+L2*r0+L2*w2+(E*h5+e1*t1),G2=n0+q2,M5=q2-(G2-n0);E=G2,e1=M5;let L=2*t0+1,X=E/L,s0=L*X,T2=134217729*L,i0=T2-(T2-L),D2=L-i0,k2=134217729*X,c0=k2-(k2-X),C2=X-c0,O2=i0*c0-s0+i0*C2+D2*c0+D2*C2+0*X,Q2=s0+O2,m5=O2-(Q2-s0),z2=-Q2,X2=-m5,M1=E+z2,B2=M1-E,N5=E-(M1-B2)+(z2-B2),u0=e1+X2,H2=u0-e1,p5=e1-(u0-H2)+(X2-H2),V2=N5+u0,f0=M1+V2,Y2=V2-(f0-M1)+p5,n1=f0+Y2,a0=Y2-(n1-f0),B=n1/L,l0=L*B,U2=134217729*L,h0=U2-(U2-L),j2=L-h0,K2=134217729*B,M0=K2-(K2-B),Z2=B-M0,J2=h0*M0-l0+h0*Z2+j2*M0+j2*Z2+0*B,W2=l0+J2,g5=J2-(W2-l0),$2=-W2,x2=-g5,m1=n1+$2,e3=m1-n1,b5=n1-(m1-e3)+($2-e3),m0=a0+x2,t3=m0-a0,I5=a0-(m0-t3)+(x2-t3),n3=b5+m0,N0=m1+n3,o3=n3-(N0-m1)+I5,r3=N0+o3,q6=o3-(r3-N0),s3=r3/L,N1=X+B,p0=B-(N1-X),p1=N1+s3,i3=p1-N1,d5=N1-(p1-i3)+(s3-i3),g0=p0+0,c3=g0-p0,A5=p0-(g0-c3)+(0-c3),u3=d5+g0,b0=p1+u3,f3=u3-(b0-p1)+A5,g1=b0+f3,a3=f3-(g1-b0),b1=U+g1,l3=b1-U,S5=U-(b1-l3)+(g1-l3),I0=j+a3,h3=I0-j,v5=j-(I0-h3)+(a3-h3),M3=S5+I0,d0=b1+M3,m3=M3-(d0-b1)+v5,o1=d0+m3,A0=m3-(o1-d0);if(Math.abs(g1)<=1e-33*Math.abs(o1)||o1===U&&A0===j)return[o1,A0];U=o1,j=A0}return[U,j]}let F=H(g([e,0]),g(t));return h(d(F,e),[-p,-P])}function i6(e,t){let n=H([e,0],t);if(Math.abs(n[0])<.1*(e+t[0])){let r=b3(n,h([e,0],t)),s=I(n,r),i=d(r,2*e),c=I(r,r);for(let u=1;u<1e3;u++){i=I(i,c);let l=I3(i,2*u+1),f=h(s,l);if(Math.abs(l[0])<=1e-33*Math.abs(f[0])||f[0]===s[0]&&f[1]===s[1])return f;s=f}return s}let o=H(g([e,0]),g(t));return h(d(o,e),g3(n))}function i4(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||t===0)return NaN;if(e===0)return t;let n=C(e,[t,0]);return n[0]+n[1]}function P0(e,t,n,o){if(t)return-e[0]-e[1]-.5*n();if(e[0]<700)return Math.exp(-e[0])*(1-e[1])/Math.sqrt(o());let r=o();return!Number.isFinite(r)||r===0?Math.exp(-e[0]-e[1]-.5*n()):Math.exp(700-e[0])*(1-e[1])/Math.sqrt(r)*Math.exp(-700)}function c4(e,t,n,o,r){let s=r?-1/0:0,i=r?0:1,c=w(e,t),u=c[0];if(n[0]===0)return e===0?i:s;if(o[0]===0)return t===0?i:s;if(e===0){if(u===0)return i;if(n[0]<.1){let N=h(C(u,I(c,o)),I(c,n));return r?-N[0]-N[1]:Math.exp(-N[0])*(1-N[1])}let f=g(o),a=I(c,f);return r?a[0]+a[1]:Math.exp(a[0])*(1+a[1])}if(t===0){if(o[0]<.1){let a=h(C(u,I(c,n)),I(c,o));return r?-a[0]-a[1]:Math.exp(-a[0])*(1-a[1])}let f=I(c,g(n));return r?f[0]+f[1]:Math.exp(f[0])*(1+f[1])}if(e<0||t<0)return s;let l=h(C(e,I(c,n)),C(t,I(c,o)));return l=h(l,w(A(e)+A(t),-A(u))),P0(l,r,()=>F0+Math.log(e)+Math.log(t)-Math.log(u),()=>2*Math.PI*e*(t/u))}function u4(e,t,n,o){let r=w(e,t),s=r[0],i=h(C(e,I(r,n)),C(t,I(r,o)));return i=h(i,w(A(e)+A(t),-A(s))),{e:i,logDenom:F0+Math.log(e)+Math.log(t)-Math.log(s)}}function i1(e,t,n){let o=k3(e,t,n,!n);return n?o[0]:o[1]}function R0(e,t){return k3(e,t,!0,!0)}function k3(e,t,n,o){if(t===0)return e===0?[0,1]:[-1/0,0];if(!Number.isFinite(t)||e<0)return[-1/0,0];if(e<=t*G3)return[-t,o?Math.exp(-t):NaN];if(t<e*G3){if(!Number.isFinite(e))return[-1/0,0];let c=-t+e*Math.log(t)-V(e);return[c,o?Math.exp(c):NaN]}let r=h(C(e,[t,0]),[A(e),0]),s=()=>F0+Math.log(e),i=()=>2*Math.PI*e;return[n?P0(r,!0,s,i):NaN,o?P0(r,!1,s,i):NaN]}var P1=1e6;function Q3(e,t){let{value:n,sign:o}=T(t),r=n;return r-=t*Math.log(e),r+=t*(1-t)/(2*e),r+=t*(1-t)*(1-2*t)/(12*e*e),r+=-t*t*(1-t)*(1-t)/(12*e*e*e),{value:r,sign:o}}function c6(e,t){if(Number.isNaN(e)||Number.isNaN(t))return NaN;if(e===1/0&&t>0||t===1/0&&e>0)return 0;if(e>0&&t>0&&Math.max(e,t)>15){let i=Math.min(e,t),c=Math.max(e,t);if(i<1){let l=y0(i,c);return k(i)*Math.exp(-l[0])*(1-l[1])}let u=c>=X3?B3(c,i):H3(e,t);return Math.exp(u[0])*(1+u[1])}let n=1;if(e<=0&&e===Math.floor(e))return C3(e,t);if(t<=0&&t===Math.floor(t))return C3(t,e);if(Math.abs(e)<Math.abs(t)&&([e,t]=[t,e]),Math.abs(e)>P1*Math.abs(t)&&e>P1){let i=Q3(e,t);return i.sign*Math.exp(i.value)}let o=e+t;if(Math.abs(o)>D||Math.abs(e)>D||Math.abs(t)>D){let i=T(o);n*=i.sign;let c=T(t);n*=c.sign;let u=T(e);n*=u.sign;let l=u.value+(c.value-i.value);return n*Math.exp(l)}o=1/k(o);let r=k(e),s=k(t);return Number.isFinite(o)?Math.abs(Math.abs(r*o)-1)>Math.abs(Math.abs(s*o)-1)?s*o*r:r*o*s:n*(1/0)}function C3(e,t){return t===Math.floor(t)&&1-e-t>0?(t%2===0?1:-1)*c6(1-e-t,t):1/0}function u6(e,t){if(Number.isNaN(e)||Number.isNaN(t))return NaN;if(e===1/0&&t>0||t===1/0&&e>0)return-1/0;if(e>0&&t>0&&Number.isFinite(e)&&Number.isFinite(t)&&Math.max(e,t)>15){let i=Math.min(e,t),c=Math.max(e,t);if(i<1)return K(i)-q3(i,c);let u=c>=X3?B3(c,i):H3(e,t);return u[0]+u[1]}if(e<=0&&e===Math.floor(e))return O3(e,t);if(t<=0&&t===Math.floor(t))return O3(t,e);if(Math.abs(e)<Math.abs(t)&&([e,t]=[t,e]),Math.abs(e)>P1*Math.abs(t)&&e>P1)return Q3(e,t).value;let n=e+t;if(Math.abs(n)>D||Math.abs(e)>D||Math.abs(t)>D)return T(e).value+(T(t).value-T(n).value);n=1/k(n);let o=k(e),r=k(t);if(!Number.isFinite(n))return 1/0;let s=Math.abs(Math.abs(o*n)-1)>Math.abs(Math.abs(r*n)-1)?r*n*o:o*n*r;return Math.log(Math.abs(s))}function O3(e,t){return t===Math.floor(t)&&1-e-t>0?u6(1-e-t,t):1/0}var z3=[.9189385332046728,-38782941580672414e-33],X3=2**52;function B3(e,t){let n=d(H(g([t,0]),g([e,0])),t),o=-.5*Math.log(t)-(e+t-.5)*Math.log1p(t/e)+(A(e)+A(t)-A(e+t));return h(h(n,z3),[o,0])}function H3(e,t){let n=w(e,t),o=d(g([e,0]),e-.5),r=d(g([t,0]),t-.5),s=f6(g(n),h(n,[-.5,0])),i=H(h(o,r),s);return i=h(i,z3),h(i,w(A(e)+A(t),-A(n[0])))}function f6(e,t){return h(d(e,t[0]),d(e,t[1]))}var V3=[[-.3333333333333333,.08333333333333333,-.014814814814814815,.0011574074074074073,.0003527336860670194,-.0001787551440329218,3919263178522438e-20,-21854485106799924e-22,-185406221071516e-20,8296711340953087e-22,-17665952736826078e-23,6707853543401498e-24,10261809784240309e-24,-4382036018453353e-24,914769958223679e-24,-2551419399494625e-26,-5830772132550426e-26,24361948020667415e-27,-50276692801141755e-28,11004392031956135e-29,33717632624009856e-29,-1392388722418162e-28,28534893807047445e-30,-5139111834242572e-31,-19752288294349442e-31],[-.001851851851851852,-.003472222222222222,.0026455026455026454,-.0009902263374485596,.00020576131687242798,-4018775720164609e-22,-18098550334489977e-21,764916091608111e-20,-16120900894563446e-22,4647127802807434e-24,1378633446915721e-22,-5752545603517705e-23,11951628599778148e-24,-17543241719747647e-27,-10091543710600413e-25,4162792991842583e-25,-856390702649298e-25,6067215101604758e-29,71624989648114856e-28,-2933186643771437e-27,5996696365683689e-28,-21671786527323313e-32,-4978339972369262e-29,20291628823713425e-30,-413125571381061e-29],[.004133597883597883,-.0026813271604938273,.0007716049382716049,20093878600823047e-22,-.00010736653226365161,52923448829120125e-21,-12760635188618728e-21,3423578734096138e-23,13721957309062932e-22,-6298992138380055e-22,14280614206064242e-23,-20477098421990866e-26,-1409252991086752e-23,6228974084922022e-24,-13670488396617112e-25,9428356159014678e-28,12872252400089318e-26,-55645956134363323e-27,1197593554636698e-26,-41689782251838634e-31,-10940640427884595e-28,4662239946390136e-28,-9905105763906907e-29,18931876768373515e-33,8859221872591127e-30],[.0006494341563786008,.00022947209362139917,-.0004691894943952557,.00026772063206283885,-7561801671883977e-20,-2396505113867297e-22,11082654115347302e-21,-56749528269915965e-22,14230900732435883e-22,-27861080291528143e-27,-16958404091930278e-23,8099464905388083e-23,-19111168485973655e-24,23928620439808118e-28,20620131815488797e-25,-9460496661855133e-25,21541049775774907e-26,-1388823336813903e-29,-21894761681963938e-27,9790998951171684e-27,-2178219188018096e-27,6208819573407901e-32,2126978363279737e-28,-9344688791517433e-29,2045367122678285e-29],[-.0008618882909167117,.0007840392217200666,-.0002990724803031902,-14638452578843418e-22,6641498215465122e-20,-3968365047179435e-20,11375726970678419e-21,2507497226237533e-25,-16954149536558305e-22,8907507532205309e-22,-2292934834000805e-22,2956794137544049e-26,28865829742708783e-24,-14189739437803219e-24,34463580499464896e-25,-23024517174528067e-29,-39409233028046403e-26,186023389685045e-24,-4356323005056618e-26,1278600101629623e-30,467927502665792e-26,-2149246470613483e-27,4908815614809652e-28,-633859148489156e-32,-5045332069080094e-29],[-.00033679855336635813,-6972813758365858e-20,.0002772753244959392,-.00019932570516188847,6797780477937208e-20,1419062920643967e-22,-13594048189768693e-21,8018470256334202e-21,-2291481176508095e-21,-3252473551298454e-25,34652846491085265e-23,-18447187191171344e-23,48240967037894184e-24,-17989466721743514e-30,-6306194500013523e-24,3162417628774568e-24,-7840924253697429e-25,5192679165254041e-30,9358944242306784e-26,-4513426216163278e-26,10799129993116828e-27,-3661886712685252e-32,-1210902069055155e-27,5680743584990564e-28,-13249659916340829e-29],[.0005313079364639922,-.0005921664373536939,.0002708782096718045,7902353232660328e-22,-8153969367561969e-20,561168275310625e-19,-18329116582843375e-21,-30796134506033047e-25,3465155368803609e-21,-20291327396058603e-22,5788792863149004e-22,2338630673826657e-28,-8828600746330484e-23,47435958880408125e-24,-12545415020710382e-24,8649648858010293e-29,16846058979264062e-25,-8575492823577594e-25,21598224929232125e-26,-7613230520476153e-31,-26639822008536144e-27,13065700536611057e-27,-31799163902367977e-28,4710976121367431e-33,36902800842763465e-29],[.00034436760689237765,5171790908260592e-20,-.00033493161081142234,.0002812695154763237,-.00010976582244684731,-12741009095484485e-23,27744451511563645e-21,-18263488805711332e-21,57876949497350525e-22,493875893393627e-24,-10595367014026043e-22,6166714376110408e-22,-17562973359060463e-23,-1297447328701544e-27,2695423606288966e-23,-14578352908731272e-24,3887645959386175e-24,-3881002251019412e-32,-5327994173877286e-25,27437977643314844e-26,-6995796092070568e-26,2589986387486848e-32,8856689099669639e-27,-4403168815871311e-27,10865561947091654e-28],[-.0006526239185953094,.0008394987206720873,-.000438297098541721,-6969091458420552e-22,.00016644846642067547,-.00012783517679769218,4629953263691304e-20,4557909867922708e-24,-10595271125805195e-21,6783342904865167e-21,-21075476666258803e-22,-17213731432817144e-27,3773587741611098e-22,-21867506700122867e-23,6220228804018927e-23,6597703826733e-28,-9590386497425686e-24,5213214492280807e-24,-13991589583935709e-25,5382058999060575e-31,19484714275467745e-26,-10127287556389682e-26,26077347197254926e-27,-5090418699993299e-33,-33721464474854593e-28],[-.0005967612901927463,-7204895416020011e-20,.0006782308837667328,-.0006401475260262758,.00027750107634328704,1819700838046515e-22,-8479507117068503e-20,6105192082501531e-20,-21073920183404862e-21,-8858589014125599e-25,45284535953805374e-22,-28427815022504407e-22,8708234177864641e-22,36886101871706966e-28,-1534469519070206e-22,8862466778790695e-23,-25184812301826817e-24,-10225912098215092e-30,3896947075815478e-24,-21267304792235634e-25,5737013552805138e-25,-1887749850169741e-34,-8093153869465787e-26,423827232834492e-25,-11002224534207727e-27],[.0013324454494800656,-.0019144384985654776,.0011089369134596636,99324041226423e-20,-.0005087450129309319,.00042735056665392886,-.000168588537679108,-81301893922785e-22,45284402370562144e-21,-3127053674781734e-20,1044986828530338e-20,48435226265680926e-27,-2148256587345626e-21,1329369701097492e-21,-4029569309210103e-22,-1756787766632329e-28,7014504316366825e-23,-4040787734999483e-23,11474026743371962e-24,39642746853563326e-34,-17804938269892715e-25,9748026254873165e-25,-26405338676507616e-26,5794875163403742e-33,3764774955354384e-26],[.001579727660730835,.00016251626278391583,-.0020633421035543276,.00213896861856891,-.0010108559391263003,-399127055299192e-21,.0003623502508476469,-.00028143901463712157,.00010449513336495887,212114184918303e-23,-25779417251947842e-21,17281818956040464e-21,-5641377387290428e-21,-11024320105776174e-27,11223224418895176e-22,-6869339637952674e-22,20653236975414888e-23,46714772409838506e-30,-35609886164949055e-24,20470855345905963e-24,-5809173863328336e-24,-1332821287582869e-31,9035460439133513e-25,-4959878251733084e-25,13481607129399748e-26],[-.004072512119514016,.00640336283380807,-.004041016108167662,-2183732802866233e-21,.002174044180125464,-.001970044051841889,.0008359546974796246,19445447567109655e-24,-.000257793871204217,.00019009987368139304,-6769649993743896e-20,-14440629666426571e-26,15712512518742267e-21,-10304008744776892e-21,3304517767401387e-21,7982976024232571e-28,-64097794149313e-20,38894624761300054e-23,-1161834764494887e-22,-2816808630596451e-30,19878012911297094e-24,-11407719956357511e-24,32355857064185554e-25,4175946829345594e-35,-5042311271810582e-25],[-.0059475779383993,-.0005401647678926045,.00879104135507679,-.009857631558785612,.005013469503102154,12807521786221875e-22,-.0020626019342754685,.0017109128573523059,-.000676953127141338,-6901154567656214e-24,.00018855128143995903,-.0001339521566349197,4626318303352804e-20,4003423061332135e-26,-10255652921494033e-21,6612086372797651e-21,-20913022027253007e-22,-20951775649603836e-29,3975602904199325e-22,-2395621197881589e-22,7118288338214586e-23,8925574873053455e-31,-12101547235064675e-24,6935061824833439e-24,-196614644538561e-23],[.01740202778752271,-.029527880945699123,.020045875571402798,70289515966903405e-22,-.012375421071343148,.011976293444235253,-.0054156038466518525,-6329089339641862e-23,.0018855118129005065,-.001473473274825001,.0005551581009770838,5240683441255066e-25,-.00014357913535784837,991812932249433e-19,-3346083474947831e-20,-3575583729109899e-27,71560851960630075e-22,-4551680262815553e-21,14236576649271474e-22,18803149082089665e-30,-2662340389892921e-22,15950642189595716e-23,-471875146738411e-22,-6510787295875518e-32,7979509102674624e-24],[.03024912416090589,.0024817436002649977,-.049939134373457025,.05991564300930787,-.03248320760162339,-5721296865210344e-21,.015085251778569354,-.013261324005088445,.0055515262632426145,3026318225703001e-23,-.0017229548406756724,.0012893570099929638,-.00046845138348319875,-1830259937893045e-25,.00011449739014822654,-7737856522124447e-20,25625836246985202e-21,10766165333192815e-28,-5324680928242262e-21,3349634863064464e-21,-10381253128684019e-22,-5608909920621128e-30,19150821930676592e-23,-11418365800203487e-23,33654425209171787e-24],[-.09905102088015905,.17954011706123485,-.12989606383463778,-31478872752284355e-21,.09051063527684813,-.0928288244111844,.04441211283987781,27779236316835886e-23,-.017229543805449696,.014182925050891573,-.005621416163374734,-239598509186381e-23,.0016029634366079909,-.0011606784674435774,.00041001337768153875,1836580075409066e-26,-958442565636559e-19,6364306233776471e-20,-2076250624489065e-20,-11806020912804483e-29,4213180823912065e-21,-2626224133701247e-21,8077062049493066e-22,6012591212363273e-31,-1472973737401884e-22],[-.19994542198219728,-.015056113040026424,.36470239469348487,-.4643519231173355,.26640934719197895,3403826602714719e-20,-.13784338709329624,.1276467178337056,-.056213828755200985,-1753150885483011e-22,.019235592956768112,-.015088821281095314,.005740185445135012,10622382710310225e-25,-.0015335082692563998,.0010819320643228215,-.0003737251019394566,-6617090972903199e-27,8426361738090962e-20,-5515070682748348e-20,1776953644834807e-20,3882792321020553e-29,-353513697488768e-20,2186583213004527e-21,-668128494476256e-21],[.7243860850402943,-1.3918010932653375,1.0654143352413967,.0001876173868950258,-.827055011761527,.8935243334782842,-.44971003995291337,-16107401567546651e-22,.1923559016527109,-.1659770216004261,.06888222268181433,13910091724608687e-24,-.02146911561508663,.016228980898865892,-.005979601617258426,-11287469112826745e-26,.0015167451119784856,-.00104786342935539,.0003553907288912642,8170432211180152e-28,-777730134424524e-19,5029141389700772e-20,-16035083867000518e-21,12469354315487606e-30,31369106244517616e-22],[1.6668949727276812,.1165462765994632,-3.3288393225018904,4.469232548286404,-2.6977693045875806,-.0002600667859891061,1.5389017615694538,-1.4937962361134611,.6888196463323315,13077482004552384e-22,-.2576296332559629,.21097676102125448,-.08371440835921988,-7792042888135476e-24,.0242679230648336,-.017813678334552312,.006397033038890006,4943080709048052e-26,-.0015554602758465635,.0010561196919903215,-.000352771844604729,9300233464502246e-29,7528585502655717e-20,-4818651556915635e-20,15227271505597605e-21],[-6.618829886137293,13.397985455142589,-10.789350606845145,-.0014352254537875018,9.23336945961898,-10.456552819547769,5.510552602903347,12024439690716742e-21,-2.5762961164755818,2.320744274538718,-1.0045728797216285,-10207833290021913e-23,.3397509217116947,-.2672051745075747,.10235252851562705,8432973048487163e-25,-.027998284958442594,.020066274144976814,-.007055436891508624,19402238183698188e-28,.0016562888105449611,-.0011082898580743682,.0003654545161310169,-5129003202697179e-26,-7634010369686903e-20],[-17.112706061976095,-1.1208044642899115,37.131966511885445,-52.29827102534896,33.058589696624615,.002479129897620022,-20.61089403411526,20.88672775145582,-10.045703956517752,-12238783449063012e-21,4.077013427422114,-3.473667358470195,1.4329352617312006,7135991441187971e-23,-.4479725715911561,.3411266608064446,-.12699786326594922,-2895367726908153e-25,.03312577627825986,-.023274087021036102,.008039999350364889,-1177805216235265e-24,-.001832162489107167,.0012108282933588664,-.0003947994124682252],[73.89033153567425,-156.80141270402274,132.2177542759164,.013692876877324546,-123.66496885920151,146.2068939106273,-80.36558772486535,-.00011259851148881298,40.77013219617994,-38.21034001327303,17.19522294277362,9351970795516835e-22,-6.271615990774704,5.116899907185264,-2.0319658112299095,-4950721558276154e-24,.596263972943326,-.44220765337238094,.16079998700166273,-24733786203223403e-24,-.040307574759979765,.02784905074709787,-.009475185899205422,6419922235909132e-21,.002125018077469946],[212.1683709838252,13.107863022633868,-496.9828593287175,731.215952669692,-482.1382172089085,-.028817248692894887,326.167203029471,-343.8934028008712,171.95193870816232,.00014038077378096157,-75.2594195897599,66.51969984520935,-28.447519748152462,-7613702615875392e-22,9.540223710530437,-7.517530111331138,2.894399756887196,-466121949995382e-21,-.8061514959879409,.5848300657063102,-.20845408972964957,.00014765818959305816,.05100043386375302,-.03306625214188366,.015109265210467774],[-989.5964309832236,2192.555536090523,-1928.3586782723355,-.15925738122215252,1956.9985945919857,-2407.2514765081555,1375.6149959336497,.0012920735237496668,-752.5941715948055,731.7166874220871,-341.37023466220063,-9985739026060805e-21,133.56313181291574,-112.76295161252794,46.31039609820446,-7923738713361476e-21,-14.510726927018647,11.111771248100563,-4.169081794527089,.0031008219800117806,1.1220095449981469,-.7605237992614992,.36262236505085255,.2216867741940747,.48683443692930506]];function L0(e){if(Math.abs(e)<.5){let t=e,n=0;for(let o=2;o<500;o++){t*=-e;let r=t/o;if(n+=r,Math.abs(r)<G*Math.abs(n))break}return n}return Math.log1p(e)-e}var E1=1e7,K3=20,R1=200,Z3=.3,J3=4.5,l6=4503599627370496,F1=2220446049250313e-31;function U3(e,t,n){let o=W3(e,t);return n?i1(e,t,!0)+Math.log(o):i1(e,t,!1)*o}function j3(e,t){let n=W3(e,t),o=R0(e,t);return[o[0]+Math.log(n),o[1]*n]}function W3(e,t){if(e>1e3&&t>.97*e)return M6(e,t);let n=e,o=1,r=1;for(let s=0;s<E1&&(n+=1,o*=t/n,r+=o,!(o<=G*r));s++);return r}var h6=2**-64;function M6(e,t){let n=1,o=0,r=1,s=0;for(let i=1;i<E1;i++){let c=e+i,u=c-e,l=e-(c-u)+(i-u),f=t/c,a=134217729*f,N=a-(a-f),b=f-N;a=134217729*c;let S=a-(a-c),y=c-S,p=f*c,P=N*S-p+N*y+b*S+b*y,F=(t-p-P-f*l)/c;a=134217729*n;let R=a-(a-n),Z=n-R,J=n*f,Y=R*N-J+R*b+Z*N+Z*b+(n*F+o*f);n=J+Y,o=Y-(n-J);let O=r+n,c1=O-r,W=r-(O-c1)+(n-c1)+(s+o);if(r=O+W,s=W-(r-O),n*f<=h6*r*(1-f))break}return r+s}function m6(e,t,n){let o=$3(e,t);return n?Math.log(e)+i1(e,t,!0)+Math.log(o):e*i1(e,t,!1)*o}function N6(e,t){let n=$3(e,t),o=R0(e,t);return[Math.log(e)+o[0]+Math.log(n),e*o[1]*n]}function $3(e,t){let n=1-e,o=t+n+1,r=0,s=1,i=t,c=t+1,u=o*t,l=c/u;for(let f=0;f<E1;f++){r+=1,n+=1,o+=2;let a=n*r,N=c*o-s*a,b=u*o-i*a,S;if(b!==0){let y=N/b;S=Math.abs((l-y)/y),l=y}else S=1;if(s=c,c=N,i=u,u=b,Math.abs(N)>l6&&(s*=F1,c*=F1,i*=F1,u*=F1),S<=G)break}return l}function x3(e,t){let n=1,o=0;for(let c=1;c<E1;c++){n*=-t/c;let u=n/(e+c);if(o+=u,Math.abs(u)<=G*Math.abs(o))break}let r=Math.log(t),s=e*r-V(e);return-Math.expm1(s)-e*Math.exp(s)*o}function L1(e,t,n){let o=n?-1:1,r=t/e,s=(t-e)/e,i;r>1?i=Math.sqrt(-2*L0(s)):r<1?i=-Math.sqrt(-2*L0(s)):i=0;let c=.5*I1(o*i*Math.sqrt(e/2)),u=new Array(25).fill(0);u[0]=1;let l=0,f=0,a=1,N=1/0;for(let b=0;b<25;b++){let S=V3[b],y=S[0];for(let F=1;F<25;F++){F>l&&(u[F]=i*u[F-1],l+=1);let R=S[F]*u[F];if(y+=R,Math.abs(R)<G*Math.abs(y))break}let p=y*a,P=Math.abs(p);if(P>N||(f+=p,P<G*Math.abs(f)))break;N=P,a/=e}return c+=o*Math.exp(-.5*e*i*i)*f/Math.sqrt(2*Math.PI*e),c}function E0(e,t,n){if(t>1.1)return t<e?{lower:!0,value:U3(e,t,n)}:{lower:!1,value:m6(e,t,n)};if(t<=.5?-.4/Math.log(t)<e:t*1.1<e)return{lower:!0,value:U3(e,t,n)};let r=x3(e,t);return{lower:!1,value:n?Math.log(r):r}}function p6(e,t){if(t>1.1){let[r,s]=t<e?j3(e,t):N6(e,t);return{lower:t<e,log:r,lin:s}}if(t<=.5?-.4/Math.log(t)<e:t*1.1<e){let[r,s]=j3(e,t);return{lower:!0,log:r,lin:s}}let o=x3(e,t);return{lower:!1,log:Math.log(o),lin:o}}function _4(e,t,n){if(Number.isNaN(e)||Number.isNaN(t))return[NaN,NaN];if(t<0||e<0)return[NaN,NaN];if(e===0)return t>0?n?[0,1]:[-1/0,0]:[NaN,NaN];if(t===0)return n?[-1/0,0]:[0,1];if(e===1/0)return t===1/0?[NaN,NaN]:n?[-1/0,0]:[0,1];if(t===1/0)return n?[0,1]:[-1/0,0];if(t>1e15*Math.max(e,1)){let s=(e-1)*Math.log(t)-t-K(e)+Math.log1p((e-1)/t);return n?[Math.log1p(-Math.exp(s)),-Math.expm1(s)]:[s,Math.exp(s)]}let o=Math.abs(t-e)/e;if(e>K3&&e<R1&&o<Z3||e>R1&&o<J3/Math.sqrt(e)){let s=L1(e,t,n);return[s>.5?Math.log1p(-L1(e,t,!n)):Math.log(s),s]}let r=p6(e,t);return r.lower===n?[r.log,r.lin]:[r.lin>0?Math.log1p(-r.lin):-Math.exp(r.log),1-r.lin]}function P4(e,t,n,o){if(Number.isNaN(e)||Number.isNaN(t))return NaN;if(t<0||e<0)return NaN;let r=o?-1/0:0,s=o?0:1;if(e===0)return t>0?n?s:r:NaN;if(t===0)return n?r:s;if(e===1/0)return t===1/0?NaN:n?r:s;if(t===1/0)return n?s:r;if(t>1e15*Math.max(e,1)){let u=(e-1)*Math.log(t)-t-K(e)+Math.log1p((e-1)/t);return n?o?Math.log1p(-Math.exp(u)):-Math.expm1(u):o?u:Math.exp(u)}let i=Math.abs(t-e)/e;if(e>K3&&e<R1&&i<Z3||e>R1&&i<J3/Math.sqrt(e)){let u=L1(e,t,n);return o?u>.5?Math.log1p(-L1(e,t,!n)):Math.log(u):u}if(o){let u=E0(e,t,!0);if(u.lower===n)return u.value;let l=E0(e,t,!1).value;return l>0?Math.log1p(-l):-Math.exp(u.value)}let c=E0(e,t,!1);return c.lower===n?c.value:1-c.value}export{v as a,r1 as b,I1 as c,d1 as d,S1 as e,Y6 as f,U6 as g,j6 as h,G as i,v0 as j,E3 as k,k as l,T as m,K as n,V as o,A as p,C as q,i4 as r,c4 as s,u4 as t,i1 as u,W3 as v,$3 as w,_4 as x,P4 as y,q3 as z,c6 as A,u6 as B,H3 as C};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! rStats.js 0.6.1 | 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 U,b as O}from"./chunk-DRNMIEYH.js";var y=Math.pow(Number.EPSILON,.25);function q(a,s,o,N=y){let M=.5*(3-Math.sqrt(5)),x=Math.sqrt(Number.EPSILON),n=s,l=o,i=n+M*(l-n),e=i,t=i,r=0,f=0,c=a(t),b=c,m=c,u=1,E=N/3;for(;;){let d=.5*(n+l),h=x*Math.abs(t)+E,w=2*h;if(Math.abs(t-d)<=w-.5*(l-n))break;let g=!0;if(Math.abs(f)>h){let R=(t-e)*(c-b),v=(t-i)*(c-m),I=(t-i)*v-(t-e)*R;if(v=2*(v-R),v>0?I=-I:v=-v,R=f,f=r,Math.abs(I)<Math.abs(.5*v*R)&&I>v*(n-t)&&I<v*(l-t)){r=I/v;let S=t+r;(S-n<w||l-S<w)&&(r=t<=d?h:-h),g=!1}}g&&(f=t<d?l-t:n-t,r=M*f);let L=Math.abs(r)>=h?t+r:r>=0?t+h:t-h,A=a(L);u++,A<=c?(L<t?l=t:n=t,i=e,b=m,e=t,m=c,t=L,c=A):(L<t?n=L:l=L,A<=m||e===t?(i=e,b=m,e=L,m=A):(A<=b||i===t||i===e)&&(i=L,b=A))}return{x:t,fx:c,evaluations:u}}var T=["OK","maximum number of subdivisions reached","roundoff error was detected","extremely bad integrand behaviour","roundoff error is detected in the extrapolation table","the integral is probably divergent","the input is invalid"],F=Number.EPSILON**.25;function k(a,s,o,N={}){let M=N.subdivisions??100,x=N.relTol??F,n=N.absTol??x,l=N.stopOnError??!0;if(Number.isNaN(s)||Number.isNaN(o))throw new RangeError("a limit is NA or NaN");if(M<1||n<=0&&x<Math.max(50*Number.EPSILON,5e-29))throw new RangeError("invalid parameter values");let i=r=>{let f=a(r);if(!Number.isFinite(f))throw new RangeError("non-finite function value");return f},e=Number.isFinite(s)&&Number.isFinite(o)?U(i,s,o,n,x,M):Number.isFinite(s)?O(i,s,1,n,x,M):Number.isFinite(o)?O(i,o,-1,n,x,M):O(i,0,2,n,x,M),t=T[e.ier]??"unknown error";if(e.ier===6)throw new RangeError("the input is invalid");if(e.ier!==0&&l)throw new RangeError(t);return{value:e.result,absError:e.abserr,subdivisions:e.last,ier:e.ier,message:t}}function p(a,s,o,N={}){let M=N.maximum??!1,x=N.tol??F;if(!(s<o))throw new RangeError("'xmin' not less than 'xmax'");let n=q(M?l=>-a(l):a,s,o,x);return{optimum:n.x,objective:a(n.x)}}function j(a,s,o,N={}){let M=N.tol??F,x=N.maxiter??1e3,n=N.extendInt??"no";if(!(s<o))throw new RangeError("lower < upper is not fulfilled");let l=N.fLower??a(s),i=N.fUpper??a(o);if(Number.isNaN(l))throw new RangeError("f.lower = f(lower) is NA");if(Number.isNaN(i))throw new RangeError("f.upper = f(upper) is NA");let e=u=>Math.max(-Number.MAX_VALUE,Math.min(Number.MAX_VALUE,u)),t=u=>.01*Math.max(1e-4,Math.abs(u)),r=n==="downX"?-1:n==="upX"?1:0,f=n==="yes"?e(l)*e(i)>0:r!==0&&(r*e(l)>0||r*e(i)<0),c=0,b=()=>{if(++c>x)throw new RangeError(`no sign change found in ${c-1} iterations`)};if(f&&n==="yes"){let u=t(s),E=t(o);for(;l*i>0&&(Number.isFinite(s)||Number.isFinite(o));){if(b(),Number.isFinite(s)){let d=s-u,h=a(d);Number.isNaN(h)?u/=4:[s,l]=[d,h]}if(Number.isFinite(o)){let d=o+E,h=a(d);Number.isNaN(h)?E/=4:[o,i]=[d,h]}u*=2,E*=2}}else if(f){let u=t(s);for(;r*l>0;)b(),s-=u,l=a(s),u*=2;for(u=t(o);r*i<0;)b(),o+=u,i=a(o),u*=2}if(!(Math.sign(l)*Math.sign(i)<=0))throw new RangeError(f?"did not succeed extending the interval endpoints for f(lower) * f(upper) <= 0":"f() values at end points not of opposite sign");let m=X(u=>P(a(u)),s,o,P(l),P(i),M,x);return{root:m.root,fRoot:a(m.root),iter:f?m.iter+c:m.iter,initIt:f?c:NaN,estimPrec:m.estimPrec}}function P(a){return a===-1/0?-Number.MAX_VALUE:a===1/0||Number.isNaN(a)?Number.MAX_VALUE:a}function X(a,s,o,N,M,x,n){if(N===0)return{root:s,iter:0,estimPrec:0};if(M===0)return{root:o,iter:0,estimPrec:0};let l=Number.EPSILON,i=s,e=o,t=N,r=M,f=i,c=t,b=e-i,m=b;for(let u=0;u<=n;u++){m=e-i,Math.abs(c)<Math.abs(r)&&(i=e,e=f,f=i,t=r,r=c,c=t);let E=2*l*Math.abs(e)+.5*x,d=.5*(f-e);if(Math.abs(d)<=E||r===0)return{root:e,iter:u,estimPrec:Math.abs(f-e)};if(Math.abs(m)>=E&&Math.abs(t)>Math.abs(r)){let h=r/t,w,g;if(i===f)w=2*d*h,g=1-h;else{g=t/c;let L=r/c;w=h*(2*d*g*(g-L)-(e-i)*(L-1)),g=(g-1)*(L-1)*(h-1)}w>0?g=-g:w=-w,h=m,m=b,2*w>=3*d*g-Math.abs(E*g)||w>=Math.abs(.5*h*g)?(b=d,m=b):b=w/g}else b=d,m=b;i=e,t=r,Math.abs(b)>E?e+=b:d>0?e+=E:e-=E,r=a(e),r*(c/Math.abs(c))>0&&(f=i,c=t,b=e-i,m=b)}return{root:e,iter:n,estimPrec:Math.abs(f-e)}}export{k as a,p as b,j as c};
|