@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
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type Alternative, type HTest } from "./types.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link poissonTest}.
|
|
4
|
+
*
|
|
5
|
+
* @category Hypothesis tests
|
|
6
|
+
*/
|
|
3
7
|
export interface PoissonTestOptions {
|
|
4
8
|
/** Time base(s): one per count, nonnegative. Default `1` (or `[1, 1]`). */
|
|
5
9
|
T?: number | readonly number[];
|
|
@@ -10,7 +14,11 @@ export interface PoissonTestOptions {
|
|
|
10
14
|
/** Confidence level of the interval. Default `0.95`. */
|
|
11
15
|
confLevel?: number;
|
|
12
16
|
}
|
|
13
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Result of {@link poissonTest}.
|
|
19
|
+
*
|
|
20
|
+
* @category Hypothesis tests
|
|
21
|
+
*/
|
|
14
22
|
export interface PoissonTestResult extends HTest {
|
|
15
23
|
/** Time base (one sample) or expected first count under the null hypothesis (two samples). */
|
|
16
24
|
parameter: number;
|
|
@@ -31,5 +39,7 @@ export interface PoissonTestResult extends HTest {
|
|
|
31
39
|
* poissonTest(137, { T: 24.19893 }).pValue; // < 2.2e-16 (rate 1 against 5.66)
|
|
32
40
|
* poissonTest([11, 23], { T: [800, 3011] }).estimate; // rate ratio 1.80
|
|
33
41
|
* ```
|
|
42
|
+
*
|
|
43
|
+
* @category Hypothesis tests
|
|
34
44
|
*/
|
|
35
45
|
export declare function poissonTest(x: number | readonly number[], options?: PoissonTestOptions): PoissonTestResult;
|
|
@@ -83,6 +83,8 @@ function twoSidedP(x, m) {
|
|
|
83
83
|
* poissonTest(137, { T: 24.19893 }).pValue; // < 2.2e-16 (rate 1 against 5.66)
|
|
84
84
|
* poissonTest([11, 23], { T: [800, 3011] }).estimate; // rate ratio 1.80
|
|
85
85
|
* ```
|
|
86
|
+
*
|
|
87
|
+
* @category Hypothesis tests
|
|
86
88
|
*/
|
|
87
89
|
export function poissonTest(x, options = {}) {
|
|
88
90
|
const xs = typeof x === "number" ? [x] : Array.from(x);
|
package/dist/htest/polycor.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Result of {@link polychor} and {@link polyserial}.
|
|
3
|
+
*
|
|
4
|
+
* @category Agreement, reliability and factor analysis
|
|
5
|
+
*/
|
|
2
6
|
export interface PolycorResult {
|
|
3
7
|
/** The correlation (`NaN` where polycor returns NA). */
|
|
4
8
|
rho: number;
|
|
5
9
|
/** polycor's warnings, in order. */
|
|
6
10
|
warnings: string[];
|
|
7
11
|
}
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Options of {@link polychor} and {@link polyserial}.
|
|
14
|
+
*
|
|
15
|
+
* @category Agreement, reliability and factor analysis
|
|
16
|
+
*/
|
|
9
17
|
export interface PolycorOptions {
|
|
10
18
|
/**
|
|
11
19
|
* Estimate the correlation and the thresholds together by maximum likelihood (polycor's `ML = TRUE`), instead of
|
|
@@ -19,7 +27,11 @@ export interface PolycorOptions {
|
|
|
19
27
|
*/
|
|
20
28
|
stdErr?: boolean;
|
|
21
29
|
}
|
|
22
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* Result of {@link polychor} with `stdErr`.
|
|
32
|
+
*
|
|
33
|
+
* @category Agreement, reliability and factor analysis
|
|
34
|
+
*/
|
|
23
35
|
export interface PolychorStdErrResult extends PolycorResult {
|
|
24
36
|
/**
|
|
25
37
|
* Variances and covariances of the estimates (the inverse of the negative Hessian of the log-likelihood at the
|
|
@@ -37,7 +49,11 @@ export interface PolychorStdErrResult extends PolycorResult {
|
|
|
37
49
|
/** The column thresholds. */
|
|
38
50
|
colCuts: number[];
|
|
39
51
|
}
|
|
40
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Result of {@link polyserial} with `stdErr`.
|
|
54
|
+
*
|
|
55
|
+
* @category Agreement, reliability and factor analysis
|
|
56
|
+
*/
|
|
41
57
|
export interface PolyserialStdErrResult extends PolycorResult {
|
|
42
58
|
/** Variances and covariances of the estimates, in the order rho, the thresholds; 1 × 1 (rho alone) without `ML`. */
|
|
43
59
|
var: number[][];
|
|
@@ -50,10 +66,10 @@ export interface PolyserialStdErrResult extends PolycorResult {
|
|
|
50
66
|
/** The thresholds of the ordinal variable (the estimates with `ML`, the two-step ones otherwise). */
|
|
51
67
|
cuts: number[];
|
|
52
68
|
}
|
|
53
|
-
type Table = readonly (readonly number[])[];
|
|
54
69
|
/**
|
|
55
70
|
* Polychoric correlation of two ordinal variables. By default the two-step estimate: thresholds from the margins,
|
|
56
|
-
* then the maximum-likelihood correlation given them. Equivalent to polycor
|
|
71
|
+
* then the maximum-likelihood correlation given them. Equivalent to `polycor::polychor()` in R. It takes `x` and `y`
|
|
72
|
+
* or a table, as `polychor(x, y)` or `polychor(table)`.
|
|
57
73
|
*
|
|
58
74
|
* Given `x` and `y`, the table has the sorted distinct values of `x` as rows and those of `y` as columns (pairs with
|
|
59
75
|
* a missing value are not counted). Rows and columns with a zero margin are removed with a warning; with fewer than
|
|
@@ -72,11 +88,13 @@ type Table = readonly (readonly number[])[];
|
|
|
72
88
|
* polychor([[20, 8, 1], [5, 30, 9], [2, 6, 25]]).rho; // 0.785882312445335
|
|
73
89
|
* polychor([[20, 8, 1], [5, 30, 9], [2, 6, 25]], { ML: true }).rho; // 0.7911463316235798
|
|
74
90
|
* ```
|
|
91
|
+
*
|
|
92
|
+
* @category Agreement, reliability and factor analysis
|
|
75
93
|
*/
|
|
76
|
-
export declare function polychor(table:
|
|
94
|
+
export declare function polychor(table: readonly (readonly number[])[], options: PolycorOptions & {
|
|
77
95
|
stdErr: true;
|
|
78
96
|
}): PolychorStdErrResult;
|
|
79
|
-
export declare function polychor(table:
|
|
97
|
+
export declare function polychor(table: readonly (readonly number[])[], options?: PolycorOptions): PolycorResult;
|
|
80
98
|
/**
|
|
81
99
|
* Polychoric correlation of two ordinal variables given as vectors of category codes (see the table form).
|
|
82
100
|
*
|
|
@@ -90,7 +108,7 @@ export declare function polychor(x: readonly number[], y: readonly number[], opt
|
|
|
90
108
|
export declare function polychor(x: readonly number[], y: readonly number[], options?: PolycorOptions): PolycorResult;
|
|
91
109
|
/**
|
|
92
110
|
* Polyserial correlation of a numeric variable and an ordinal one. By default the two-step (ad hoc) estimate.
|
|
93
|
-
* Equivalent to polycor
|
|
111
|
+
* Equivalent to `polycor::polyserial(x, y)` in R.
|
|
94
112
|
*
|
|
95
113
|
* Pairs with a missing value are dropped. The categories of `y` are its sorted distinct values, coded 1, 2, ...;
|
|
96
114
|
* with fewer than two, `rho` is `NaN` (and the result has no other fields). A two-step estimate beyond ±0.9999 is set
|
|
@@ -109,9 +127,10 @@ export declare function polychor(x: readonly number[], y: readonly number[], opt
|
|
|
109
127
|
* ```ts
|
|
110
128
|
* polyserial([0.2, -1.1, 0.8, 1.5, -0.3, 0.1, -0.9, 2.0], [1, 1, 2, 3, 2, 2, 1, 2]).rho; // 0.8085111526489707
|
|
111
129
|
* ```
|
|
130
|
+
*
|
|
131
|
+
* @category Agreement, reliability and factor analysis
|
|
112
132
|
*/
|
|
113
133
|
export declare function polyserial(x: readonly number[], y: readonly number[], options: PolycorOptions & {
|
|
114
134
|
stdErr: true;
|
|
115
135
|
}): PolyserialStdErrResult;
|
|
116
136
|
export declare function polyserial(x: readonly number[], y: readonly number[], options?: PolycorOptions): PolycorResult;
|
|
117
|
-
export {};
|
package/dist/htest/power.d.ts
CHANGED
|
@@ -9,7 +9,11 @@ export declare function checkExactlyOne(values: readonly unknown[], message: str
|
|
|
9
9
|
export declare function solveFor(f: (x: number) => number, lower: number, upper: number, options?: UnirootOptions): number;
|
|
10
10
|
/** pt(q, df, ncp) in one tail */
|
|
11
11
|
export declare const ptNcp: (q: number, df: number, ncp: number, lowerTail: boolean) => number;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Options for {@link powerTTest}. The quantity given as `null` (or omitted, for those without a default) is solved for.
|
|
14
|
+
*
|
|
15
|
+
* @category Effect sizes and power
|
|
16
|
+
*/
|
|
13
17
|
export interface PowerTTestOptions {
|
|
14
18
|
/** Number of observations (per group). */
|
|
15
19
|
n?: number | null;
|
|
@@ -30,15 +34,27 @@ export interface PowerTTestOptions {
|
|
|
30
34
|
/** Tolerance of the root finding. Default `eps^0.25`. */
|
|
31
35
|
tol?: number;
|
|
32
36
|
}
|
|
33
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Result of {@link powerTTest}: R's power.htest with the solved quantity filled in.
|
|
39
|
+
*
|
|
40
|
+
* @category Effect sizes and power
|
|
41
|
+
*/
|
|
34
42
|
export interface PowerTTestResult {
|
|
43
|
+
/** Number of observations (per group, or of pairs). */
|
|
35
44
|
n: number;
|
|
45
|
+
/** True difference in means. */
|
|
36
46
|
delta: number;
|
|
47
|
+
/** Standard deviation. */
|
|
37
48
|
sd: number;
|
|
49
|
+
/** Significance level (R's `sig.level`). */
|
|
38
50
|
sigLevel: number;
|
|
51
|
+
/** Power of the test. */
|
|
39
52
|
power: number;
|
|
53
|
+
/** `"two.sided"` or `"one.sided"`. */
|
|
40
54
|
alternative: "two.sided" | "one.sided";
|
|
55
|
+
/** A note on the sample size. */
|
|
41
56
|
note?: string;
|
|
57
|
+
/** Description of the calculation. */
|
|
42
58
|
method: string;
|
|
43
59
|
}
|
|
44
60
|
/**
|
|
@@ -50,9 +66,15 @@ export interface PowerTTestResult {
|
|
|
50
66
|
* powerTTest({ n: 20, delta: 1 }).power; // 0.8689528016921269
|
|
51
67
|
* powerTTest({ delta: 0.5, power: 0.8 }).n; // 63.765763714280546
|
|
52
68
|
* ```
|
|
69
|
+
*
|
|
70
|
+
* @category Effect sizes and power
|
|
53
71
|
*/
|
|
54
72
|
export declare function powerTTest(options?: PowerTTestOptions): PowerTTestResult;
|
|
55
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* Options for {@link powerPropTest}. The quantity given as `null` (or omitted, for those without a default) is solved for.
|
|
75
|
+
*
|
|
76
|
+
* @category Effect sizes and power
|
|
77
|
+
*/
|
|
56
78
|
export interface PowerPropTestOptions {
|
|
57
79
|
/** Number of observations per group. */
|
|
58
80
|
n?: number | null;
|
|
@@ -71,15 +93,27 @@ export interface PowerPropTestOptions {
|
|
|
71
93
|
/** Tolerance of the root finding. Default `eps^0.25`. */
|
|
72
94
|
tol?: number;
|
|
73
95
|
}
|
|
74
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Result of {@link powerPropTest}.
|
|
98
|
+
*
|
|
99
|
+
* @category Effect sizes and power
|
|
100
|
+
*/
|
|
75
101
|
export interface PowerPropTestResult {
|
|
102
|
+
/** Number of observations per group. */
|
|
76
103
|
n: number;
|
|
104
|
+
/** Probability in one group. */
|
|
77
105
|
p1: number;
|
|
106
|
+
/** Probability in the other group. */
|
|
78
107
|
p2: number;
|
|
108
|
+
/** Significance level (R's `sig.level`). */
|
|
79
109
|
sigLevel: number;
|
|
110
|
+
/** Power of the test. */
|
|
80
111
|
power: number;
|
|
112
|
+
/** `"two.sided"` or `"one.sided"`. */
|
|
81
113
|
alternative: "two.sided" | "one.sided";
|
|
114
|
+
/** A note on the sample size. */
|
|
82
115
|
note: string;
|
|
116
|
+
/** Description of the calculation. */
|
|
83
117
|
method: string;
|
|
84
118
|
/** R's warnings. */
|
|
85
119
|
warnings: string[];
|
|
@@ -92,9 +126,15 @@ export interface PowerPropTestResult {
|
|
|
92
126
|
* ```ts
|
|
93
127
|
* powerPropTest({ n: 50, p1: 0.5, p2: 0.75 }).power; // 0.7401659013313878
|
|
94
128
|
* ```
|
|
129
|
+
*
|
|
130
|
+
* @category Effect sizes and power
|
|
95
131
|
*/
|
|
96
132
|
export declare function powerPropTest(options?: PowerPropTestOptions): PowerPropTestResult;
|
|
97
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Options for {@link powerAnovaTest}. The quantity given as `null` (or omitted, for those without a default) is solved for.
|
|
135
|
+
*
|
|
136
|
+
* @category Effect sizes and power
|
|
137
|
+
*/
|
|
98
138
|
export interface PowerAnovaTestOptions {
|
|
99
139
|
/** Number of groups. */
|
|
100
140
|
groups?: number | null;
|
|
@@ -109,15 +149,27 @@ export interface PowerAnovaTestOptions {
|
|
|
109
149
|
/** Power of the test. */
|
|
110
150
|
power?: number | null;
|
|
111
151
|
}
|
|
112
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* Result of {@link powerAnovaTest}.
|
|
154
|
+
*
|
|
155
|
+
* @category Effect sizes and power
|
|
156
|
+
*/
|
|
113
157
|
export interface PowerAnovaTestResult {
|
|
158
|
+
/** Number of groups. */
|
|
114
159
|
groups: number;
|
|
160
|
+
/** Number of observations per group. */
|
|
115
161
|
n: number;
|
|
162
|
+
/** Variance between the groups' means (R's `between.var`). */
|
|
116
163
|
betweenVar: number;
|
|
164
|
+
/** Variance within the groups (R's `within.var`). */
|
|
117
165
|
withinVar: number;
|
|
166
|
+
/** Significance level (R's `sig.level`). */
|
|
118
167
|
sigLevel: number;
|
|
168
|
+
/** Power of the test. */
|
|
119
169
|
power: number;
|
|
170
|
+
/** A note on the sample size. */
|
|
120
171
|
note: string;
|
|
172
|
+
/** Description of the calculation. */
|
|
121
173
|
method: string;
|
|
122
174
|
}
|
|
123
175
|
/**
|
|
@@ -128,5 +180,7 @@ export interface PowerAnovaTestResult {
|
|
|
128
180
|
* ```ts
|
|
129
181
|
* powerAnovaTest({ groups: 4, n: 5, betweenVar: 1, withinVar: 3 }).power; // 0.3535594237229933
|
|
130
182
|
* ```
|
|
183
|
+
*
|
|
184
|
+
* @category Effect sizes and power
|
|
131
185
|
*/
|
|
132
186
|
export declare function powerAnovaTest(options?: PowerAnovaTestOptions): PowerAnovaTestResult;
|
package/dist/htest/power.js
CHANGED
|
@@ -50,6 +50,8 @@ const SIG_MESSAGE = "'sig.level' must be numeric in [0, 1]";
|
|
|
50
50
|
* powerTTest({ n: 20, delta: 1 }).power; // 0.8689528016921269
|
|
51
51
|
* powerTTest({ delta: 0.5, power: 0.8 }).n; // 63.765763714280546
|
|
52
52
|
* ```
|
|
53
|
+
*
|
|
54
|
+
* @category Effect sizes and power
|
|
53
55
|
*/
|
|
54
56
|
export function powerTTest(options = {}) {
|
|
55
57
|
let { n, delta, power } = options;
|
|
@@ -113,6 +115,8 @@ export function powerTTest(options = {}) {
|
|
|
113
115
|
* ```ts
|
|
114
116
|
* powerPropTest({ n: 50, p1: 0.5, p2: 0.75 }).power; // 0.7401659013313878
|
|
115
117
|
* ```
|
|
118
|
+
*
|
|
119
|
+
* @category Effect sizes and power
|
|
116
120
|
*/
|
|
117
121
|
export function powerPropTest(options = {}) {
|
|
118
122
|
let { n, p1, p2, power } = options;
|
|
@@ -180,6 +184,8 @@ export function powerPropTest(options = {}) {
|
|
|
180
184
|
* ```ts
|
|
181
185
|
* powerAnovaTest({ groups: 4, n: 5, betweenVar: 1, withinVar: 3 }).power; // 0.3535594237229933
|
|
182
186
|
* ```
|
|
187
|
+
*
|
|
188
|
+
* @category Effect sizes and power
|
|
183
189
|
*/
|
|
184
190
|
export function powerAnovaTest(options = {}) {
|
|
185
191
|
let { groups, n, betweenVar, withinVar, power } = options;
|
package/dist/htest/propTest.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type Alternative, type HTest } from "./types.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link propTest}.
|
|
4
|
+
*
|
|
5
|
+
* @category Hypothesis tests
|
|
6
|
+
*/
|
|
3
7
|
export interface PropTestOptions {
|
|
4
8
|
/** Hypothesized proportion(s), one per group, each strictly between 0 and 1. Default: `0.5` for one group, and
|
|
5
9
|
* equality of the proportions for several. */
|
|
@@ -11,7 +15,11 @@ export interface PropTestOptions {
|
|
|
11
15
|
/** Apply the continuity correction (one or two groups). Default `true`. */
|
|
12
16
|
correct?: boolean;
|
|
13
17
|
}
|
|
14
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Result of {@link propTest}.
|
|
20
|
+
*
|
|
21
|
+
* @category Hypothesis tests
|
|
22
|
+
*/
|
|
15
23
|
export interface PropTestResult extends Omit<HTest, "nullValue" | "nullValueName"> {
|
|
16
24
|
/** Degrees of freedom (`parameterName` is `"df"`). */
|
|
17
25
|
parameter: number;
|
|
@@ -19,6 +27,7 @@ export interface PropTestResult extends Omit<HTest, "nullValue" | "nullValueName
|
|
|
19
27
|
estimate: number | number[];
|
|
20
28
|
/** Hypothesized proportion(s), when given or for one group. */
|
|
21
29
|
nullValue?: number | number[];
|
|
30
|
+
/** Names of `nullValue` (R's `names(null.value)`), one per group. */
|
|
22
31
|
nullValueName?: string | string[];
|
|
23
32
|
}
|
|
24
33
|
/**
|
|
@@ -33,5 +42,7 @@ export interface PropTestResult extends Omit<HTest, "nullValue" | "nullValueName
|
|
|
33
42
|
* propTest([83, 90, 129, 70], [86, 93, 136, 82]).pValue; // equality of four proportions
|
|
34
43
|
* propTest(15, 20, { p: 0.5 }).confInt;
|
|
35
44
|
* ```
|
|
45
|
+
*
|
|
46
|
+
* @category Hypothesis tests
|
|
36
47
|
*/
|
|
37
48
|
export declare function propTest(x: number | readonly number[] | readonly (readonly number[])[], n?: number | readonly number[] | PropTestOptions, options?: PropTestOptions): PropTestResult;
|
package/dist/htest/propTest.js
CHANGED
|
@@ -24,6 +24,8 @@ import { checkConfLevelOpen, matchAlternative } from "./types.js";
|
|
|
24
24
|
* propTest([83, 90, 129, 70], [86, 93, 136, 82]).pValue; // equality of four proportions
|
|
25
25
|
* propTest(15, 20, { p: 0.5 }).confInt;
|
|
26
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* @category Hypothesis tests
|
|
27
29
|
*/
|
|
28
30
|
export function propTest(x, n, options = {}) {
|
|
29
31
|
// ---- inputs: successes and trials per group ----
|