@numero-uno-jpn/rstats 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.ja.md +13 -9
  3. package/README.md +13 -8
  4. package/dist/chunks/{chunk-QJJWGNJP.js → chunk-2X7JYQBI.js} +2 -2
  5. package/dist/chunks/{chunk-O6PT7IVU.js → chunk-36GVER3O.js} +2 -2
  6. package/dist/chunks/{chunk-EWC6I75B.js → chunk-3WUXRSM6.js} +1 -1
  7. package/dist/chunks/{chunk-4NM37MGA.js → chunk-6I6QKTFK.js} +2 -2
  8. package/dist/chunks/{chunk-2XKG3DX4.js → chunk-ETOEZTGL.js} +1 -1
  9. package/dist/chunks/{chunk-IT354SHV.js → chunk-FVPDVRJQ.js} +2 -2
  10. package/dist/chunks/{chunk-QULPY6YM.js → chunk-GG4BJMJW.js} +1 -1
  11. package/dist/chunks/{chunk-7HPVUVZB.js → chunk-HITD7CX6.js} +1 -1
  12. package/dist/chunks/{chunk-LIMZKONM.js → chunk-KK4GE65D.js} +2 -2
  13. package/dist/chunks/chunk-LAUYSGV4.js +3 -0
  14. package/dist/chunks/chunk-M6GDXKKS.js +2 -0
  15. package/dist/chunks/{chunk-QFULZNHL.js → chunk-PHHUHR7T.js} +1 -1
  16. package/dist/chunks/{chunk-ENL43FNO.js → chunk-WQPFDDIY.js} +2 -2
  17. package/dist/chunks/chunk-X2AWQSVS.js +2 -0
  18. package/dist/chunks/{chunk-ZRIM4R4A.js → chunk-ZRJQD7VS.js} +2 -2
  19. package/dist/data/grouping.d.ts +100 -0
  20. package/dist/data/grouping.js +264 -0
  21. package/dist/descriptive/basic.d.ts +130 -17
  22. package/dist/descriptive/basic.js +115 -14
  23. package/dist/descriptive/cov.d.ts +22 -12
  24. package/dist/descriptive/dataFrames.d.ts +138 -0
  25. package/dist/descriptive/dataFrames.js +400 -0
  26. package/dist/descriptive/factanal.d.ts +26 -6
  27. package/dist/descriptive/factanal.js +7 -3
  28. package/dist/descriptive/hist.d.ts +27 -6
  29. package/dist/descriptive/hist.js +9 -3
  30. package/dist/descriptive/missing.d.ts +42 -0
  31. package/dist/descriptive/missing.js +52 -0
  32. package/dist/descriptive/moments.d.ts +91 -13
  33. package/dist/descriptive/moments.js +66 -9
  34. package/dist/descriptive/omega.d.ts +28 -6
  35. package/dist/descriptive/omega.js +16 -4
  36. package/dist/descriptive/pivot.d.ts +105 -0
  37. package/dist/descriptive/pivot.js +347 -0
  38. package/dist/descriptive/quantile.d.ts +33 -5
  39. package/dist/descriptive/quantile.js +20 -2
  40. package/dist/descriptive/rank.d.ts +12 -2
  41. package/dist/descriptive/rank.js +2 -0
  42. package/dist/descriptive/table.d.ts +55 -7
  43. package/dist/descriptive/table.js +38 -4
  44. package/dist/descriptive.js +2 -2
  45. package/dist/distributions/arcsine.d.ts +40 -5
  46. package/dist/distributions/arcsine.js +35 -4
  47. package/dist/distributions/beta.d.ts +12 -0
  48. package/dist/distributions/beta.js +12 -0
  49. package/dist/distributions/binomial.d.ts +18 -0
  50. package/dist/distributions/binomial.js +18 -0
  51. package/dist/distributions/bvnorm.d.ts +4 -1
  52. package/dist/distributions/bvnorm.js +4 -1
  53. package/dist/distributions/cauchy.d.ts +24 -0
  54. package/dist/distributions/cauchy.js +24 -0
  55. package/dist/distributions/chisq.d.ts +18 -0
  56. package/dist/distributions/chisq.js +18 -0
  57. package/dist/distributions/exponential.d.ts +29 -1
  58. package/dist/distributions/exponential.js +24 -0
  59. package/dist/distributions/f.d.ts +18 -0
  60. package/dist/distributions/f.js +18 -0
  61. package/dist/distributions/gamma.d.ts +20 -0
  62. package/dist/distributions/gamma.js +18 -0
  63. package/dist/distributions/geometric.d.ts +24 -0
  64. package/dist/distributions/geometric.js +24 -0
  65. package/dist/distributions/hypergeometric.d.ts +24 -0
  66. package/dist/distributions/hypergeometric.js +24 -0
  67. package/dist/distributions/invgamma.d.ts +32 -4
  68. package/dist/distributions/invgamma.js +27 -3
  69. package/dist/distributions/kumaraswamy.d.ts +31 -3
  70. package/dist/distributions/kumaraswamy.js +31 -3
  71. package/dist/distributions/laplace.d.ts +36 -4
  72. package/dist/distributions/laplace.js +31 -3
  73. package/dist/distributions/logistic.d.ts +29 -1
  74. package/dist/distributions/logistic.js +24 -0
  75. package/dist/distributions/lognormal.d.ts +29 -1
  76. package/dist/distributions/lognormal.js +24 -0
  77. package/dist/distributions/multinomial.d.ts +7 -1
  78. package/dist/distributions/multinomial.js +2 -0
  79. package/dist/distributions/negbinomial.d.ts +29 -1
  80. package/dist/distributions/negbinomial.js +24 -0
  81. package/dist/distributions/normal.d.ts +11 -1
  82. package/dist/distributions/normal.js +6 -0
  83. package/dist/distributions/pareto.d.ts +36 -4
  84. package/dist/distributions/pareto.js +31 -3
  85. package/dist/distributions/poisson.d.ts +18 -0
  86. package/dist/distributions/poisson.js +18 -0
  87. package/dist/distributions/signrank.d.ts +24 -0
  88. package/dist/distributions/signrank.js +24 -0
  89. package/dist/distributions/summary.d.ts +20 -2
  90. package/dist/distributions/summary.js +4 -0
  91. package/dist/distributions/t.d.ts +18 -0
  92. package/dist/distributions/t.js +18 -0
  93. package/dist/distributions/triangular.d.ts +36 -4
  94. package/dist/distributions/triangular.js +31 -3
  95. package/dist/distributions/tukey.d.ts +15 -1
  96. package/dist/distributions/tukey.js +10 -0
  97. package/dist/distributions/uniform.d.ts +29 -1
  98. package/dist/distributions/uniform.js +24 -0
  99. package/dist/distributions/weibull.d.ts +29 -1
  100. package/dist/distributions/weibull.js +24 -0
  101. package/dist/distributions/wilcox.d.ts +24 -0
  102. package/dist/distributions/wilcox.js +24 -0
  103. package/dist/distributions.js +2 -2
  104. package/dist/entries/descriptive.d.ts +5 -1
  105. package/dist/entries/descriptive.js +4 -0
  106. package/dist/entries/numerics.d.ts +1 -1
  107. package/dist/entries/tests.js +1 -1
  108. package/dist/htest/agreement.d.ts +61 -23
  109. package/dist/htest/agreement.js +19 -9
  110. package/dist/htest/ansariTest.d.ts +19 -1
  111. package/dist/htest/ansariTest.js +5 -17
  112. package/dist/htest/aov.d.ts +43 -10
  113. package/dist/htest/aov.js +17 -3
  114. package/dist/htest/binomTest.d.ts +12 -2
  115. package/dist/htest/binomTest.js +2 -0
  116. package/dist/htest/brunnerMunzelTest.d.ts +9 -3
  117. package/dist/htest/brunnerMunzelTest.js +4 -2
  118. package/dist/htest/chisqTest.d.ts +19 -3
  119. package/dist/htest/cor.d.ts +31 -3
  120. package/dist/htest/cor.js +9 -27
  121. package/dist/htest/effectSize.d.ts +70 -12
  122. package/dist/htest/effectSize.js +40 -7
  123. package/dist/htest/fisherTest.d.ts +9 -1
  124. package/dist/htest/fisherTest.js +2 -0
  125. package/dist/htest/groups.d.ts +5 -1
  126. package/dist/htest/ksTest.d.ts +32 -2
  127. package/dist/htest/ksTest.js +5 -8
  128. package/dist/htest/leveneTest.d.ts +15 -4
  129. package/dist/htest/leveneTest.js +5 -2
  130. package/dist/htest/mantelhaenTest.d.ts +25 -3
  131. package/dist/htest/mantelhaenTest.js +15 -1
  132. package/dist/htest/mcnemarTest.d.ts +14 -4
  133. package/dist/htest/mcnemarTest.js +4 -2
  134. package/dist/htest/multipleComparisons.d.ts +173 -29
  135. package/dist/htest/multipleComparisons.js +123 -19
  136. package/dist/htest/normalityTests.d.ts +56 -9
  137. package/dist/htest/normalityTests.js +40 -6
  138. package/dist/htest/onewayTest.d.ts +45 -2
  139. package/dist/htest/onewayTest.js +15 -7
  140. package/dist/htest/pAdjust.d.ts +9 -1
  141. package/dist/htest/pAdjust.js +2 -0
  142. package/dist/htest/pairwise.d.ts +50 -5
  143. package/dist/htest/pairwise.js +25 -0
  144. package/dist/htest/poissonTest.d.ts +12 -2
  145. package/dist/htest/poissonTest.js +2 -0
  146. package/dist/htest/polycor.d.ts +29 -10
  147. package/dist/htest/power.d.ts +60 -6
  148. package/dist/htest/power.js +6 -0
  149. package/dist/htest/propTest.d.ts +13 -2
  150. package/dist/htest/propTest.js +2 -0
  151. package/dist/htest/pwr.d.ts +286 -36
  152. package/dist/htest/pwr.js +116 -15
  153. package/dist/htest/rankTests.d.ts +132 -7
  154. package/dist/htest/rankTests.js +30 -33
  155. package/dist/htest/tTest.d.ts +32 -2
  156. package/dist/htest/tTest.js +19 -24
  157. package/dist/htest/testFormula.d.ts +57 -0
  158. package/dist/htest/testFormula.js +171 -0
  159. package/dist/htest/trendTests.d.ts +29 -8
  160. package/dist/htest/trendTests.js +8 -4
  161. package/dist/htest/types.d.ts +14 -2
  162. package/dist/htest/varTest.d.ts +46 -6
  163. package/dist/htest/varTest.js +11 -21
  164. package/dist/htest/wilcoxTest.d.ts +23 -1
  165. package/dist/htest/wilcoxTest.js +9 -24
  166. package/dist/internal/dpq.d.ts +4 -0
  167. package/dist/internal/noncentral.d.ts +2 -0
  168. package/dist/internal/vectorize.d.ts +4 -0
  169. package/dist/linalg/basic.d.ts +39 -5
  170. package/dist/linalg/basic.js +15 -0
  171. package/dist/linalg/chol.d.ts +26 -5
  172. package/dist/linalg/chol.js +7 -0
  173. package/dist/linalg/eigen.d.ts +16 -7
  174. package/dist/linalg/eigen.js +6 -5
  175. package/dist/linalg/expm.d.ts +15 -5
  176. package/dist/linalg/expm.js +5 -3
  177. package/dist/linalg/kappa.d.ts +21 -1
  178. package/dist/linalg/kappa.js +16 -0
  179. package/dist/linalg/lu.d.ts +30 -6
  180. package/dist/linalg/lu.js +15 -3
  181. package/dist/linalg/matrix.d.ts +4 -0
  182. package/dist/linalg/norm.d.ts +16 -1
  183. package/dist/linalg/norm.js +9 -0
  184. package/dist/linalg/ops.d.ts +168 -36
  185. package/dist/linalg/ops.js +116 -20
  186. package/dist/linalg/qr.d.ts +87 -12
  187. package/dist/linalg/qr.js +31 -0
  188. package/dist/linalg/schur.d.ts +8 -2
  189. package/dist/linalg/schur.js +3 -1
  190. package/dist/linalg/solve.d.ts +42 -6
  191. package/dist/linalg/solve.js +22 -0
  192. package/dist/linalg/svd.d.ts +12 -2
  193. package/dist/linalg/svd.js +2 -0
  194. package/dist/linalg.js +2 -2
  195. package/dist/models/anovaSequential.d.ts +26 -4
  196. package/dist/models/anovaSequential.js +3 -1
  197. package/dist/models/aovEz.d.ts +29 -6
  198. package/dist/models/aovEz.js +5 -2
  199. package/dist/models/aovStrata.d.ts +12 -2
  200. package/dist/models/carAnova.d.ts +9 -3
  201. package/dist/models/carAnova.js +4 -2
  202. package/dist/models/coxph.d.ts +33 -7
  203. package/dist/models/coxph.js +8 -3
  204. package/dist/models/glm.d.ts +128 -21
  205. package/dist/models/glm.js +71 -14
  206. package/dist/models/glmAnova.d.ts +30 -5
  207. package/dist/models/glmAnova.js +15 -2
  208. package/dist/models/glmConfint.d.ts +16 -2
  209. package/dist/models/glmConfint.js +9 -1
  210. package/dist/models/glmFamily.d.ts +27 -5
  211. package/dist/models/lm.d.ts +75 -17
  212. package/dist/models/lm.js +22 -4
  213. package/dist/models/mauchly.d.ts +20 -5
  214. package/dist/models/mauchly.js +7 -3
  215. package/dist/models/modelFrame.d.ts +5 -1
  216. package/dist/models/modelMatrix.d.ts +18 -4
  217. package/dist/models/modelMatrix.js +3 -1
  218. package/dist/models/survival.d.ts +41 -9
  219. package/dist/models/survival.js +10 -4
  220. package/dist/numerics/deriv.d.ts +21 -6
  221. package/dist/numerics/deriv.js +16 -5
  222. package/dist/numerics/integrate.d.ts +37 -7
  223. package/dist/numerics/integrate.js +8 -2
  224. package/dist/numerics/interp.d.ts +63 -12
  225. package/dist/numerics/interp.js +30 -6
  226. package/dist/numerics/ode.d.ts +15 -5
  227. package/dist/numerics/ode.js +5 -3
  228. package/dist/numerics.js +2 -2
  229. package/dist/optim/optim.d.ts +32 -8
  230. package/dist/optim/optim.js +8 -4
  231. package/dist/random/beta.d.ts +8 -0
  232. package/dist/random/beta.js +8 -0
  233. package/dist/random/binomial.d.ts +16 -0
  234. package/dist/random/binomial.js +16 -0
  235. package/dist/random/continuous.d.ts +51 -0
  236. package/dist/random/continuous.js +51 -0
  237. package/dist/random/extra.d.ts +66 -6
  238. package/dist/random/extra.js +66 -6
  239. package/dist/random/gamma.d.ts +33 -0
  240. package/dist/random/gamma.js +33 -0
  241. package/dist/random/hyper.d.ts +8 -0
  242. package/dist/random/hyper.js +8 -0
  243. package/dist/random/poisson.d.ts +25 -0
  244. package/dist/random/poisson.js +25 -0
  245. package/dist/random/r2dtable.d.ts +2 -0
  246. package/dist/random/r2dtable.js +2 -0
  247. package/dist/random/rank.d.ts +16 -0
  248. package/dist/random/rank.js +16 -0
  249. package/dist/random/rng.d.ts +49 -6
  250. package/dist/random/rng.js +29 -2
  251. package/dist/random/sample.d.ts +10 -2
  252. package/dist/random/sample.js +5 -1
  253. package/dist/random/streams.d.ts +13 -0
  254. package/dist/random/streams.js +13 -0
  255. package/dist/rstats.js +14 -14
  256. package/dist/special/besselIK.d.ts +11 -3
  257. package/dist/special/besselIK.js +6 -2
  258. package/dist/special/besselJY.d.ts +6 -2
  259. package/dist/special/besselJY.js +6 -2
  260. package/dist/special/beta.d.ts +16 -2
  261. package/dist/special/beta.js +16 -2
  262. package/dist/special/choose.d.ts +13 -5
  263. package/dist/special/choose.js +13 -5
  264. package/dist/special/erf.d.ts +8 -3
  265. package/dist/special/erf.js +8 -3
  266. package/dist/special/extra.d.ts +30 -10
  267. package/dist/special/extra.js +25 -9
  268. package/dist/special/gamma.d.ts +18 -2
  269. package/dist/special/gamma.js +18 -2
  270. package/dist/special/log1p.d.ts +16 -7
  271. package/dist/special/log1p.js +16 -7
  272. package/dist/special/psigamma.d.ts +9 -3
  273. package/dist/special/psigamma.js +9 -3
  274. package/dist/special/rCompatible.d.ts +5 -1
  275. package/dist/special.js +2 -2
  276. package/dist/tests.js +12 -13
  277. package/llms.txt +14 -0
  278. package/package.json +1 -1
  279. package/dist/chunks/chunk-AECGWZHD.js +0 -2
  280. package/dist/chunks/chunk-XWTZ4RTR.js +0 -2
