@numero-uno-jpn/rstats 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/README.ja.md +44 -13
- package/README.md +43 -11
- package/dist/chunks/{chunk-VJ4BDBMU.js → chunk-3VMBBQLV.js} +2 -2
- package/dist/chunks/chunk-4OKAZJJG.js +3 -0
- package/dist/chunks/{chunk-EZAFN5CD.js → chunk-6BH65HGN.js} +1 -1
- package/dist/chunks/chunk-ATC4F4BX.js +2 -0
- package/dist/chunks/{chunk-JWBO5WVN.js → chunk-EDH53DXN.js} +2 -2
- package/dist/chunks/{chunk-Y5CNQ266.js → chunk-EZ2KD5NA.js} +2 -2
- package/dist/chunks/{chunk-Y5PYRAYP.js → chunk-GSPOO2G3.js} +2 -2
- package/dist/chunks/{chunk-F5EDJFEO.js → chunk-K7AZ65H7.js} +2 -2
- package/dist/chunks/{chunk-YSWGDOWK.js → chunk-LEIH4U5X.js} +2 -2
- package/dist/chunks/{chunk-EZWBRCJL.js → chunk-OX3SBG5X.js} +1 -1
- package/dist/chunks/chunk-SGZQDJRR.js +2 -0
- package/dist/chunks/{chunk-C5XTWMGB.js → chunk-UH2N3ZQW.js} +1 -1
- package/dist/chunks/chunk-UV2MZYDQ.js +2 -0
- package/dist/chunks/{chunk-TOGXTCZO.js → chunk-VQHEOBTM.js} +2 -2
- package/dist/chunks/chunk-WJQZZYOI.js +2 -0
- package/dist/chunks/chunk-WKEFHOFR.js +2 -0
- package/dist/chunks/{chunk-CGBNKHNZ.js → chunk-WXC25OPJ.js} +2 -2
- package/dist/chunks/{chunk-5WDJPHYY.js → chunk-XJQKSR52.js} +1 -1
- package/dist/data/grouping.d.ts +39 -15
- package/dist/data/grouping.js +21 -22
- package/dist/descriptive/basic.d.ts +130 -17
- package/dist/descriptive/basic.js +115 -14
- package/dist/descriptive/cov.d.ts +22 -12
- package/dist/descriptive/dataFrames.d.ts +39 -11
- package/dist/descriptive/dataFrames.js +14 -6
- package/dist/descriptive/factanal.d.ts +26 -6
- package/dist/descriptive/factanal.js +7 -3
- package/dist/descriptive/hist.d.ts +27 -6
- package/dist/descriptive/hist.js +9 -3
- package/dist/descriptive/missing.d.ts +13 -6
- package/dist/descriptive/missing.js +4 -2
- package/dist/descriptive/moments.d.ts +91 -13
- package/dist/descriptive/moments.js +66 -9
- package/dist/descriptive/omega.d.ts +28 -6
- package/dist/descriptive/omega.js +16 -4
- package/dist/descriptive/pivot.d.ts +22 -6
- package/dist/descriptive/pivot.js +7 -3
- package/dist/descriptive/quantile.d.ts +33 -5
- package/dist/descriptive/quantile.js +20 -2
- package/dist/descriptive/rank.d.ts +12 -2
- package/dist/descriptive/rank.js +2 -0
- package/dist/descriptive/table.d.ts +55 -7
- package/dist/descriptive/table.js +38 -4
- package/dist/descriptive.js +2 -2
- package/dist/distributions/arcsine.d.ts +40 -5
- package/dist/distributions/arcsine.js +35 -4
- package/dist/distributions/beta.d.ts +12 -0
- package/dist/distributions/beta.js +12 -0
- package/dist/distributions/binomial.d.ts +18 -0
- package/dist/distributions/binomial.js +18 -0
- package/dist/distributions/bvnorm.d.ts +4 -1
- package/dist/distributions/bvnorm.js +4 -1
- package/dist/distributions/cauchy.d.ts +24 -0
- package/dist/distributions/cauchy.js +24 -0
- package/dist/distributions/chisq.d.ts +18 -0
- package/dist/distributions/chisq.js +18 -0
- package/dist/distributions/exponential.d.ts +29 -1
- package/dist/distributions/exponential.js +24 -0
- package/dist/distributions/f.d.ts +18 -0
- package/dist/distributions/f.js +18 -0
- package/dist/distributions/gamma.d.ts +20 -0
- package/dist/distributions/gamma.js +18 -0
- package/dist/distributions/geometric.d.ts +24 -0
- package/dist/distributions/geometric.js +24 -0
- package/dist/distributions/hypergeometric.d.ts +24 -0
- package/dist/distributions/hypergeometric.js +24 -0
- package/dist/distributions/invgamma.d.ts +32 -4
- package/dist/distributions/invgamma.js +27 -3
- package/dist/distributions/kumaraswamy.d.ts +31 -3
- package/dist/distributions/kumaraswamy.js +31 -3
- package/dist/distributions/laplace.d.ts +36 -4
- package/dist/distributions/laplace.js +31 -3
- package/dist/distributions/logistic.d.ts +29 -1
- package/dist/distributions/logistic.js +24 -0
- package/dist/distributions/lognormal.d.ts +29 -1
- package/dist/distributions/lognormal.js +24 -0
- package/dist/distributions/multinomial.d.ts +7 -1
- package/dist/distributions/multinomial.js +2 -0
- package/dist/distributions/negbinomial.d.ts +29 -1
- package/dist/distributions/negbinomial.js +24 -0
- package/dist/distributions/normal.d.ts +11 -1
- package/dist/distributions/normal.js +6 -0
- package/dist/distributions/pareto.d.ts +36 -4
- package/dist/distributions/pareto.js +31 -3
- package/dist/distributions/poisson.d.ts +18 -0
- package/dist/distributions/poisson.js +18 -0
- package/dist/distributions/signrank.d.ts +24 -0
- package/dist/distributions/signrank.js +24 -0
- package/dist/distributions/summary.d.ts +20 -2
- package/dist/distributions/summary.js +4 -0
- package/dist/distributions/t.d.ts +18 -0
- package/dist/distributions/t.js +18 -0
- package/dist/distributions/triangular.d.ts +36 -4
- package/dist/distributions/triangular.js +31 -3
- package/dist/distributions/tukey.d.ts +15 -1
- package/dist/distributions/tukey.js +10 -0
- package/dist/distributions/uniform.d.ts +29 -1
- package/dist/distributions/uniform.js +24 -0
- package/dist/distributions/weibull.d.ts +29 -1
- package/dist/distributions/weibull.js +24 -0
- package/dist/distributions/wilcox.d.ts +24 -0
- package/dist/distributions/wilcox.js +24 -0
- package/dist/distributions.js +2 -2
- package/dist/entries/descriptive.d.ts +1 -1
- package/dist/entries/mixed.d.ts +1 -0
- package/dist/entries/mixed.js +2 -0
- package/dist/entries/numerics.d.ts +1 -1
- package/dist/entries/tests.js +1 -1
- package/dist/htest/agreement.d.ts +61 -23
- package/dist/htest/agreement.js +19 -9
- package/dist/htest/ansariTest.d.ts +8 -2
- package/dist/htest/aov.d.ts +43 -10
- package/dist/htest/aov.js +17 -3
- package/dist/htest/binomTest.d.ts +12 -2
- package/dist/htest/binomTest.js +2 -0
- package/dist/htest/brunnerMunzelTest.d.ts +9 -3
- package/dist/htest/brunnerMunzelTest.js +4 -2
- package/dist/htest/chisqTest.d.ts +19 -3
- package/dist/htest/cor.d.ts +20 -4
- package/dist/htest/effectSize.d.ts +70 -12
- package/dist/htest/effectSize.js +40 -7
- package/dist/htest/fisherTest.d.ts +9 -1
- package/dist/htest/fisherTest.js +2 -0
- package/dist/htest/groups.d.ts +5 -1
- package/dist/htest/ksTest.d.ts +20 -3
- package/dist/htest/leveneTest.d.ts +15 -4
- package/dist/htest/leveneTest.js +5 -2
- package/dist/htest/mantelhaenTest.d.ts +25 -3
- package/dist/htest/mantelhaenTest.js +15 -1
- package/dist/htest/mcnemarTest.d.ts +14 -4
- package/dist/htest/mcnemarTest.js +4 -2
- package/dist/htest/multipleComparisons.d.ts +173 -29
- package/dist/htest/multipleComparisons.js +123 -19
- package/dist/htest/normalityTests.d.ts +56 -9
- package/dist/htest/normalityTests.js +40 -6
- package/dist/htest/onewayTest.d.ts +32 -3
- package/dist/htest/onewayTest.js +10 -0
- package/dist/htest/pAdjust.d.ts +9 -1
- package/dist/htest/pAdjust.js +2 -0
- package/dist/htest/pairwise.d.ts +50 -5
- package/dist/htest/pairwise.js +25 -0
- package/dist/htest/poissonTest.d.ts +12 -2
- package/dist/htest/poissonTest.js +2 -0
- package/dist/htest/polycor.d.ts +29 -10
- package/dist/htest/power.d.ts +60 -6
- package/dist/htest/power.js +6 -0
- package/dist/htest/propTest.d.ts +13 -2
- package/dist/htest/propTest.js +2 -0
- package/dist/htest/pwr.d.ts +286 -36
- package/dist/htest/pwr.js +116 -15
- package/dist/htest/rankTests.d.ts +80 -12
- package/dist/htest/rankTests.js +11 -2
- package/dist/htest/tTest.d.ts +13 -3
- package/dist/htest/testFormula.js +6 -3
- package/dist/htest/trendTests.d.ts +29 -8
- package/dist/htest/trendTests.js +8 -4
- package/dist/htest/types.d.ts +14 -2
- package/dist/htest/varTest.d.ts +25 -8
- package/dist/htest/wilcoxTest.d.ts +10 -2
- package/dist/internal/dpq.d.ts +4 -0
- package/dist/internal/noncentral.d.ts +2 -0
- package/dist/internal/vectorize.d.ts +4 -0
- package/dist/linalg/basic.d.ts +39 -5
- package/dist/linalg/basic.js +15 -0
- package/dist/linalg/chol.d.ts +26 -5
- package/dist/linalg/chol.js +7 -0
- package/dist/linalg/eigen.d.ts +16 -7
- package/dist/linalg/eigen.js +6 -5
- package/dist/linalg/expm.d.ts +15 -5
- package/dist/linalg/expm.js +5 -3
- package/dist/linalg/kappa.d.ts +21 -1
- package/dist/linalg/kappa.js +16 -0
- package/dist/linalg/lu.d.ts +30 -6
- package/dist/linalg/lu.js +15 -3
- package/dist/linalg/matrix.d.ts +4 -0
- package/dist/linalg/norm.d.ts +16 -1
- package/dist/linalg/norm.js +9 -0
- package/dist/linalg/ops.d.ts +156 -35
- package/dist/linalg/ops.js +96 -15
- package/dist/linalg/qr.d.ts +87 -12
- package/dist/linalg/qr.js +31 -0
- package/dist/linalg/schur.d.ts +8 -2
- package/dist/linalg/schur.js +3 -1
- package/dist/linalg/solve.d.ts +42 -6
- package/dist/linalg/solve.js +22 -0
- package/dist/linalg/svd.d.ts +12 -2
- package/dist/linalg/svd.js +2 -0
- package/dist/linalg.js +2 -2
- package/dist/mixed.js +3 -0
- package/dist/models/anovaSequential.d.ts +26 -4
- package/dist/models/anovaSequential.js +3 -1
- package/dist/models/aovEz.d.ts +29 -6
- package/dist/models/aovEz.js +5 -2
- package/dist/models/aovStrata.d.ts +13 -3
- package/dist/models/aovStrata.js +5 -1
- package/dist/models/carAnova.d.ts +9 -3
- package/dist/models/carAnova.js +4 -2
- package/dist/models/coxph.d.ts +33 -7
- package/dist/models/coxph.js +8 -3
- package/dist/models/formula.d.ts +26 -1
- package/dist/models/formula.js +125 -9
- package/dist/models/glm.d.ts +128 -21
- package/dist/models/glm.js +71 -14
- package/dist/models/glmAnova.d.ts +30 -5
- package/dist/models/glmAnova.js +15 -2
- package/dist/models/glmConfint.d.ts +16 -2
- package/dist/models/glmConfint.js +9 -1
- package/dist/models/glmFamily.d.ts +27 -5
- package/dist/models/lm.d.ts +77 -19
- package/dist/models/lm.js +22 -4
- package/dist/models/lmer.d.ts +162 -0
- package/dist/models/lmer.js +457 -0
- package/dist/models/mauchly.d.ts +20 -5
- package/dist/models/mauchly.js +7 -3
- package/dist/models/mixedDeviance.d.ts +44 -0
- package/dist/models/mixedDeviance.js +872 -0
- package/dist/models/mixedStructure.d.ts +82 -0
- package/dist/models/mixedStructure.js +309 -0
- package/dist/models/modelFrame.d.ts +17 -2
- package/dist/models/modelFrame.js +36 -21
- package/dist/models/modelMatrix.d.ts +33 -8
- package/dist/models/modelMatrix.js +21 -5
- package/dist/models/survival.d.ts +41 -9
- package/dist/models/survival.js +10 -4
- package/dist/numerics/deriv.d.ts +21 -6
- package/dist/numerics/deriv.js +16 -5
- package/dist/numerics/integrate.d.ts +37 -7
- package/dist/numerics/integrate.js +8 -2
- package/dist/numerics/interp.d.ts +63 -12
- package/dist/numerics/interp.js +30 -6
- package/dist/numerics/ode.d.ts +15 -5
- package/dist/numerics/ode.js +5 -3
- package/dist/numerics.js +2 -2
- package/dist/optim/optim.d.ts +32 -8
- package/dist/optim/optim.js +8 -4
- package/dist/random/beta.d.ts +8 -0
- package/dist/random/beta.js +8 -0
- package/dist/random/binomial.d.ts +16 -0
- package/dist/random/binomial.js +16 -0
- package/dist/random/continuous.d.ts +51 -0
- package/dist/random/continuous.js +51 -0
- package/dist/random/extra.d.ts +66 -6
- package/dist/random/extra.js +66 -6
- package/dist/random/gamma.d.ts +33 -0
- package/dist/random/gamma.js +33 -0
- package/dist/random/hyper.d.ts +8 -0
- package/dist/random/hyper.js +8 -0
- package/dist/random/poisson.d.ts +25 -0
- package/dist/random/poisson.js +25 -0
- package/dist/random/r2dtable.d.ts +2 -0
- package/dist/random/r2dtable.js +2 -0
- package/dist/random/rank.d.ts +16 -0
- package/dist/random/rank.js +16 -0
- package/dist/random/rng.d.ts +49 -6
- package/dist/random/rng.js +29 -2
- package/dist/random/sample.d.ts +10 -2
- package/dist/random/sample.js +5 -1
- package/dist/random/streams.d.ts +13 -0
- package/dist/random/streams.js +13 -0
- package/dist/rstats.js +14 -14
- package/dist/special/besselIK.d.ts +11 -3
- package/dist/special/besselIK.js +6 -2
- package/dist/special/besselJY.d.ts +6 -2
- package/dist/special/besselJY.js +6 -2
- package/dist/special/beta.d.ts +16 -2
- package/dist/special/beta.js +16 -2
- package/dist/special/choose.d.ts +13 -5
- package/dist/special/choose.js +13 -5
- package/dist/special/erf.d.ts +8 -3
- package/dist/special/erf.js +8 -3
- package/dist/special/extra.d.ts +30 -10
- package/dist/special/extra.js +25 -9
- package/dist/special/gamma.d.ts +18 -2
- package/dist/special/gamma.js +18 -2
- package/dist/special/log1p.d.ts +16 -7
- package/dist/special/log1p.js +16 -7
- package/dist/special/psigamma.d.ts +9 -3
- package/dist/special/psigamma.js +9 -3
- package/dist/special/rCompatible.d.ts +5 -1
- package/dist/special.js +2 -2
- package/dist/tests.js +12 -12
- package/llms.txt +13 -3
- package/package.json +5 -1
- package/dist/chunks/chunk-7GQMKH3Z.js +0 -2
- package/dist/chunks/chunk-AHHS6AC4.js +0 -3
- package/dist/chunks/chunk-ALM3VHFP.js +0 -2
|
@@ -51,22 +51,53 @@ export function qarcsine1(p, a, b, lowerTail, logP) {
|
|
|
51
51
|
return b - (b - a) * qbeta1(p, 0.5, 0.5, !lowerTail, logP);
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* Density of the arcsine distribution on (a, b), f(x) = 1 / (pi sqrt((x - a)(b - x))).
|
|
55
|
-
*
|
|
54
|
+
* Density of the arcsine distribution on (a, b), f(x) = 1 / (pi sqrt((x - a)(b - x))).
|
|
55
|
+
* Not an R function. Neither base R nor extraDistr has the arcsine distribution; this equals
|
|
56
|
+
* `dbeta((x - a) / (b - a), 0.5, 0.5) / (b - a)`.
|
|
56
57
|
*
|
|
57
58
|
* @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
58
59
|
* @param options - `a` and `b` (see {@link ArcsineParams}) and `log` (see {@link DensityOptions}).
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* darcsine(0.5); // 0.6366197723675813
|
|
64
|
+
* darcsine(1, { a: 0, b: 4 }); // 0.1837762984739307
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @category Distributions
|
|
59
68
|
*/
|
|
60
69
|
export function darcsine(x, options = {}) {
|
|
61
70
|
const { a = 0, b = 1, log = false } = options;
|
|
62
71
|
return vectorize(x, (v) => darcsine1(v, a, b, log));
|
|
63
72
|
}
|
|
64
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Distribution function of the arcsine distribution on (a, b): `pbeta((q - a) / (b - a), 0.5, 0.5)`.
|
|
75
|
+
* Not an R function. Neither base R nor extraDistr has the arcsine distribution.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* parcsine(0.25); // 0.3333333333333333
|
|
80
|
+
* parcsine(1, { a: 0, b: 4 }); // 0.3333333333333333
|
|
81
|
+
* ```
|
|
82
|
+
*
|
|
83
|
+
* @category Distributions
|
|
84
|
+
*/
|
|
65
85
|
export function parcsine(q, options = {}) {
|
|
66
86
|
const { a = 0, b = 1, lowerTail = true, logP = false } = options;
|
|
67
87
|
return vectorize(q, (v) => parcsine1(v, a, b, lowerTail, logP));
|
|
68
88
|
}
|
|
69
|
-
/**
|
|
89
|
+
/**
|
|
90
|
+
* Quantile function of the arcsine distribution on (a, b): `a + (b - a) qbeta(p, 0.5, 0.5)`.
|
|
91
|
+
* Not an R function. Neither base R nor extraDistr has the arcsine distribution.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* qarcsine(0.5); // 0.5
|
|
96
|
+
* qarcsine(0.25, { a: 0, b: 4 }); // 0.5857864376269049
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @category Distributions
|
|
100
|
+
*/
|
|
70
101
|
export function qarcsine(p, options = {}) {
|
|
71
102
|
const { a = 0, b = 1, lowerTail = true, logP = false } = options;
|
|
72
103
|
return vectorize(p, (v) => qarcsine1(v, a, b, lowerTail, logP));
|
|
@@ -23,6 +23,14 @@ export declare function qbeta1(p: number, a: number, b: number, lowerTail: boole
|
|
|
23
23
|
* @param shape2 - Second shape parameter (b).
|
|
24
24
|
* @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
|
|
25
25
|
* @returns The density (or log density).
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* dbeta(0.5, 2, 3); // 1.5
|
|
30
|
+
* dbeta([0.25, 0.75], 2, 3); // [1.6875, 0.5625]
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @category Distributions
|
|
26
34
|
*/
|
|
27
35
|
export declare function dbeta<T extends Vectorizable>(x: T, shape1: number, shape2: number, options?: DensityOptions & NoncentralOption): VectorResult<T>;
|
|
28
36
|
/**
|
|
@@ -40,6 +48,8 @@ export declare function dbeta<T extends Vectorizable>(x: T, shape1: number, shap
|
|
|
40
48
|
* ```ts
|
|
41
49
|
* pbeta(0.5, 2, 3); // 0.6875 (up to rounding)
|
|
42
50
|
* ```
|
|
51
|
+
*
|
|
52
|
+
* @category Distributions
|
|
43
53
|
*/
|
|
44
54
|
export declare function pbeta<T extends Vectorizable>(q: T, shape1: number, shape2: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
|
|
45
55
|
/**
|
|
@@ -58,5 +68,7 @@ export declare function pbeta<T extends Vectorizable>(q: T, shape1: number, shap
|
|
|
58
68
|
* qbeta(0.025, 3, 7); // 0.07485463141969181
|
|
59
69
|
* qbeta([0.025, 0.975], 3, 7); // [0.07485463141969181, 0.6000935737163121]
|
|
60
70
|
* ```
|
|
71
|
+
*
|
|
72
|
+
* @category Distributions
|
|
61
73
|
*/
|
|
62
74
|
export declare function qbeta<T extends Vectorizable>(p: T, shape1: number, shape2: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
|
|
@@ -208,6 +208,14 @@ export function qbeta1(p, a, b, lowerTail, logP) {
|
|
|
208
208
|
* @param shape2 - Second shape parameter (b).
|
|
209
209
|
* @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
|
|
210
210
|
* @returns The density (or log density).
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```ts
|
|
214
|
+
* dbeta(0.5, 2, 3); // 1.5
|
|
215
|
+
* dbeta([0.25, 0.75], 2, 3); // [1.6875, 0.5625]
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* @category Distributions
|
|
211
219
|
*/
|
|
212
220
|
export function dbeta(x, shape1, shape2, options = {}) {
|
|
213
221
|
const { log = false, ncp } = options;
|
|
@@ -230,6 +238,8 @@ export function dbeta(x, shape1, shape2, options = {}) {
|
|
|
230
238
|
* ```ts
|
|
231
239
|
* pbeta(0.5, 2, 3); // 0.6875 (up to rounding)
|
|
232
240
|
* ```
|
|
241
|
+
*
|
|
242
|
+
* @category Distributions
|
|
233
243
|
*/
|
|
234
244
|
export function pbeta(q, shape1, shape2, options = {}) {
|
|
235
245
|
const { lowerTail = true, logP = false, ncp } = options;
|
|
@@ -253,6 +263,8 @@ export function pbeta(q, shape1, shape2, options = {}) {
|
|
|
253
263
|
* qbeta(0.025, 3, 7); // 0.07485463141969181
|
|
254
264
|
* qbeta([0.025, 0.975], 3, 7); // [0.07485463141969181, 0.6000935737163121]
|
|
255
265
|
* ```
|
|
266
|
+
*
|
|
267
|
+
* @category Distributions
|
|
256
268
|
*/
|
|
257
269
|
export function qbeta(p, shape1, shape2, options = {}) {
|
|
258
270
|
const { lowerTail = true, logP = false, ncp } = options;
|
|
@@ -11,6 +11,14 @@ export declare function qbinom1(p: number, size: number, prob: number, lowerTail
|
|
|
11
11
|
* @param prob - Probability of success on each trial.
|
|
12
12
|
* @param options - `log` (see {@link DensityOptions}).
|
|
13
13
|
* @returns The probability (or log probability).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* dbinom(3, 10, 0.5); // 0.1171875
|
|
18
|
+
* dbinom([0, 5], 10, 0.5); // [0.0009765625, 0.24609375]
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @category Distributions
|
|
14
22
|
*/
|
|
15
23
|
export declare function dbinom<T extends Vectorizable>(x: T, size: number, prob: number, options?: DensityOptions): VectorResult<T>;
|
|
16
24
|
/**
|
|
@@ -27,6 +35,8 @@ export declare function dbinom<T extends Vectorizable>(x: T, size: number, prob:
|
|
|
27
35
|
* pbinom(3, 10, 0.5); // 0.171875
|
|
28
36
|
* pbinom([3, 5], 10, 0.5); // [0.171875, 0.623046875]
|
|
29
37
|
* ```
|
|
38
|
+
*
|
|
39
|
+
* @category Distributions
|
|
30
40
|
*/
|
|
31
41
|
export declare function pbinom<T extends Vectorizable>(q: T, size: number, prob: number, options?: TailOptions): VectorResult<T>;
|
|
32
42
|
/**
|
|
@@ -37,5 +47,13 @@ export declare function pbinom<T extends Vectorizable>(q: T, size: number, prob:
|
|
|
37
47
|
* @param prob - Probability of success on each trial.
|
|
38
48
|
* @param options - `lowerTail` and `logP` (see {@link TailOptions}).
|
|
39
49
|
* @returns The quantile(s).
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* qbinom(0.5, 10, 0.3); // 3
|
|
54
|
+
* qbinom([0.025, 0.975], 10, 0.3); // [0, 6]
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @category Distributions
|
|
40
58
|
*/
|
|
41
59
|
export declare function qbinom<T extends Vectorizable>(p: T, size: number, prob: number, options?: TailOptions): VectorResult<T>;
|
|
@@ -92,6 +92,14 @@ export function qbinom1(p, size, prob, lowerTail, logP) {
|
|
|
92
92
|
* @param prob - Probability of success on each trial.
|
|
93
93
|
* @param options - `log` (see {@link DensityOptions}).
|
|
94
94
|
* @returns The probability (or log probability).
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* dbinom(3, 10, 0.5); // 0.1171875
|
|
99
|
+
* dbinom([0, 5], 10, 0.5); // [0.0009765625, 0.24609375]
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @category Distributions
|
|
95
103
|
*/
|
|
96
104
|
export function dbinom(x, size, prob, options = {}) {
|
|
97
105
|
const log = options.log ?? false;
|
|
@@ -111,6 +119,8 @@ export function dbinom(x, size, prob, options = {}) {
|
|
|
111
119
|
* pbinom(3, 10, 0.5); // 0.171875
|
|
112
120
|
* pbinom([3, 5], 10, 0.5); // [0.171875, 0.623046875]
|
|
113
121
|
* ```
|
|
122
|
+
*
|
|
123
|
+
* @category Distributions
|
|
114
124
|
*/
|
|
115
125
|
export function pbinom(q, size, prob, options = {}) {
|
|
116
126
|
const { lowerTail = true, logP = false } = options;
|
|
@@ -124,6 +134,14 @@ export function pbinom(q, size, prob, options = {}) {
|
|
|
124
134
|
* @param prob - Probability of success on each trial.
|
|
125
135
|
* @param options - `lowerTail` and `logP` (see {@link TailOptions}).
|
|
126
136
|
* @returns The quantile(s).
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* qbinom(0.5, 10, 0.3); // 3
|
|
141
|
+
* qbinom([0.025, 0.975], 10, 0.3); // [0, 6]
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* @category Distributions
|
|
127
145
|
*/
|
|
128
146
|
export function qbinom(p, size, prob, options = {}) {
|
|
129
147
|
const { lowerTail = true, logP = false } = options;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Probability that a standard bivariate normal pair (X, Y) with correlation `rho` lies in the rectangle
|
|
3
|
-
* `lower ≤ (X, Y) ≤ upper`. Equivalent to mvtnorm
|
|
3
|
+
* `lower ≤ (X, Y) ≤ upper`. Equivalent to `mvtnorm::pmvnorm()` in R. The same as
|
|
4
|
+
* `pmvnorm(lower, upper, corr = matrix(c(1, rho, rho, 1), 2))`.
|
|
4
5
|
* Bounds may be infinite. Accurate to about 1e-15 absolute.
|
|
5
6
|
*
|
|
6
7
|
* @param lower - Lower bounds `[a1, a2]`.
|
|
@@ -11,5 +12,7 @@
|
|
|
11
12
|
* ```ts
|
|
12
13
|
* pbvnorm([-Infinity, -Infinity], [0, 0], 0.5); // 0.3333333333333333
|
|
13
14
|
* ```
|
|
15
|
+
*
|
|
16
|
+
* @category Distributions
|
|
14
17
|
*/
|
|
15
18
|
export declare function pbvnorm(lower: readonly [number, number] | readonly number[], upper: readonly [number, number] | readonly number[], rho: number): number;
|
|
@@ -100,7 +100,8 @@ function orthant(h, k, r) {
|
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Probability that a standard bivariate normal pair (X, Y) with correlation `rho` lies in the rectangle
|
|
103
|
-
* `lower ≤ (X, Y) ≤ upper`. Equivalent to mvtnorm
|
|
103
|
+
* `lower ≤ (X, Y) ≤ upper`. Equivalent to `mvtnorm::pmvnorm()` in R. The same as
|
|
104
|
+
* `pmvnorm(lower, upper, corr = matrix(c(1, rho, rho, 1), 2))`.
|
|
104
105
|
* Bounds may be infinite. Accurate to about 1e-15 absolute.
|
|
105
106
|
*
|
|
106
107
|
* @param lower - Lower bounds `[a1, a2]`.
|
|
@@ -111,6 +112,8 @@ function orthant(h, k, r) {
|
|
|
111
112
|
* ```ts
|
|
112
113
|
* pbvnorm([-Infinity, -Infinity], [0, 0], 0.5); // 0.3333333333333333
|
|
113
114
|
* ```
|
|
115
|
+
*
|
|
116
|
+
* @category Distributions
|
|
114
117
|
*/
|
|
115
118
|
export function pbvnorm(lower, upper, rho) {
|
|
116
119
|
if (lower.length !== 2 || upper.length !== 2)
|
|
@@ -14,6 +14,14 @@ export declare function qcauchy1(p: number, location: number, scale: number, low
|
|
|
14
14
|
* @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
15
15
|
* @param options - `location` and `scale` (see {@link LocationScaleParams}) and `log` (see {@link DensityOptions}).
|
|
16
16
|
* @returns The density (or log density).
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* dcauchy(0); // 0.3183098861837907
|
|
21
|
+
* dcauchy(1, { location: 1, scale: 2 }); // 0.15915494309189535
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category Distributions
|
|
17
25
|
*/
|
|
18
26
|
export declare function dcauchy<T extends Vectorizable>(x: T, options?: LocationScaleParams & DensityOptions): VectorResult<T>;
|
|
19
27
|
/**
|
|
@@ -22,6 +30,14 @@ export declare function dcauchy<T extends Vectorizable>(x: T, options?: Location
|
|
|
22
30
|
* @param q - Quantile(s): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
23
31
|
* @param options - `location` and `scale` (see {@link LocationScaleParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
24
32
|
* @returns The probability (or log probability).
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* pcauchy(1); // 0.75
|
|
37
|
+
* pcauchy(3, { location: 1, scale: 2 }); // 0.75
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @category Distributions
|
|
25
41
|
*/
|
|
26
42
|
export declare function pcauchy<T extends Vectorizable>(q: T, options?: LocationScaleParams & TailOptions): VectorResult<T>;
|
|
27
43
|
/**
|
|
@@ -30,5 +46,13 @@ export declare function pcauchy<T extends Vectorizable>(q: T, options?: Location
|
|
|
30
46
|
* @param p - Probability (or log probability with `logP`): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
31
47
|
* @param options - `location` and `scale` (see {@link LocationScaleParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
32
48
|
* @returns The quantile(s).
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* qcauchy(0.75); // 1.0000000000000002
|
|
53
|
+
* qcauchy(0.975, { scale: 2 }); // 25.41240947234939
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* @category Distributions
|
|
33
57
|
*/
|
|
34
58
|
export declare function qcauchy<T extends Vectorizable>(p: T, options?: LocationScaleParams & TailOptions): VectorResult<T>;
|
|
@@ -110,6 +110,14 @@ export function qcauchy1(p, location, scale, lowerTail, logP) {
|
|
|
110
110
|
* @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
111
111
|
* @param options - `location` and `scale` (see {@link LocationScaleParams}) and `log` (see {@link DensityOptions}).
|
|
112
112
|
* @returns The density (or log density).
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* dcauchy(0); // 0.3183098861837907
|
|
117
|
+
* dcauchy(1, { location: 1, scale: 2 }); // 0.15915494309189535
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @category Distributions
|
|
113
121
|
*/
|
|
114
122
|
export function dcauchy(x, options = {}) {
|
|
115
123
|
const { location = 0, scale = 1, log = false } = options;
|
|
@@ -121,6 +129,14 @@ export function dcauchy(x, options = {}) {
|
|
|
121
129
|
* @param q - Quantile(s): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
122
130
|
* @param options - `location` and `scale` (see {@link LocationScaleParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
123
131
|
* @returns The probability (or log probability).
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* pcauchy(1); // 0.75
|
|
136
|
+
* pcauchy(3, { location: 1, scale: 2 }); // 0.75
|
|
137
|
+
* ```
|
|
138
|
+
*
|
|
139
|
+
* @category Distributions
|
|
124
140
|
*/
|
|
125
141
|
export function pcauchy(q, options = {}) {
|
|
126
142
|
const { location = 0, scale = 1, lowerTail = true, logP = false } = options;
|
|
@@ -132,6 +148,14 @@ export function pcauchy(q, options = {}) {
|
|
|
132
148
|
* @param p - Probability (or log probability with `logP`): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
133
149
|
* @param options - `location` and `scale` (see {@link LocationScaleParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
134
150
|
* @returns The quantile(s).
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* qcauchy(0.75); // 1.0000000000000002
|
|
155
|
+
* qcauchy(0.975, { scale: 2 }); // 25.41240947234939
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @category Distributions
|
|
135
159
|
*/
|
|
136
160
|
export function qcauchy(p, options = {}) {
|
|
137
161
|
const { location = 0, scale = 1, lowerTail = true, logP = false } = options;
|
|
@@ -10,6 +10,14 @@ import type { NoncentralOption } from "../internal/noncentral.js";
|
|
|
10
10
|
* @param df - Degrees of freedom.
|
|
11
11
|
* @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
|
|
12
12
|
* @returns The density (or log density).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* dchisq(1, 3); // 0.24197072451914337
|
|
17
|
+
* dchisq(1, 3, { ncp: 2 }); // 0.12180056753215114
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @category Distributions
|
|
13
21
|
*/
|
|
14
22
|
export declare function dchisq<T extends Vectorizable>(x: T, df: number, options?: DensityOptions & NoncentralOption): VectorResult<T>;
|
|
15
23
|
/**
|
|
@@ -27,6 +35,8 @@ export declare function dchisq<T extends Vectorizable>(x: T, df: number, options
|
|
|
27
35
|
* pchisq(3.84, 1, { lowerTail: false }); // 0.05004352124870517
|
|
28
36
|
* pchisq(5, 3, { ncp: 2 }); // 0.5934051800831556
|
|
29
37
|
* ```
|
|
38
|
+
*
|
|
39
|
+
* @category Distributions
|
|
30
40
|
*/
|
|
31
41
|
export declare function pchisq<T extends Vectorizable>(q: T, df: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
|
|
32
42
|
/**
|
|
@@ -38,5 +48,13 @@ export declare function pchisq<T extends Vectorizable>(q: T, df: number, options
|
|
|
38
48
|
* @param df - Degrees of freedom.
|
|
39
49
|
* @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
40
50
|
* @returns The quantile(s).
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* qchisq(0.95, 1); // 3.841458820694125
|
|
55
|
+
* qchisq(0.05, 3, { lowerTail: false }); // 7.814727903251181
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @category Distributions
|
|
41
59
|
*/
|
|
42
60
|
export declare function qchisq<T extends Vectorizable>(p: T, df: number, options?: TailOptions & NoncentralOption): VectorResult<T>;
|
|
@@ -13,6 +13,14 @@ import { dnchisq1, pnchisq1, qnchisq1 } from "./nchisq.js";
|
|
|
13
13
|
* @param df - Degrees of freedom.
|
|
14
14
|
* @param options - `ncp` (see {@link NoncentralOption}) and `log` (see {@link DensityOptions}).
|
|
15
15
|
* @returns The density (or log density).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* dchisq(1, 3); // 0.24197072451914337
|
|
20
|
+
* dchisq(1, 3, { ncp: 2 }); // 0.12180056753215114
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* @category Distributions
|
|
16
24
|
*/
|
|
17
25
|
export function dchisq(x, df, options = {}) {
|
|
18
26
|
const { log = false, ncp } = options;
|
|
@@ -35,6 +43,8 @@ export function dchisq(x, df, options = {}) {
|
|
|
35
43
|
* pchisq(3.84, 1, { lowerTail: false }); // 0.05004352124870517
|
|
36
44
|
* pchisq(5, 3, { ncp: 2 }); // 0.5934051800831556
|
|
37
45
|
* ```
|
|
46
|
+
*
|
|
47
|
+
* @category Distributions
|
|
38
48
|
*/
|
|
39
49
|
export function pchisq(q, df, options = {}) {
|
|
40
50
|
const { lowerTail = true, logP = false, ncp } = options;
|
|
@@ -51,6 +61,14 @@ export function pchisq(q, df, options = {}) {
|
|
|
51
61
|
* @param df - Degrees of freedom.
|
|
52
62
|
* @param options - `ncp` (see {@link NoncentralOption}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
53
63
|
* @returns The quantile(s).
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* qchisq(0.95, 1); // 3.841458820694125
|
|
68
|
+
* qchisq(0.05, 3, { lowerTail: false }); // 7.814727903251181
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @category Distributions
|
|
54
72
|
*/
|
|
55
73
|
export function qchisq(p, df, options = {}) {
|
|
56
74
|
const { lowerTail = true, logP = false, ncp } = 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
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Parameters of the exponential distribution.
|
|
5
|
+
*
|
|
6
|
+
* @category Distributions
|
|
7
|
+
*/
|
|
4
8
|
export interface ExponentialParams {
|
|
5
9
|
/** Rate. Default `1`. */
|
|
6
10
|
rate?: number;
|
|
@@ -14,6 +18,14 @@ export declare function qexp1(p: number, rate: number, lowerTail: boolean, logP:
|
|
|
14
18
|
* @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
15
19
|
* @param options - `rate` (see {@link ExponentialParams}) and `log` (see {@link DensityOptions}).
|
|
16
20
|
* @returns The density (or log density).
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* dexp(1); // 0.36787944117144233
|
|
25
|
+
* dexp(1, { rate: 2 }); // 0.2706705664732254
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @category Distributions
|
|
17
29
|
*/
|
|
18
30
|
export declare function dexp<T extends Vectorizable>(x: T, options?: ExponentialParams & DensityOptions): VectorResult<T>;
|
|
19
31
|
/**
|
|
@@ -22,6 +34,14 @@ export declare function dexp<T extends Vectorizable>(x: T, options?: Exponential
|
|
|
22
34
|
* @param q - Quantile(s): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
23
35
|
* @param options - `rate` (see {@link ExponentialParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
24
36
|
* @returns The probability (or log probability).
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* pexp(1); // 0.6321205588285577
|
|
41
|
+
* pexp(1, { rate: 2, lowerTail: false }); // 0.1353352832366127
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @category Distributions
|
|
25
45
|
*/
|
|
26
46
|
export declare function pexp<T extends Vectorizable>(q: T, options?: ExponentialParams & TailOptions): VectorResult<T>;
|
|
27
47
|
/**
|
|
@@ -30,5 +50,13 @@ export declare function pexp<T extends Vectorizable>(q: T, options?: Exponential
|
|
|
30
50
|
* @param p - Probability (or log probability with `logP`): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
31
51
|
* @param options - `rate` (see {@link ExponentialParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
32
52
|
* @returns The quantile(s).
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* qexp(0.5, { rate: 2 }); // 0.34657359027997264
|
|
57
|
+
* qexp([0.25, 0.75]); // [0.2876820724517809, 1.3862943611198906]
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @category Distributions
|
|
33
61
|
*/
|
|
34
62
|
export declare function qexp<T extends Vectorizable>(p: T, options?: ExponentialParams & TailOptions): VectorResult<T>;
|
|
@@ -64,6 +64,14 @@ export function qexp1(p, rate, lowerTail, logP) {
|
|
|
64
64
|
* @param x - Value(s) at which to evaluate: a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
65
65
|
* @param options - `rate` (see {@link ExponentialParams}) and `log` (see {@link DensityOptions}).
|
|
66
66
|
* @returns The density (or log density).
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* dexp(1); // 0.36787944117144233
|
|
71
|
+
* dexp(1, { rate: 2 }); // 0.2706705664732254
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @category Distributions
|
|
67
75
|
*/
|
|
68
76
|
export function dexp(x, options = {}) {
|
|
69
77
|
const { rate = 1, log = false } = options;
|
|
@@ -75,6 +83,14 @@ export function dexp(x, options = {}) {
|
|
|
75
83
|
* @param q - Quantile(s): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
76
84
|
* @param options - `rate` (see {@link ExponentialParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
77
85
|
* @returns The probability (or log probability).
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* pexp(1); // 0.6321205588285577
|
|
90
|
+
* pexp(1, { rate: 2, lowerTail: false }); // 0.1353352832366127
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @category Distributions
|
|
78
94
|
*/
|
|
79
95
|
export function pexp(q, options = {}) {
|
|
80
96
|
const { rate = 1, lowerTail = true, logP = false } = options;
|
|
@@ -86,6 +102,14 @@ export function pexp(q, options = {}) {
|
|
|
86
102
|
* @param p - Probability (or log probability with `logP`): a number, `number[]` or `Float64Array`. The result has the same shape.
|
|
87
103
|
* @param options - `rate` (see {@link ExponentialParams}), `lowerTail` and `logP` (see {@link TailOptions}).
|
|
88
104
|
* @returns The quantile(s).
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* qexp(0.5, { rate: 2 }); // 0.34657359027997264
|
|
109
|
+
* qexp([0.25, 0.75]); // [0.2876820724517809, 1.3862943611198906]
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @category Distributions
|
|
89
113
|
*/
|
|
90
114
|
export function qexp(p, options = {}) {
|
|
91
115
|
const { rate = 1, lowerTail = true, logP = false } = options;
|
|
@@ -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>;
|
package/dist/distributions/f.js
CHANGED
|
@@ -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);
|