@numero-uno-jpn/rstats 0.0.0-stage → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/LICENSE +21 -0
  3. package/README.ja.md +181 -0
  4. package/README.md +172 -2
  5. package/THIRD_PARTY_NOTICES.md +297 -0
  6. package/dist/distributions/beta.d.ts +62 -0
  7. package/dist/distributions/beta.js +246 -0
  8. package/dist/distributions/binomial.d.ts +41 -0
  9. package/dist/distributions/binomial.js +136 -0
  10. package/dist/distributions/cauchy.d.ts +34 -0
  11. package/dist/distributions/cauchy.js +139 -0
  12. package/dist/distributions/chisq.d.ts +42 -0
  13. package/dist/distributions/chisq.js +60 -0
  14. package/dist/distributions/exponential.d.ts +34 -0
  15. package/dist/distributions/exponential.js +93 -0
  16. package/dist/distributions/f.d.ts +47 -0
  17. package/dist/distributions/f.js +214 -0
  18. package/dist/distributions/gamma.d.ts +61 -0
  19. package/dist/distributions/gamma.js +188 -0
  20. package/dist/distributions/geometric.d.ts +38 -0
  21. package/dist/distributions/geometric.js +116 -0
  22. package/dist/distributions/hypergeometric.d.ts +38 -0
  23. package/dist/distributions/hypergeometric.js +234 -0
  24. package/dist/distributions/logistic.d.ts +36 -0
  25. package/dist/distributions/logistic.js +94 -0
  26. package/dist/distributions/lognormal.d.ts +39 -0
  27. package/dist/distributions/lognormal.js +158 -0
  28. package/dist/distributions/nbeta.d.ts +7 -0
  29. package/dist/distributions/nbeta.js +312 -0
  30. package/dist/distributions/nchisq.d.ts +3 -0
  31. package/dist/distributions/nchisq.js +217 -0
  32. package/dist/distributions/negbinomial.d.ts +54 -0
  33. package/dist/distributions/negbinomial.js +325 -0
  34. package/dist/distributions/normal.d.ts +66 -0
  35. package/dist/distributions/normal.js +184 -0
  36. package/dist/distributions/nt.d.ts +3 -0
  37. package/dist/distributions/nt.js +491 -0
  38. package/dist/distributions/poisson.d.ts +41 -0
  39. package/dist/distributions/poisson.js +104 -0
  40. package/dist/distributions/signrank.d.ts +38 -0
  41. package/dist/distributions/signrank.js +216 -0
  42. package/dist/distributions/t.d.ts +49 -0
  43. package/dist/distributions/t.js +235 -0
  44. package/dist/distributions/tukey.d.ts +43 -0
  45. package/dist/distributions/tukey.js +985 -0
  46. package/dist/distributions/uniform.d.ts +36 -0
  47. package/dist/distributions/uniform.js +90 -0
  48. package/dist/distributions/weibull.d.ts +37 -0
  49. package/dist/distributions/weibull.js +125 -0
  50. package/dist/distributions/wilcox.d.ts +47 -0
  51. package/dist/distributions/wilcox.js +270 -0
  52. package/dist/htest/chisqTest.d.ts +55 -0
  53. package/dist/htest/chisqTest.js +160 -0
  54. package/dist/htest/cor.d.ts +81 -0
  55. package/dist/htest/cor.js +436 -0
  56. package/dist/htest/fisherTest.d.ts +48 -0
  57. package/dist/htest/fisherTest.js +468 -0
  58. package/dist/htest/pAdjust.d.ts +34 -0
  59. package/dist/htest/pAdjust.js +147 -0
  60. package/dist/htest/tTest.d.ts +57 -0
  61. package/dist/htest/tTest.js +153 -0
  62. package/dist/htest/types.d.ts +49 -0
  63. package/dist/htest/types.js +20 -0
  64. package/dist/htest/wilcoxTest.d.ts +61 -0
  65. package/dist/htest/wilcoxTest.js +471 -0
  66. package/dist/index.d.ts +50 -0
  67. package/dist/index.js +50 -0
  68. package/dist/internal/ddexp.d.ts +19 -0
  69. package/dist/internal/ddexp.js +94 -0
  70. package/dist/internal/discrete.d.ts +14 -0
  71. package/dist/internal/discrete.js +85 -0
  72. package/dist/internal/dpq.d.ts +43 -0
  73. package/dist/internal/dpq.js +54 -0
  74. package/dist/internal/integer.d.ts +4 -0
  75. package/dist/internal/integer.js +17 -0
  76. package/dist/internal/invert.d.ts +36 -0
  77. package/dist/internal/invert.js +124 -0
  78. package/dist/internal/noncentral.d.ts +12 -0
  79. package/dist/internal/noncentral.js +2 -0
  80. package/dist/internal/poissonMixture.d.ts +31 -0
  81. package/dist/internal/poissonMixture.js +401 -0
  82. package/dist/internal/summary.d.ts +21 -0
  83. package/dist/internal/summary.js +125 -0
  84. package/dist/internal/uniroot.d.ts +11 -0
  85. package/dist/internal/uniroot.js +75 -0
  86. package/dist/internal/vectorize.d.ts +12 -0
  87. package/dist/internal/vectorize.js +7 -0
  88. package/dist/linalg/basic.d.ts +95 -0
  89. package/dist/linalg/basic.js +152 -0
  90. package/dist/linalg/chol.d.ts +83 -0
  91. package/dist/linalg/chol.js +200 -0
  92. package/dist/linalg/eigen.d.ts +52 -0
  93. package/dist/linalg/eigen.js +753 -0
  94. package/dist/linalg/kappa.d.ts +51 -0
  95. package/dist/linalg/kappa.js +199 -0
  96. package/dist/linalg/matrix.d.ts +29 -0
  97. package/dist/linalg/matrix.js +65 -0
  98. package/dist/linalg/norm.d.ts +32 -0
  99. package/dist/linalg/norm.js +92 -0
  100. package/dist/linalg/qr.d.ts +264 -0
  101. package/dist/linalg/qr.js +494 -0
  102. package/dist/linalg/solve.d.ts +123 -0
  103. package/dist/linalg/solve.js +380 -0
  104. package/dist/linalg/svd.d.ts +38 -0
  105. package/dist/linalg/svd.js +275 -0
  106. package/dist/random/as241.d.ts +2 -0
  107. package/dist/random/as241.js +58 -0
  108. package/dist/random/beta.d.ts +14 -0
  109. package/dist/random/beta.js +117 -0
  110. package/dist/random/binomial.d.ts +25 -0
  111. package/dist/random/binomial.js +224 -0
  112. package/dist/random/common.d.ts +4 -0
  113. package/dist/random/common.js +35 -0
  114. package/dist/random/continuous.d.ts +91 -0
  115. package/dist/random/continuous.js +138 -0
  116. package/dist/random/gamma.d.ts +52 -0
  117. package/dist/random/gamma.js +217 -0
  118. package/dist/random/hyper.d.ts +12 -0
  119. package/dist/random/hyper.js +240 -0
  120. package/dist/random/mt.d.ts +16 -0
  121. package/dist/random/mt.js +97 -0
  122. package/dist/random/poisson.d.ts +33 -0
  123. package/dist/random/poisson.js +204 -0
  124. package/dist/random/rank.d.ts +19 -0
  125. package/dist/random/rank.js +62 -0
  126. package/dist/random/rng.d.ts +46 -0
  127. package/dist/random/rng.js +148 -0
  128. package/dist/random/sample.d.ts +45 -0
  129. package/dist/random/sample.js +255 -0
  130. package/dist/rstats.js +2 -0
  131. package/dist/special/beta.d.ts +30 -0
  132. package/dist/special/beta.js +152 -0
  133. package/dist/special/constants.d.ts +16 -0
  134. package/dist/special/constants.js +19 -0
  135. package/dist/special/dd.d.ts +29 -0
  136. package/dist/special/dd.js +693 -0
  137. package/dist/special/erf.d.ts +9 -0
  138. package/dist/special/erf.js +85 -0
  139. package/dist/special/gamma.d.ts +32 -0
  140. package/dist/special/gamma.js +270 -0
  141. package/dist/special/igam.d.ts +11 -0
  142. package/dist/special/igam.js +291 -0
  143. package/dist/special/igamAsympCoeff.d.ts +4 -0
  144. package/dist/special/igamAsympCoeff.js +233 -0
  145. package/dist/special/igami.d.ts +2 -0
  146. package/dist/special/igami.js +135 -0
  147. package/dist/special/incbet.d.ts +25 -0
  148. package/dist/special/incbet.js +326 -0
  149. package/dist/special/lgammaDiff.d.ts +2 -0
  150. package/dist/special/lgammaDiff.js +34 -0
  151. package/dist/special/loader.d.ts +43 -0
  152. package/dist/special/loader.js +456 -0
  153. package/dist/special/log1pmx.d.ts +2 -0
  154. package/dist/special/log1pmx.js +20 -0
  155. package/dist/special/ndtri.d.ts +4 -0
  156. package/dist/special/ndtri.js +82 -0
  157. package/dist/special/polevl.d.ts +4 -0
  158. package/dist/special/polevl.js +17 -0
  159. package/package.json +68 -4