@@ -14,6 +14,14 @@ export declare function qf1(p: number, m: number, n: number, lowerTail: boolean,
14
14
  * @param df2 - Denominator degrees of freedom.
15
15
  * @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
16
16
  * @returns The density (or log density).
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * df(1, 3, 10); // 0.40412281148856277
21
+ * df(1, 3, 10, { log: true }); // -0.9060364583831545
22
+ * ```
23
+ *
24
+ * @category Distributions
17
25
  */
18
26
  export declare function df<T extends Vectorizable>(x: T, df1: number, df2: number, options?: DensityOptions & NoncentralOption): VectorResult<T>;
19
27
  /**
@@ -31,6 +39,8 @@ export declare function df<T extends Vectorizable>(x: T, df1: number, df2: numbe
31
39
  * ```ts
32
40
  * pf(4.1, 2, 20, { lowerTail: false }); // 0.03219651558603902
33
41
  * ```
42
+ *
43
+ * @category Distributions
34
44
  */
35
45
  export declare function pf<T extends Vectorizable>(q: T, df1: number, df2: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
36
46
  /**
@@ -43,5 +53,13 @@ export declare function pf<T extends Vectorizable>(q: T, df1: number, df2: numbe
43
53
  * @param df2 - Denominator degrees of freedom.
44
54
  * @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
45
55
  * @returns The quantile(s).
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * qf(0.95, 3, 10); // 3.708264819046843
60
+ * qf(0.05, 2, 20, { lowerTail: false }); // 3.4928284767356335
61
+ * ```
62
+ *
63
+ * @category Distributions
46
64
  */
47
65
  export declare function qf<T extends Vectorizable>(p: T, df1: number, df2: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
@@ -166,6 +166,14 @@ export function qf1(p, m, n, lowerTail, logP) {
166
166
  * @param df2 - Denominator degrees of freedom.
167
167
  * @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
168
168
  * @returns The density (or log density).
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * df(1, 3, 10); // 0.40412281148856277
173
+ * df(1, 3, 10, { log: true }); // -0.9060364583831545
174
+ * ```
175
+ *
176
+ * @category Distributions
169
177
  */
170
178
  export function df(x, df1, df2, options = {}) {
171
179
  const { log = false, ncp } = options;
@@ -188,6 +196,8 @@ export function df(x, df1, df2, options = {}) {
188
196
  * ```ts
189
197
  * pf(4.1, 2, 20, { lowerTail: false }); // 0.03219651558603902
190
198
  * ```
199
+ *
200
+ * @category Distributions
191
201
  */
192
202
  export function pf(q, df1, df2, options = {}) {
193
203
  const { lowerTail = true, logP = false, ncp } = options;
@@ -205,6 +215,14 @@ export function pf(q, df1, df2, options = {}) {
205
215
  * @param df2 - Denominator degrees of freedom.
206
216
  * @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
207
217
  * @returns The quantile(s).
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * qf(0.95, 3, 10); // 3.708264819046843
222
+ * qf(0.05, 2, 20, { lowerTail: false }); // 3.4928284767356335
223
+ * ```
224
+ *
225
+ * @category Distributions
208
226
  */
209
227
  export function qf(p, df1, df2, options = {}) {
210
228
  const { lowerTail = true, logP = false, ncp } = options;
@@ -3,6 +3,8 @@ import { type DensityOptions, type TailOptions } from "../internal/dpq.js";
3
3
  /**
4
4
  * Parameters of the gamma distribution. Give either `rate` or `scale`; if both are given,
5
5
  * `scale` must equal `1 / rate`.
6
+ *
7
+ * @category Distributions
6
8
  */
7
9
  export interface GammaParams {
8
10
  /** Rate (`rate = 1 / scale`). Default `1`. */
@@ -28,6 +30,14 @@ export declare function qgamma1(p: number, shape: number, scale: number, lowerTa
28
30
  * @param shape - Shape parameter.
29
31
  * @param options - `rate` or `scale` (see {@link GammaParams}) and `log` (see {@link DensityOptions}).
30
32
  * @returns The density (or log density).
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * dgamma(1, 2); // 0.36787944117144233
37
+ * dgamma(1, 2, { rate: 3 }); // 0.44808361531077556
38
+ * ```
39
+ *
40
+ * @category Distributions
31
41
  */
32
42
  export declare function dgamma<T extends Vectorizable>(x: T, shape: number, options?: GammaParams & DensityOptions): VectorResult<T>;
33
43
  /**
@@ -46,6 +56,8 @@ export declare function dgamma<T extends Vectorizable>(x: T, shape: number, opti
46
56
  * pgamma(2, 2, { rate: 3 }); // 0.9826487347633355
47
57
  * pgamma(2, 2, { scale: 3 }); // 0.14430480161234657
48
58
  * ```
59
+ *
60
+ * @category Distributions
49
61
  */
50
62
  export declare function pgamma<T extends Vectorizable>(q: T, shape: number, options?: GammaParams & TailOptions): VectorResult<T>;
51
63
  /**
@@ -57,5 +69,13 @@ export declare function pgamma<T extends Vectorizable>(q: T, shape: number, opti
57
69
  * @param shape - Shape parameter.
58
70
  * @param options - `rate` or `scale` (see {@link GammaParams}), `lowerTail` and `logP` (see {@link TailOptions}).
59
71
  * @returns The quantile(s).
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * qgamma(0.5, 2); // 1.6783469900166605
76
+ * qgamma([0.05, 0.95], 2, { rate: 3 }); // [0.11845383689955402, 1.5812881727968588]
77
+ * ```
78
+ *
79
+ * @category Distributions
60
80
  */
61
81
  export declare function qgamma<T extends Vectorizable>(p: T, shape: number, options?: GammaParams & TailOptions): VectorResult<T>;
@@ -143,6 +143,14 @@ export function qgamma1(p, shape, scale, lowerTail, logP) {
143
143
  * @param shape - Shape parameter.
144
144
  * @param options - `rate` or `scale` (see {@link GammaParams}) and `log` (see {@link DensityOptions}).
145
145
  * @returns The density (or log density).
146
+ *
147
+ * @example
148
+ * ```ts
149
+ * dgamma(1, 2); // 0.36787944117144233
150
+ * dgamma(1, 2, { rate: 3 }); // 0.44808361531077556
151
+ * ```
152
+ *
153
+ * @category Distributions
146
154
  */
147
155
  export function dgamma(x, shape, options = {}) {
148
156
  const scale = gammaScale(options);
@@ -165,6 +173,8 @@ export function dgamma(x, shape, options = {}) {
165
173
  * pgamma(2, 2, { rate: 3 }); // 0.9826487347633355
166
174
  * pgamma(2, 2, { scale: 3 }); // 0.14430480161234657
167
175
  * ```
176
+ *
177
+ * @category Distributions
168
178
  */
169
179
  export function pgamma(q, shape, options = {}) {
170
180
  const scale = gammaScale(options);
@@ -180,6 +190,14 @@ export function pgamma(q, shape, options = {}) {
180
190
  * @param shape - Shape parameter.
181
191
  * @param options - `rate` or `scale` (see {@link GammaParams}), `lowerTail` and `logP` (see {@link TailOptions}).
182
192
  * @returns The quantile(s).
193
+ *
194
+ * @example
195
+ * ```ts
196
+ * qgamma(0.5, 2); // 1.6783469900166605
197
+ * qgamma([0.05, 0.95], 2, { rate: 3 }); // [0.11845383689955402, 1.5812881727968588]
198
+ * ```
199
+ *
200
+ * @category Distributions
183
201
  */
184
202
  export function qgamma(p, shape, options = {}) {
185
203
  const scale = gammaScale(options);
@@ -16,6 +16,14 @@ export declare function qgeom1(p: number, prob: number, lowerTail: boolean, logP
16
16
  * @param prob - Probability of success on each trial.
17
17
  * @param options - `log` (see {@link DensityOptions}).
18
18
  * @returns The probability (or log probability).
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * dgeom(2, 0.3); // 0.147
23
+ * dgeom([0, 1, 2], 0.5); // [0.5, 0.25, 0.125]
24
+ * ```
25
+ *
26
+ * @category Distributions
19
27
  */
20
28
  export declare function dgeom<T extends Vectorizable>(x: T, prob: number, options?: DensityOptions): VectorResult<T>;
21
29
  /**
@@ -25,6 +33,14 @@ export declare function dgeom<T extends Vectorizable>(x: T, prob: number, option
25
33
  * @param prob - Probability of success on each trial.
26
34
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
27
35
  * @returns The probability (or log probability).
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * pgeom(2, 0.3); // 0.657
40
+ * pgeom(2, 0.3, { lowerTail: false }); // 0.343
41
+ * ```
42
+ *
43
+ * @category Distributions
28
44
  */
29
45
  export declare function pgeom<T extends Vectorizable>(q: T, prob: number, options?: TailOptions): VectorResult<T>;
30
46
  /**
@@ -34,5 +50,13 @@ export declare function pgeom<T extends Vectorizable>(q: T, prob: number, option
34
50
  * @param prob - Probability of success on each trial.
35
51
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
36
52
  * @returns The quantile(s).
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * qgeom(0.5, 0.3); // 1
57
+ * qgeom([0.1, 0.9], 0.3); // [0, 6]
58
+ * ```
59
+ *
60
+ * @category Distributions
37
61
  */
38
62
  export declare function qgeom<T extends Vectorizable>(p: T, prob: number, options?: TailOptions): VectorResult<T>;
@@ -85,6 +85,14 @@ export function qgeom1(p, prob, lowerTail, logP) {
85
85
  * @param prob - Probability of success on each trial.
86
86
  * @param options - `log` (see {@link DensityOptions}).
87
87
  * @returns The probability (or log probability).
88
+ *
89
+ * @example
90
+ * ```ts
91
+ * dgeom(2, 0.3); // 0.147
92
+ * dgeom([0, 1, 2], 0.5); // [0.5, 0.25, 0.125]
93
+ * ```
94
+ *
95
+ * @category Distributions
88
96
  */
89
97
  export function dgeom(x, prob, options = {}) {
90
98
  const log = options.log ?? false;
@@ -97,6 +105,14 @@ export function dgeom(x, prob, options = {}) {
97
105
  * @param prob - Probability of success on each trial.
98
106
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
99
107
  * @returns The probability (or log probability).
108
+ *
109
+ * @example
110
+ * ```ts
111
+ * pgeom(2, 0.3); // 0.657
112
+ * pgeom(2, 0.3, { lowerTail: false }); // 0.343
113
+ * ```
114
+ *
115
+ * @category Distributions
100
116
  */
101
117
  export function pgeom(q, prob, options = {}) {
102
118
  const { lowerTail = true, logP = false } = options;
@@ -109,6 +125,14 @@ export function pgeom(q, prob, options = {}) {
109
125
  * @param prob - Probability of success on each trial.
110
126
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
111
127
  * @returns The quantile(s).
128
+ *
129
+ * @example
130
+ * ```ts
131
+ * qgeom(0.5, 0.3); // 1
132
+ * qgeom([0.1, 0.9], 0.3); // [0, 6]
133
+ * ```
134
+ *
135
+ * @category Distributions
112
136
  */
113
137
  export function qgeom(p, prob, options = {}) {
114
138
  const { lowerTail = true, logP = false } = options;
@@ -12,6 +12,14 @@ export declare function qhyper1(p: number, m: number, n: number, k: number, lowe
12
12
  * @param k - Number of balls drawn.
13
13
  * @param options - `log` (see {@link DensityOptions}).
14
14
  * @returns The probability (or log probability).
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * dhyper(2, 10, 7, 8); // 0.012957630604689432
19
+ * dhyper([0, 1], 10, 7, 8); // [0, 0.00041135335252982303]
20
+ * ```
21
+ *
22
+ * @category Distributions
15
23
  */
16
24
  export declare function dhyper<T extends Vectorizable>(x: T, m: number, n: number, k: number, options?: DensityOptions): VectorResult<T>;
17
25
  /**
@@ -23,6 +31,14 @@ export declare function dhyper<T extends Vectorizable>(x: T, m: number, n: numbe
23
31
  * @param k - Number of balls drawn.
24
32
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
25
33
  * @returns The probability (or log probability).
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * phyper(2, 10, 7, 8); // 0.013368983957219256
38
+ * phyper(5, 10, 7, 8, { lowerTail: false }); // 0.21781160016454126
39
+ * ```
40
+ *
41
+ * @category Distributions
26
42
  */
27
43
  export declare function phyper<T extends Vectorizable>(q: T, m: number, n: number, k: number, options?: TailOptions): VectorResult<T>;
28
44
  /**
@@ -34,5 +50,13 @@ export declare function phyper<T extends Vectorizable>(q: T, m: number, n: numbe
34
50
  * @param k - Number of balls drawn.
35
51
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
36
52
  * @returns The quantile(s).
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * qhyper(0.5, 10, 7, 8); // 5
57
+ * qhyper([0.05, 0.95], 10, 7, 8); // [3, 6]
58
+ * ```
59
+ *
60
+ * @category Distributions
37
61
  */
38
62
  export declare function qhyper<T extends Vectorizable>(p: T, m: number, n: number, k: number, options?: TailOptions): VectorResult<T>;
@@ -199,6 +199,14 @@ export function qhyper1(p, m, n, k, lowerTail, logP) {
199
199
  * @param k - Number of balls drawn.
200
200
  * @param options - `log` (see {@link DensityOptions}).
201
201
  * @returns The probability (or log probability).
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * dhyper(2, 10, 7, 8); // 0.012957630604689432
206
+ * dhyper([0, 1], 10, 7, 8); // [0, 0.00041135335252982303]
207
+ * ```
208
+ *
209
+ * @category Distributions
202
210
  */
203
211
  export function dhyper(x, m, n, k, options = {}) {
204
212
  const log = options.log ?? false;
@@ -213,6 +221,14 @@ export function dhyper(x, m, n, k, options = {}) {
213
221
  * @param k - Number of balls drawn.
214
222
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
215
223
  * @returns The probability (or log probability).
224
+ *
225
+ * @example
226
+ * ```ts
227
+ * phyper(2, 10, 7, 8); // 0.013368983957219256
228
+ * phyper(5, 10, 7, 8, { lowerTail: false }); // 0.21781160016454126
229
+ * ```
230
+ *
231
+ * @category Distributions
216
232
  */
217
233
  export function phyper(q, m, n, k, options = {}) {
218
234
  const { lowerTail = true, logP = false } = options;
@@ -227,6 +243,14 @@ export function phyper(q, m, n, k, options = {}) {
227
243
  * @param k - Number of balls drawn.
228
244
  * @param options - `lowerTail` and `logP` (see {@link TailOptions}).
229
245
  * @returns The quantile(s).
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * qhyper(0.5, 10, 7, 8); // 5
250
+ * qhyper([0.05, 0.95], 10, 7, 8); // [3, 6]
251
+ * ```
252
+ *
253
+ * @category Distributions
230
254
  */
231
255
  export function qhyper(p, m, n, k, options = {}) {
232
256
  const { lowerTail = true, logP = false } = options;
@@ -1,6 +1,10 @@
1
1
  import { type Vectorizable, type VectorResult } from "../internal/vectorize.js";
2
2
  import { type DensityOptions, type TailOptions } from "../internal/dpq.js";
3
- /** Scale parameter of the inverse gamma distribution. */
3
+ /**
4
+ * Scale parameter of the inverse gamma distribution.
5
+ *
6
+ * @category Distributions
7
+ */
4
8
  export interface InvgammaParams {
5
9
  /** Scale (the rate of the gamma distribution of 1/X). Default `1`. */
6
10
  beta?: number;
@@ -9,21 +13,45 @@ export declare function dinvgamma1(x: number, alpha: number, beta: number, log:
9
13
  export declare function pinvgamma1(q: number, alpha: number, beta: number, lowerTail: boolean, logP: boolean): number;
10
14
  export declare function qinvgamma1(p: number, alpha: number, beta: number, lowerTail: boolean, logP: boolean): number;
11
15
  /**
12
- * Density of the inverse gamma distribution. Equivalent to `extraDistr::dinvgamma(x, alpha, beta = 1, log = FALSE)`:
16
+ * Density of the inverse gamma distribution. Equivalent to `extraDistr::dinvgamma(x, alpha, beta = 1, log = FALSE)` in R.
13
17
  * f(x) = beta^alpha x^(-alpha-1) exp(-beta/x) / Gamma(alpha).
14
18
  *
15
19
  * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
16
20
  * @param alpha - Shape parameter.
17
21
  * @param options - `beta` (see {@link InvgammaParams}) and `log` (see {@link DensityOptions}).
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * dinvgamma(1, 3); // 0.18393972058572117
26
+ * dinvgamma(0.5, 3, { beta: 2 }); // 1.1722008888789877
27
+ * ```
28
+ *
29
+ * @category Distributions
18
30
  */
19
31
  export declare function dinvgamma<T extends Vectorizable>(x: T, alpha: number, options?: InvgammaParams & DensityOptions): VectorResult<T>;
20
32
  /**
21
33
  * Distribution function of the inverse gamma distribution. Equivalent to
22
- * `extraDistr::pinvgamma(q, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)`.
34
+ * `extraDistr::pinvgamma(q, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)` in R.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * pinvgamma(1, 3); // 0.9196986029286058
39
+ * pinvgamma(0.5, 3, { beta: 2 }); // 0.23810330555354436
40
+ * ```
41
+ *
42
+ * @category Distributions
23
43
  */
24
44
  export declare function pinvgamma<T extends Vectorizable>(q: T, alpha: number, options?: InvgammaParams & TailOptions): VectorResult<T>;
25
45
  /**
26
46
  * Quantile function of the inverse gamma distribution. Equivalent to
27
- * `extraDistr::qinvgamma(p, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)`.
47
+ * `extraDistr::qinvgamma(p, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)` in R.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * qinvgamma(0.5, 3); // 0.3739631431901122
52
+ * qinvgamma(0.95, 3, { beta: 2 }); // 2.445910382133402
53
+ * ```
54
+ *
55
+ * @category Distributions
28
56
  */
29
57
  export declare function qinvgamma<T extends Vectorizable>(p: T, alpha: number, options?: InvgammaParams & TailOptions): VectorResult<T>;
@@ -56,12 +56,20 @@ export function qinvgamma1(p, alpha, beta, lowerTail, logP) {
56
56
  return beta / qgamma1(p, alpha, 1, !lowerTail, logP);
57
57
  }
58
58
  /**
59
- * Density of the inverse gamma distribution. Equivalent to `extraDistr::dinvgamma(x, alpha, beta = 1, log = FALSE)`:
59
+ * Density of the inverse gamma distribution. Equivalent to `extraDistr::dinvgamma(x, alpha, beta = 1, log = FALSE)` in R.
60
60
  * f(x) = beta^alpha x^(-alpha-1) exp(-beta/x) / Gamma(alpha).
61
61
  *
62
62
  * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
63
63
  * @param alpha - Shape parameter.
64
64
  * @param options - `beta` (see {@link InvgammaParams}) and `log` (see {@link DensityOptions}).
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * dinvgamma(1, 3); // 0.18393972058572117
69
+ * dinvgamma(0.5, 3, { beta: 2 }); // 1.1722008888789877
70
+ * ```
71
+ *
72
+ * @category Distributions
65
73
  */
66
74
  export function dinvgamma(x, alpha, options = {}) {
67
75
  const { beta = 1, log = false } = options;
@@ -69,7 +77,15 @@ export function dinvgamma(x, alpha, options = {}) {
69
77
  }
70
78
  /**
71
79
  * Distribution function of the inverse gamma distribution. Equivalent to
72
- * `extraDistr::pinvgamma(q, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)`.
80
+ * `extraDistr::pinvgamma(q, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)` in R.
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * pinvgamma(1, 3); // 0.9196986029286058
85
+ * pinvgamma(0.5, 3, { beta: 2 }); // 0.23810330555354436
86
+ * ```
87
+ *
88
+ * @category Distributions
73
89
  */
74
90
  export function pinvgamma(q, alpha, options = {}) {
75
91
  const { beta = 1, lowerTail = true, logP = false } = options;
@@ -77,7 +93,15 @@ export function pinvgamma(q, alpha, options = {}) {
77
93
  }
78
94
  /**
79
95
  * Quantile function of the inverse gamma distribution. Equivalent to
80
- * `extraDistr::qinvgamma(p, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)`.
96
+ * `extraDistr::qinvgamma(p, alpha, beta = 1, lower.tail = TRUE, log.p = FALSE)` in R.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * qinvgamma(0.5, 3); // 0.3739631431901122
101
+ * qinvgamma(0.95, 3, { beta: 2 }); // 2.445910382133402
102
+ * ```
103
+ *
104
+ * @category Distributions
81
105
  */
82
106
  export function qinvgamma(p, alpha, options = {}) {
83
107
  const { beta = 1, lowerTail = true, logP = false } = options;
@@ -4,14 +4,42 @@ export declare function dkumar1(x: number, a: number, b: number, log: boolean):
4
4
  export declare function pkumar1(q: number, a: number, b: number, lowerTail: boolean, logP: boolean): number;
5
5
  export declare function qkumar1(p: number, a: number, b: number, lowerTail: boolean, logP: boolean): number;
6
6
  /**
7
- * Density of the Kumaraswamy distribution. Equivalent to `extraDistr::dkumar(x, a, b, log = FALSE)`.
7
+ * Density of the Kumaraswamy distribution. Equivalent to `extraDistr::dkumar(x, a, b, log = FALSE)` in R.
8
8
  *
9
9
  * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
10
10
  * @param a - First shape parameter.
11
11
  * @param b - Second shape parameter.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * dkumar(0.5, 2, 3); // 1.6875
16
+ * dkumar([0.25, 0.75], 2, 3); // [1.318359375, 0.861328125]
17
+ * ```
18
+ *
19
+ * @category Distributions
12
20
  */
13
21
  export declare function dkumar<T extends Vectorizable>(x: T, a: number, b: number, options?: DensityOptions): VectorResult<T>;
14
- /** Distribution function of the Kumaraswamy distribution. Equivalent to `extraDistr::pkumar(q, a, b, lower.tail, log.p)`. */
22
+ /**
23
+ * Distribution function of the Kumaraswamy distribution. Equivalent to `extraDistr::pkumar(q, a, b, lower.tail, log.p)` in R.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * pkumar(0.5, 2, 3); // 0.578125
28
+ * pkumar(0.5, 2, 3, { lowerTail: false }); // 0.421875
29
+ * ```
30
+ *
31
+ * @category Distributions
32
+ */
15
33
  export declare function pkumar<T extends Vectorizable>(q: T, a: number, b: number, options?: TailOptions): VectorResult<T>;
16
- /** Quantile function of the Kumaraswamy distribution. Equivalent to `extraDistr::qkumar(p, a, b, lower.tail, log.p)`. */
34
+ /**
35
+ * Quantile function of the Kumaraswamy distribution. Equivalent to `extraDistr::qkumar(p, a, b, lower.tail, log.p)` in R.
36
+ *
37
+ * @example
38
+ * ```ts
39
+ * qkumar(0.5, 2, 3); // 0.4542020189474066
40
+ * qkumar([0.1, 0.9], 2, 3); // [0.18577032969333462, 0.7320116915997463]
41
+ * ```
42
+ *
43
+ * @category Distributions
44
+ */
17
45
  export declare function qkumar<T extends Vectorizable>(p: T, a: number, b: number, options?: TailOptions): VectorResult<T>;
@@ -74,22 +74,50 @@ export function qkumar1(p, a, b, lowerTail, logP) {
74
74
  return Math.pow(-Math.expm1(lu / b), 1 / a);
75
75
  }
76
76
  /**
77
- * Density of the Kumaraswamy distribution. Equivalent to `extraDistr::dkumar(x, a, b, log = FALSE)`.
77
+ * Density of the Kumaraswamy distribution. Equivalent to `extraDistr::dkumar(x, a, b, log = FALSE)` in R.
78
78
  *
79
79
  * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
80
80
  * @param a - First shape parameter.
81
81
  * @param b - Second shape parameter.
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * dkumar(0.5, 2, 3); // 1.6875
86
+ * dkumar([0.25, 0.75], 2, 3); // [1.318359375, 0.861328125]
87
+ * ```
88
+ *
89
+ * @category Distributions
82
90
  */
83
91
  export function dkumar(x, a, b, options = {}) {
84
92
  const { log = false } = options;
85
93
  return vectorize(x, (v) => dkumar1(v, a, b, log));
86
94
  }
87
- /** Distribution function of the Kumaraswamy distribution. Equivalent to `extraDistr::pkumar(q, a, b, lower.tail, log.p)`. */
95
+ /**
96
+ * Distribution function of the Kumaraswamy distribution. Equivalent to `extraDistr::pkumar(q, a, b, lower.tail, log.p)` in R.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * pkumar(0.5, 2, 3); // 0.578125
101
+ * pkumar(0.5, 2, 3, { lowerTail: false }); // 0.421875
102
+ * ```
103
+ *
104
+ * @category Distributions
105
+ */
88
106
  export function pkumar(q, a, b, options = {}) {
89
107
  const { lowerTail = true, logP = false } = options;
90
108
  return vectorize(q, (v) => pkumar1(v, a, b, lowerTail, logP));
91
109
  }
92
- /** Quantile function of the Kumaraswamy distribution. Equivalent to `extraDistr::qkumar(p, a, b, lower.tail, log.p)`. */
110
+ /**
111
+ * Quantile function of the Kumaraswamy distribution. Equivalent to `extraDistr::qkumar(p, a, b, lower.tail, log.p)` in R.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * qkumar(0.5, 2, 3); // 0.4542020189474066
116
+ * qkumar([0.1, 0.9], 2, 3); // [0.18577032969333462, 0.7320116915997463]
117
+ * ```
118
+ *
119
+ * @category Distributions
120
+ */
93
121
  export function qkumar(p, a, b, options = {}) {
94
122
  const { lowerTail = true, logP = false } = options;
95
123
  return vectorize(p, (v) => qkumar1(v, a, b, lowerTail, logP));
@@ -1,6 +1,10 @@
1
1
  import { type Vectorizable, type VectorResult } from "../internal/vectorize.js";
2
2
  import { type DensityOptions, type TailOptions } from "../internal/dpq.js";
3
- /** Location and scale of the Laplace distribution. */
3
+ /**
4
+ * Location and scale of the Laplace distribution.
5
+ *
6
+ * @category Distributions
7
+ */
4
8
  export interface LaplaceParams {
5
9
  /** Location. Default `0`. */
6
10
  mu?: number;
@@ -11,13 +15,41 @@ export declare function dlaplace1(x: number, mu: number, sigma: number, log: boo
11
15
  export declare function plaplace1(q: number, mu: number, sigma: number, lowerTail: boolean, logP: boolean): number;
12
16
  export declare function qlaplace1(p: number, mu: number, sigma: number, lowerTail: boolean, logP: boolean): number;
13
17
  /**
14
- * Density of the Laplace distribution. Equivalent to `extraDistr::dlaplace(x, mu = 0, sigma = 1, log = FALSE)`.
18
+ * Density of the Laplace distribution. Equivalent to `extraDistr::dlaplace(x, mu = 0, sigma = 1, log = FALSE)` in R.
15
19
  *
16
20
  * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
17
21
  * @param options - `mu` and `sigma` (see {@link LaplaceParams}) and `log` (see {@link DensityOptions}).
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * dlaplace(0); // 0.5
26
+ * dlaplace(1, { mu: 1, sigma: 2 }); // 0.25
27
+ * ```
28
+ *
29
+ * @category Distributions
18
30
  */
19
31
  export declare function dlaplace<T extends Vectorizable>(x: T, options?: LaplaceParams & DensityOptions): VectorResult<T>;
20
- /** Distribution function of the Laplace distribution. Equivalent to `extraDistr::plaplace(q, mu = 0, sigma = 1, lower.tail, log.p)`. */
32
+ /**
33
+ * Distribution function of the Laplace distribution. Equivalent to `extraDistr::plaplace(q, mu = 0, sigma = 1, lower.tail, log.p)` in R.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * plaplace(1); // 0.8160602794142788
38
+ * plaplace(-1, { mu: 1, sigma: 2 }); // 0.18393972058572117
39
+ * ```
40
+ *
41
+ * @category Distributions
42
+ */
21
43
  export declare function plaplace<T extends Vectorizable>(q: T, options?: LaplaceParams & TailOptions): VectorResult<T>;
22
- /** Quantile function of the Laplace distribution. Equivalent to `extraDistr::qlaplace(p, mu = 0, sigma = 1, lower.tail, log.p)`. */
44
+ /**
45
+ * Quantile function of the Laplace distribution. Equivalent to `extraDistr::qlaplace(p, mu = 0, sigma = 1, lower.tail, log.p)` in R.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * qlaplace(0.75); // 0.6931471805599453
50
+ * qlaplace(0.9, { mu: 1, sigma: 2 }); // 4.218875824868201
51
+ * ```
52
+ *
53
+ * @category Distributions
54
+ */
23
55
  export declare function qlaplace<T extends Vectorizable>(p: T, options?: LaplaceParams & TailOptions): VectorResult<T>;
@@ -48,21 +48,49 @@ export function qlaplace1(p, mu, sigma, lowerTail, logP) {
48
48
  return locationScale(mu, sigma, lower ? l : -l);
49
49
  }
50
50
  /**
51
- * Density of the Laplace distribution. Equivalent to `extraDistr::dlaplace(x, mu = 0, sigma = 1, log = FALSE)`.
51
+ * Density of the Laplace distribution. Equivalent to `extraDistr::dlaplace(x, mu = 0, sigma = 1, log = FALSE)` in R.
52
52
  *
53
53
  * @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
54
54
  * @param options - `mu` and `sigma` (see {@link LaplaceParams}) and `log` (see {@link DensityOptions}).
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * dlaplace(0); // 0.5
59
+ * dlaplace(1, { mu: 1, sigma: 2 }); // 0.25
60
+ * ```
61
+ *
62
+ * @category Distributions
55
63
  */
56
64
  export function dlaplace(x, options = {}) {
57
65
  const { mu = 0, sigma = 1, log = false } = options;
58
66
  return vectorize(x, (v) => dlaplace1(v, mu, sigma, log));
59
67
  }
60
- /** Distribution function of the Laplace distribution. Equivalent to `extraDistr::plaplace(q, mu = 0, sigma = 1, lower.tail, log.p)`. */
68
+ /**
69
+ * Distribution function of the Laplace distribution. Equivalent to `extraDistr::plaplace(q, mu = 0, sigma = 1, lower.tail, log.p)` in R.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * plaplace(1); // 0.8160602794142788
74
+ * plaplace(-1, { mu: 1, sigma: 2 }); // 0.18393972058572117
75
+ * ```
76
+ *
77
+ * @category Distributions
78
+ */
61
79
  export function plaplace(q, options = {}) {
62
80
  const { mu = 0, sigma = 1, lowerTail = true, logP = false } = options;
63
81
  return vectorize(q, (v) => plaplace1(v, mu, sigma, lowerTail, logP));
64
82
  }
65
- /** Quantile function of the Laplace distribution. Equivalent to `extraDistr::qlaplace(p, mu = 0, sigma = 1, lower.tail, log.p)`. */
83
+ /**
84
+ * Quantile function of the Laplace distribution. Equivalent to `extraDistr::qlaplace(p, mu = 0, sigma = 1, lower.tail, log.p)` in R.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * qlaplace(0.75); // 0.6931471805599453
89
+ * qlaplace(0.9, { mu: 1, sigma: 2 }); // 4.218875824868201
90
+ * ```
91
+ *
92
+ * @category Distributions
93
+ */
66
94
  export function qlaplace(p, options = {}) {
67
95
  const { mu = 0, sigma = 1, lowerTail = true, logP = false } = options;
68
96
  return vectorize(p, (v) => qlaplace1(v, mu, sigma, lowerTail, logP));