@@ -0,0 +1,297 @@
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`
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
+
104
+ ```
105
+ Boost Software License - Version 1.0 - August 17th, 2003
106
+
107
+ Permission is hereby granted, free of charge, to any person or organization
108
+ obtaining a copy of the software and accompanying documentation covered by
109
+ this license (the "Software") to use, reproduce, display, distribute,
110
+ execute, and transmit the Software, and to prepare derivative works of the
111
+ Software, and to permit third-parties to whom the Software is furnished to
112
+ do so, all subject to the following:
113
+
114
+ The copyright notices in the Software and this entire statement, including
115
+ the above license grant, this restriction and the following disclaimer,
116
+ must be included in all copies of the Software, in whole or in part, and
117
+ all derivative works of the Software, unless such copies or derivative
118
+ works are solely in the form of machine-executable object code generated by
119
+ a source language processor.
120
+
121
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
122
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
123
+ FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
124
+ SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
125
+ FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
126
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
127
+ DEALINGS IN THE SOFTWARE.
128
+ ```
129
+
130
+ Boost.Math: Copyright John Maddock 2008, Matt Borland 2024 (and other contributors).
131
+
132
+ ---
133
+
134
+ ## SciPy (scipy.stats)
135
+
136
+ - Source: https://github.com/scipy/scipy (commit a087e61)
137
+ - `scipy/stats/_stats_py.py` (ttest_1samp / ttest_ind / ttest_rel, chisquare, fisher_exact, pearsonr)
138
+ - `scipy/stats/contingency.py` (chi2_contingency, expected_freq)
139
+ - `scipy/stats/_odds_ratio.py` (conditional odds ratio and its confidence interval)
140
+ - `scipy/stats/_wilcoxon.py`, `scipy/stats/_mannwhitneyu.py`
141
+ - `scipy/stats/_mstats_basic.py` (kendalltau, `_kendall_p_exact`)
142
+ - Used in: `src/htest/tTest.ts`, `src/htest/chisqTest.ts`, `src/htest/fisherTest.ts`, `src/htest/wilcoxTest.ts`, `src/htest/cor.ts`
143
+ - License: BSD-3-Clause
144
+
145
+ ```
146
+ Copyright (c) 2001-2002 Enthought, Inc. 2003, SciPy Developers.
147
+ All rights reserved.
148
+
149
+ Redistribution and use in source and binary forms, with or without
150
+ modification, are permitted provided that the following conditions
151
+ are met:
152
+
153
+ 1. Redistributions of source code must retain the above copyright
154
+ notice, this list of conditions and the following disclaimer.
155
+
156
+ 2. Redistributions in binary form must reproduce the above
157
+ copyright notice, this list of conditions and the following
158
+ disclaimer in the documentation and/or other materials provided
159
+ with the distribution.
160
+
161
+ 3. Neither the name of the copyright holder nor the names of its
162
+ contributors may be used to endorse or promote products derived
163
+ from this software without specific prior written permission.
164
+
165
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
166
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
167
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
168
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
169
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
170
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
171
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
172
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
173
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
174
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
175
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
176
+ ```
177
+
178
+ ---
179
+
180
+ ## statsmodels
181
+
182
+ - Source: https://github.com/statsmodels/statsmodels (commit 5c65604)
183
+ - `statsmodels/stats/multitest.py` (multipletests, method = "hommel")
184
+ - Used in: `src/htest/pAdjust.ts`
185
+ - License: BSD-3-Clause
186
+
187
+ ```
188
+ Copyright (C) 2006, Jonathan E. Taylor
189
+ All rights reserved.
190
+
191
+ Copyright (c) 2006-2008 Scipy Developers.
192
+ All rights reserved.
193
+
194
+ Copyright (c) 2009-2018 statsmodels Developers.
195
+ All rights reserved.
196
+
197
+
198
+ Redistribution and use in source and binary forms, with or without
199
+ modification, are permitted provided that the following conditions are met:
200
+
201
+ a. Redistributions of source code must retain the above copyright notice,
202
+ this list of conditions and the following disclaimer.
203
+ b. Redistributions in binary form must reproduce the above copyright
204
+ notice, this list of conditions and the following disclaimer in the
205
+ documentation and/or other materials provided with the distribution.
206
+ c. Neither the name of statsmodels nor the names of its contributors
207
+ may be used to endorse or promote products derived from this software
208
+ without specific prior written permission.
209
+
210
+
211
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
212
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
213
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
214
+ ARE DISCLAIMED. IN NO EVENT SHALL STATSMODELS OR CONTRIBUTORS BE LIABLE FOR
215
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
216
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
217
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
218
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
219
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
220
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
221
+ DAMAGE.
222
+ ```
223
+
224
+ ---
225
+
226
+ ## LAPACK
227
+
228
+ - Source: https://github.com/Reference-LAPACK/lapack (tag v3.12.0)
229
+ - `BLAS/SRC/dtrsm.f`, `SRC/dlange.f`, `SRC/dpotf2.f`, `SRC/dpstf2.f`, `SRC/dpotri.f` (`dtrti2.f`, `dlauu2.f`),
230
+ `SRC/dgeqp3.f` (`dlaqp2.f`, `dlarfg.f`, `dlarf.f`), `SRC/dorm2r.f`, `SRC/dgetf2.f`, `SRC/dgetrs.f`,
231
+ `SRC/dgecon.f`, `SRC/dtrcon.f`, `SRC/dlacn2.f`
232
+ - 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`
233
+ - License: modified BSD
234
+
235
+ ```
236
+ Copyright (c) 1992-2023 The University of Tennessee and The University
237
+ of Tennessee Research Foundation. All rights
238
+ reserved.
239
+ Copyright (c) 2000-2023 The University of California Berkeley. All
240
+ rights reserved.
241
+ Copyright (c) 2006-2023 The University of Colorado Denver. All rights
242
+ reserved.
243
+
244
+ $COPYRIGHT$
245
+
246
+ Additional copyrights may follow
247
+
248
+ $HEADER$
249
+
250
+ Redistribution and use in source and binary forms, with or without
251
+ modification, are permitted provided that the following conditions are
252
+ met:
253
+
254
+ - Redistributions of source code must retain the above copyright
255
+ notice, this list of conditions and the following disclaimer.
256
+
257
+ - Redistributions in binary form must reproduce the above copyright
258
+ notice, this list of conditions and the following disclaimer listed
259
+ in this license in the documentation and/or other materials
260
+ provided with the distribution.
261
+
262
+ - Neither the name of the copyright holders nor the names of its
263
+ contributors may be used to endorse or promote products derived from
264
+ this software without specific prior written permission.
265
+
266
+ The copyright holders provide no reassurances that the source code
267
+ provided does not infringe any patent, copyright, or any other
268
+ intellectual property rights of third parties. The copyright holders
269
+ disclaim any liability to any recipient for claims brought against
270
+ recipient by any third party for infringement of that parties
271
+ intellectual property rights.
272
+
273
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
274
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
275
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
276
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
277
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
278
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
279
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
280
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
281
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
282
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
283
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
284
+ ```
285
+
286
+ ---
287
+
288
+ ## Public-domain sources (listed for attribution)
289
+
290
+ The following algorithms come from public-domain software. No license terms apply;
291
+ they are listed so that readers can find the originals.
292
+
293
+ - LINPACK (Dongarra, Bunch, Moler, Stewart 1979): `dqrdc` (Householder QR, used with the
294
+ column-pivoting rule of R observed from its output) and `dtrco` (condition estimate) —
295
+ `src/linalg/qr.ts`, `src/linalg/kappa.ts`
296
+ - EISPACK / JAMA (NIST and The MathWorks): `svd` (Golub–Reinsch), `tred2`, `tql2`, `orthes`, `hqr2` —
297
+ `src/linalg/svd.ts`, `src/linalg/eigen.ts`
@@ -0,0 +1,62 @@
1
+ import { type Vectorizable, type VectorResult } from "../internal/vectorize.js";
2
+ import { type DensityOptions, type TailOptions } from "../internal/dpq.js";
3
+ import type { NoncentralOption } from "../internal/noncentral.js";
4
+ /** Log density (0 < x < 1, 0 < a, b < Inf) */
5
+ export declare function dbetaLog(x: number, _xc: number, a: number, b: number): number;
6
+ export declare function dbeta1(x: number, a: number, b: number, log: boolean): number;
7
+ export declare function pbeta1(q: number, a: number, b: number, lowerTail: boolean, logP: boolean): number;
8
+ /**
9
+ * Starting value for quantiles (Abramowitz & Stegun 26.5.22). Approximates the x with I_x(a, b) = target if lower,
10
+ * otherwise 1 - I_x(a, b) = target. Used only for a, b > 1; undefined otherwise.
11
+ * x ≈ a / (a + b e^(2w)), w = y sqrt(h + λ)/h - (1/(2b-1) - 1/(2a-1)) (λ + 5/6 - 2/(3h)),
12
+ * h = 2 / (1/(2a-1) + 1/(2b-1)), λ = (y^2 - 3)/6, y is the normal point whose upper probability equals I_x
13
+ */
14
+ export declare function betaQuantileGuess(a: number, b: number, lower: boolean, logTarget: number): number | undefined;
15
+ export declare function qbeta1(p: number, a: number, b: number, lowerTail: boolean, logP: boolean): number;
16
+ /**
17
+ * Density of the beta distribution. Equivalent to R's `dbeta(x, shape1, shape2, ncp = 0, log = FALSE)`.
18
+ *
19
+ * If `ncp` is omitted the central distribution is used; otherwise the noncentral beta distribution.
20
+ *
21
+ * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
22
+ * @param shape1 - First shape parameter (a).
23
+ * @param shape2 - Second shape parameter (b).
24
+ * @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
25
+ * @returns The density (or log density).
26
+ */
27
+ export declare function dbeta<T extends Vectorizable>(x: T, shape1: number, shape2: number, options?: DensityOptions & NoncentralOption): VectorResult<T>;
28
+ /**
29
+ * Distribution function of the beta distribution. Equivalent to R's `pbeta(q, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE)`.
30
+ *
31
+ * If `ncp` is omitted the central distribution is used; otherwise the noncentral beta distribution.
32
+ *
33
+ * @param q - Quantile(s): a number, `number[]` or `Float64Array`. The result has the same shape.
34
+ * @param shape1 - First shape parameter (a).
35
+ * @param shape2 - Second shape parameter (b).
36
+ * @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
37
+ * @returns The probability (or log probability).
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * pbeta(0.5, 2, 3); // 0.6875 (up to rounding)
42
+ * ```
43
+ */
44
+ export declare function pbeta<T extends Vectorizable>(q: T, shape1: number, shape2: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
45
+ /**
46
+ * Quantile function of the beta distribution. Equivalent to R's `qbeta(p, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE)`.
47
+ *
48
+ * If `ncp` is omitted the central distribution is used; otherwise the noncentral beta distribution.
49
+ *
50
+ * @param p - Probability (or log probability with `logP`): a number, `number[]` or `Float64Array`. The result has the same shape.
51
+ * @param shape1 - First shape parameter (a).
52
+ * @param shape2 - Second shape parameter (b).
53
+ * @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
54
+ * @returns The quantile(s).
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * qbeta(0.025, 3, 7); // 0.07485463141969181
59
+ * qbeta([0.025, 0.975], 3, 7); // [0.07485463141969181, 0.6000935737163121]
60
+ * ```
61
+ */
62
+ export declare function qbeta<T extends Vectorizable>(p: T, shape1: number, shape2: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
@@ -0,0 +1,246 @@
1
+ // Beta distribution dbeta / pbeta / qbeta.
2
+ //
3
+ // The density uses the relation to the binomial probability (Loader 2000) (dbetaCore). The distribution function
4
+ // uses the incomplete beta function (src/special/incbet.ts), and quantiles use Newton's method in u = log x
5
+ // (src/internal/invert.ts). Upper-tail quantiles are computed as x = 1 - (lower quantile of Beta(b, a)) to avoid
6
+ // cancellation near 1. Passing ncp gives the noncentral beta (src/distributions/nbeta.ts).
7
+ import { vectorize } from "../internal/vectorize.js";
8
+ import { d0, dt0, dt1, quantileBoundaries, smallerTail } from "../internal/dpq.js";
9
+ import { invertContinuous } from "../internal/invert.js";
10
+ import { lbeta } from "../special/beta.js";
11
+ import { betaInc, betaIncBoth } from "../special/incbet.js";
12
+ import { dbinomExponent } from "../special/loader.js";
13
+ import { ddAdd, ddLog, ddNeg, twoSum } from "../special/dd.js";
14
+ import { dnbeta1, pnbeta1, qnbeta1 } from "./nbeta.js";
15
+ import { qnorm } from "./normal.js";
16
+ /** Form x and 1 - x as a double-double pair based on the smaller of the two (no rounding of 1 - x brought in) */
17
+ function pair(x) {
18
+ return x <= 0.5 ? [[x, 0], twoSum(1, -x)] : [twoSum(1, -(1 - x)), [1 - x, 0]];
19
+ }
20
+ /**
21
+ * Density (0 < x < 1, 0 < a, b < Inf).
22
+ * From the relation to the binomial probability dbinom(a; a + b, x) = Gamma(a+b+1)/(Gamma(a+1) Gamma(b+1)) x^a (1-x)^b,
23
+ * f(x) = x^(a-1) (1-x)^(b-1) / B(a, b) = dbinom(a; a + b, x) * a b / ((a + b) x (1 - x))
24
+ * (valid for any a, b > 0). x and 1 - x are passed as a double-double pair.
25
+ */
26
+ function dbetaCore(x, a, b, log) {
27
+ const [xd, xcd] = pair(x);
28
+ // log f = -E - log(denom)/2 + log(a b / (a + b)) - log x - log(1 - x), assembled entirely in double-double
29
+ const { e, logDenom } = dbinomExponent(a, b, xd, xcd);
30
+ const rest = ddAdd(ddNeg(ddAdd(ddLog(xd), ddLog(xcd))), [Math.log((a * b) / (a + b)) - 0.5 * logDenom, 0]);
31
+ const t = ddAdd(ddNeg(e), rest);
32
+ return log ? t[0] + t[1] : Math.exp(t[0]) * (1 + t[1]);
33
+ }
34
+ /** Log density (0 < x < 1, 0 < a, b < Inf) */
35
+ export function dbetaLog(x, _xc, a, b) {
36
+ return dbetaCore(x, a, b, true);
37
+ }
38
+ export function dbeta1(x, a, b, log) {
39
+ if (Number.isNaN(x) || Number.isNaN(a) || Number.isNaN(b))
40
+ return NaN;
41
+ if (a < 0 || b < 0)
42
+ return NaN;
43
+ if (x < 0 || x > 1)
44
+ return d0(log);
45
+ // Point masses when a parameter is 0 or infinite
46
+ if (a === 0 || b === 0 || !Number.isFinite(a) || !Number.isFinite(b)) {
47
+ if (a === 0 && b === 0)
48
+ return x === 0 || x === 1 ? Infinity : d0(log);
49
+ if (a === 0 || b / a === Infinity)
50
+ return x === 0 ? Infinity : d0(log);
51
+ if (b === 0 || a / b === Infinity)
52
+ return x === 1 ? Infinity : d0(log);
53
+ return x === 0.5 ? Infinity : d0(log);
54
+ }
55
+ if (x === 0) {
56
+ if (a > 1)
57
+ return d0(log);
58
+ if (a < 1)
59
+ return Infinity;
60
+ return log ? Math.log(b) : b;
61
+ }
62
+ if (x === 1) {
63
+ if (b > 1)
64
+ return d0(log);
65
+ if (b < 1)
66
+ return Infinity;
67
+ return log ? Math.log(a) : a;
68
+ }
69
+ return dbetaCore(x, a, b, log);
70
+ }
71
+ export function pbeta1(q, a, b, lowerTail, logP) {
72
+ if (Number.isNaN(q) || Number.isNaN(a) || Number.isNaN(b))
73
+ return NaN;
74
+ if (a < 0 || b < 0)
75
+ return NaN;
76
+ if (q >= 1)
77
+ return dt1(lowerTail, logP);
78
+ // Point masses when a parameter is 0 or infinite (R checks this after q >= 1 and before q <= 0)
79
+ if (a === 0 || b === 0 || !Number.isFinite(a) || !Number.isFinite(b)) {
80
+ if (a === 0 && b === 0)
81
+ return logP ? -Math.LN2 : 0.5; // 1/2 each at 0 and 1
82
+ if (a === 0 || b / a === Infinity)
83
+ return dt1(lowerTail, logP); // concentrated at 0
84
+ if (b === 0 || a / b === Infinity)
85
+ return dt0(lowerTail, logP); // concentrated at 1
86
+ return q < 0.5 ? dt0(lowerTail, logP) : dt1(lowerTail, logP); // concentrated at 1/2
87
+ }
88
+ if (q <= 0)
89
+ return dt0(lowerTail, logP);
90
+ return betaInc(a, b, q, 1 - q, lowerTail, logP);
91
+ }
92
+ /**
93
+ * Starting value for quantiles (Abramowitz & Stegun 26.5.22). Approximates the x with I_x(a, b) = target if lower,
94
+ * otherwise 1 - I_x(a, b) = target. Used only for a, b > 1; undefined otherwise.
95
+ * x ≈ a / (a + b e^(2w)), w = y sqrt(h + λ)/h - (1/(2b-1) - 1/(2a-1)) (λ + 5/6 - 2/(3h)),
96
+ * h = 2 / (1/(2a-1) + 1/(2b-1)), λ = (y^2 - 3)/6, y is the normal point whose upper probability equals I_x
97
+ */
98
+ export function betaQuantileGuess(a, b, lower, logTarget) {
99
+ if (!(a > 1 && b > 1))
100
+ return undefined;
101
+ const z = qnorm(logTarget, { logP: true });
102
+ const y = lower ? -z : z;
103
+ const ra = 1 / (2 * a - 1);
104
+ const rb = 1 / (2 * b - 1);
105
+ const h = 2 / (ra + rb);
106
+ const lam = (y * y - 3) / 6;
107
+ if (!(h + lam > 0))
108
+ return undefined;
109
+ const w = (y * Math.sqrt(h + lam)) / h - (rb - ra) * (lam + 5 / 6 - 2 / (3 * h));
110
+ const x = a / (a + b * Math.exp(2 * w));
111
+ return x > 0 && x < 1 ? x : undefined;
112
+ }
113
+ /**
114
+ * Solve for the quantile in frame (a, b) when the answer lies in (0, 1/2].
115
+ * I_x(a, b) = target if lower, otherwise 1 - I_x(a, b) = target.
116
+ */
117
+ function solveLeftHalf(a, b, lower, logTarget, linearTarget) {
118
+ // If the distribution function at the smallest positive number already passes the target, the answer is too small to represent (0)
119
+ const atMin = betaInc(a, b, Number.MIN_VALUE, 1, lower, true);
120
+ if (lower ? atMin >= logTarget : atMin <= logTarget)
121
+ return 0;
122
+ // Starting value: near 0, the tail approximation I_x(a, b) ≈ x^a / (a B(a, b)); otherwise the A&S 26.5.22 approximation
123
+ let x0 = 0.25;
124
+ let tail = Infinity;
125
+ if (lower) {
126
+ const lguess = (logTarget + Math.log(a) + lbeta(a, b)) / a;
127
+ tail = Math.exp(Math.max(lguess, -745));
128
+ x0 = Math.min(tail, 0.25);
129
+ }
130
+ if (!(tail < 1e-3)) {
131
+ const g = betaQuantileGuess(a, b, lower, logTarget);
132
+ if (g !== undefined && g < 0.5)
133
+ x0 = g;
134
+ }
135
+ return invertContinuous({
136
+ logTarget,
137
+ ...(linearTarget !== undefined && { linearTarget }),
138
+ lower,
139
+ cdf: (x, l) => betaInc(a, b, x, 1 - x, l, false),
140
+ cdfLog: (x, l) => betaInc(a, b, x, 1 - x, l, true),
141
+ cdfBoth: (x, l) => betaIncBoth(a, b, x, 1 - x, l),
142
+ pdfLog: (x) => dbetaLog(x, 1 - x, a, b),
143
+ dlogPdf: (x) => (a - 1) / x - (b - 1) / (1 - x),
144
+ x0,
145
+ lo: 0,
146
+ hi: 0.5,
147
+ positive: true,
148
+ });
149
+ }
150
+ export function qbeta1(p, a, b, lowerTail, logP) {
151
+ if (Number.isNaN(p) || Number.isNaN(a) || Number.isNaN(b))
152
+ return NaN;
153
+ if (a < 0 || b < 0)
154
+ return NaN;
155
+ const bd = quantileBoundaries(p, 0, 1, lowerTail, logP);
156
+ if (bd !== undefined)
157
+ return bd;
158
+ // Point masses when a parameter is 0 or infinite
159
+ if (a === 0 || b === 0 || !Number.isFinite(a) || !Number.isFinite(b)) {
160
+ if (a === 0 && b === 0) {
161
+ const lp = logP ? p : Math.log(p);
162
+ const lower = lowerTail ? lp : Math.log1p(-Math.exp(lp));
163
+ if (lower < -Math.LN2)
164
+ return 0;
165
+ if (lower > -Math.LN2)
166
+ return 1;
167
+ return 0.5;
168
+ }
169
+ if (a === 0 || b / a === Infinity)
170
+ return 0;
171
+ if (b === 0 || a / b === Infinity)
172
+ return 1;
173
+ return 0.5;
174
+ }
175
+ const { lower, logTarget, linearTarget } = smallerTail(p, lowerTail, logP);
176
+ // Decide whether the answer lies left or right of 1/2 by comparing with the distribution function at x = 1/2
177
+ // (for skewed distributions the answer can be near 0 even when the lower probability exceeds 1/2)
178
+ const atHalf = betaInc(a, b, 0.5, 0.5, lower, true);
179
+ const leftHalf = lower ? logTarget <= atHalf : logTarget >= atHalf;
180
+ if (leftHalf)
181
+ return solveLeftHalf(a, b, lower, logTarget, linearTarget);
182
+ // Right half: y = 1 - x lies in (0, 1/2] in frame (b, a), with the tails swapped
183
+ return 1 - solveLeftHalf(b, a, !lower, logTarget, linearTarget);
184
+ }
185
+ /**
186
+ * Density of the beta distribution. Equivalent to R's `dbeta(x, shape1, shape2, ncp = 0, log = FALSE)`.
187
+ *
188
+ * If `ncp` is omitted the central distribution is used; otherwise the noncentral beta distribution.
189
+ *
190
+ * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
191
+ * @param shape1 - First shape parameter (a).
192
+ * @param shape2 - Second shape parameter (b).
193
+ * @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
194
+ * @returns The density (or log density).
195
+ */
196
+ export function dbeta(x, shape1, shape2, options = {}) {
197
+ const { log = false, ncp } = options;
198
+ if (ncp !== undefined)
199
+ return vectorize(x, (v) => dnbeta1(v, shape1, shape2, ncp, log));
200
+ return vectorize(x, (v) => dbeta1(v, shape1, shape2, log));
201
+ }
202
+ /**
203
+ * Distribution function of the beta distribution. Equivalent to R's `pbeta(q, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE)`.
204
+ *
205
+ * If `ncp` is omitted the central distribution is used; otherwise the noncentral beta distribution.
206
+ *
207
+ * @param q - Quantile(s): a number, `number[]` or `Float64Array`. The result has the same shape.
208
+ * @param shape1 - First shape parameter (a).
209
+ * @param shape2 - Second shape parameter (b).
210
+ * @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
211
+ * @returns The probability (or log probability).
212
+ *
213
+ * @example
214
+ * ```ts
215
+ * pbeta(0.5, 2, 3); // 0.6875 (up to rounding)
216
+ * ```
217
+ */
218
+ export function pbeta(q, shape1, shape2, options = {}) {
219
+ const { lowerTail = true, logP = false, ncp } = options;
220
+ if (ncp !== undefined)
221
+ return vectorize(q, (v) => pnbeta1(v, shape1, shape2, ncp, lowerTail, logP));
222
+ return vectorize(q, (v) => pbeta1(v, shape1, shape2, lowerTail, logP));
223
+ }
224
+ /**
225
+ * Quantile function of the beta distribution. Equivalent to R's `qbeta(p, shape1, shape2, ncp = 0, lower.tail = TRUE, log.p = FALSE)`.
226
+ *
227
+ * If `ncp` is omitted the central distribution is used; otherwise the noncentral beta distribution.
228
+ *
229
+ * @param p - Probability (or log probability with `logP`): a number, `number[]` or `Float64Array`. The result has the same shape.
230
+ * @param shape1 - First shape parameter (a).
231
+ * @param shape2 - Second shape parameter (b).
232
+ * @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
233
+ * @returns The quantile(s).
234
+ *
235
+ * @example
236
+ * ```ts
237
+ * qbeta(0.025, 3, 7); // 0.07485463141969181
238
+ * qbeta([0.025, 0.975], 3, 7); // [0.07485463141969181, 0.6000935737163121]
239
+ * ```
240
+ */
241
+ export function qbeta(p, shape1, shape2, options = {}) {
242
+ const { lowerTail = true, logP = false, ncp } = options;
243
+ if (ncp !== undefined)
244
+ return vectorize(p, (v) => qnbeta1(v, shape1, shape2, ncp, lowerTail, logP));
245
+ return vectorize(p, (v) => qbeta1(v, shape1, shape2, lowerTail, logP));
246
+ }
@@ -0,0 +1,41 @@
1
+ import { type Vectorizable, type VectorResult } from "../internal/vectorize.js";
2
+ import { type DensityOptions, type TailOptions } from "../internal/dpq.js";
3
+ export declare function dbinom1(x: number, size: number, prob: number, log: boolean): number;
4
+ export declare function pbinom1(q: number, size: number, prob: number, lowerTail: boolean, logP: boolean): number;
5
+ export declare function qbinom1(p: number, size: number, prob: number, lowerTail: boolean, logP: boolean): number;
6
+ /**
7
+ * Probability mass function of the binomial distribution. Equivalent to R's `dbinom(x, size, prob, log = FALSE)`.
8
+ *
9
+ * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
10
+ * @param size - Number of trials.
11
+ * @param prob - Probability of success on each trial.
12
+ * @param options - `log` (see {@link DensityOptions}).
13
+ * @returns The probability (or log probability).
14
+ */
15
+ export declare function dbinom<T extends Vectorizable>(x: T, size: number, prob: number, options?: DensityOptions): VectorResult<T>;
16
+ /**
17
+ * Distribution function of the binomial distribution. Equivalent to R's `pbinom(q, size, prob, lower.tail = TRUE, log.p = FALSE)`.
18
+ *
19
+ * @param q - Quantile(s): a number, `number[]` or `Float64Array`. The result has the same shape.
20
+ * @param size - Number of trials.
21
+ * @param prob - Probability of success on each trial.
22
+ * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
23
+ * @returns The probability (or log probability).
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * pbinom(3, 10, 0.5); // 0.171875
28
+ * pbinom([3, 5], 10, 0.5); // [0.171875, 0.623046875]
29
+ * ```
30
+ */
31
+ export declare function pbinom<T extends Vectorizable>(q: T, size: number, prob: number, options?: TailOptions): VectorResult<T>;
32
+ /**
33
+ * Quantile function of the binomial distribution. Equivalent to R's `qbinom(p, size, prob, lower.tail = TRUE, log.p = FALSE)`.
34
+ *
35
+ * @param p - Probability (or log probability with `logP`): a number, `number[]` or `Float64Array`. The result has the same shape.
36
+ * @param size - Number of trials.
37
+ * @param prob - Probability of success on each trial.
38
+ * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
39
+ * @returns The quantile(s).
40
+ */
41
+ export declare function qbinom<T extends Vectorizable>(p: T, size: number, prob: number, options?: TailOptions): VectorResult<T>;