@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.
- package/CHANGELOG.md +37 -0
- package/README.ja.md +13 -9
- package/README.md +13 -8
- package/dist/chunks/{chunk-QJJWGNJP.js → chunk-2X7JYQBI.js} +2 -2
- package/dist/chunks/{chunk-O6PT7IVU.js → chunk-36GVER3O.js} +2 -2
- package/dist/chunks/{chunk-EWC6I75B.js → chunk-3WUXRSM6.js} +1 -1
- package/dist/chunks/{chunk-4NM37MGA.js → chunk-6I6QKTFK.js} +2 -2
- package/dist/chunks/{chunk-2XKG3DX4.js → chunk-ETOEZTGL.js} +1 -1
- package/dist/chunks/{chunk-IT354SHV.js → chunk-FVPDVRJQ.js} +2 -2
- package/dist/chunks/{chunk-QULPY6YM.js → chunk-GG4BJMJW.js} +1 -1
- package/dist/chunks/{chunk-7HPVUVZB.js → chunk-HITD7CX6.js} +1 -1
- package/dist/chunks/{chunk-LIMZKONM.js → chunk-KK4GE65D.js} +2 -2
- package/dist/chunks/chunk-LAUYSGV4.js +3 -0
- package/dist/chunks/chunk-M6GDXKKS.js +2 -0
- package/dist/chunks/{chunk-QFULZNHL.js → chunk-PHHUHR7T.js} +1 -1
- package/dist/chunks/{chunk-ENL43FNO.js → chunk-WQPFDDIY.js} +2 -2
- package/dist/chunks/chunk-X2AWQSVS.js +2 -0
- package/dist/chunks/{chunk-ZRIM4R4A.js → chunk-ZRJQD7VS.js} +2 -2
- package/dist/data/grouping.d.ts +100 -0
- package/dist/data/grouping.js +264 -0
- 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 +138 -0
- package/dist/descriptive/dataFrames.js +400 -0
- 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 +42 -0
- package/dist/descriptive/missing.js +52 -0
- 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 +105 -0
- package/dist/descriptive/pivot.js +347 -0
- 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 +5 -1
- package/dist/entries/descriptive.js +4 -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 +19 -1
- package/dist/htest/ansariTest.js +5 -17
- 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 +31 -3
- package/dist/htest/cor.js +9 -27
- 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 +32 -2
- package/dist/htest/ksTest.js +5 -8
- 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 +45 -2
- package/dist/htest/onewayTest.js +15 -7
- 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 +132 -7
- package/dist/htest/rankTests.js +30 -33
- package/dist/htest/tTest.d.ts +32 -2
- package/dist/htest/tTest.js +19 -24
- package/dist/htest/testFormula.d.ts +57 -0
- package/dist/htest/testFormula.js +171 -0
- 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 +46 -6
- package/dist/htest/varTest.js +11 -21
- package/dist/htest/wilcoxTest.d.ts +23 -1
- package/dist/htest/wilcoxTest.js +9 -24
- 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 +168 -36
- package/dist/linalg/ops.js +116 -20
- 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/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 +12 -2
- 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/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 +75 -17
- package/dist/models/lm.js +22 -4
- package/dist/models/mauchly.d.ts +20 -5
- package/dist/models/mauchly.js +7 -3
- package/dist/models/modelFrame.d.ts +5 -1
- package/dist/models/modelMatrix.d.ts +18 -4
- package/dist/models/modelMatrix.js +3 -1
- 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 -13
- package/llms.txt +14 -0
- package/package.json +1 -1
- package/dist/chunks/chunk-AECGWZHD.js +0 -2
- package/dist/chunks/chunk-XWTZ4RTR.js +0 -2
package/dist/htest/pwr.d.ts
CHANGED
|
@@ -1,31 +1,74 @@
|
|
|
1
1
|
import type { Alternative } from "./types.js";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* An effect size: a number, or Cohen's conventional `"small"`, `"medium"` or `"large"`
|
|
4
|
+
*
|
|
5
|
+
* @category Effect sizes and power
|
|
6
|
+
*/
|
|
3
7
|
export type EffectSize = number | "small" | "medium" | "large";
|
|
4
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* The tests of {@link cohenES}
|
|
10
|
+
*
|
|
11
|
+
* @category Effect sizes and power
|
|
12
|
+
*/
|
|
5
13
|
export type CohenTest = "p" | "t" | "r" | "anov" | "chisq" | "f2";
|
|
6
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Result of {@link cohenES}.
|
|
16
|
+
*
|
|
17
|
+
* @category Effect sizes and power
|
|
18
|
+
*/
|
|
7
19
|
export interface CohenESResult {
|
|
20
|
+
/** The test. */
|
|
8
21
|
test: CohenTest;
|
|
22
|
+
/** The conventional size. */
|
|
9
23
|
size: "small" | "medium" | "large";
|
|
24
|
+
/** Cohen's effect size (R's `effect.size`). */
|
|
10
25
|
effectSize: number;
|
|
26
|
+
/** Description of the calculation. */
|
|
11
27
|
method: string;
|
|
12
28
|
}
|
|
13
29
|
/**
|
|
14
|
-
* Cohen's conventional effect sizes. Equivalent to pwr
|
|
30
|
+
* Cohen's conventional effect sizes. Equivalent to `pwr::cohen.ES(test, size)` in R.
|
|
15
31
|
*
|
|
16
32
|
* @example
|
|
17
33
|
* ```ts
|
|
18
34
|
* cohenES("anov", "medium").effectSize; // 0.25
|
|
19
35
|
* ```
|
|
36
|
+
*
|
|
37
|
+
* @category Effect sizes and power
|
|
20
38
|
*/
|
|
21
39
|
export declare function cohenES(test?: CohenTest | (string & {}), size?: "small" | "medium" | "large" | (string & {})): CohenESResult;
|
|
22
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* Effect size h of two proportions: `2 asin(sqrt(p1)) - 2 asin(sqrt(p2))`. Equivalent to `pwr::ES.h()` in R.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* esH(0.65, 0.45); // 0.40486007517695755
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @category Effect sizes and power
|
|
49
|
+
*/
|
|
23
50
|
export declare function esH(p1: number, p2: number): number;
|
|
24
|
-
/**
|
|
51
|
+
/**
|
|
52
|
+
* Effect size w of a goodness-of-fit test, `sqrt(sum((p1 - p0)^2 / p0))`. Equivalent to `pwr::ES.w1()` in R.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* esW1([0.25, 0.25, 0.25, 0.25], [0.4, 0.2, 0.2, 0.2]); // 0.34641016151377546
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @category Effect sizes and power
|
|
60
|
+
*/
|
|
25
61
|
export declare function esW1(p0: readonly number[], p1: readonly number[]): number;
|
|
26
62
|
/**
|
|
27
63
|
* Effect size w of a test of association, for a matrix of cell probabilities (an array of rows): with the row sums
|
|
28
|
-
* r and column sums c, `p0 = r c'` and `sqrt(sum((p - p0)^2 / p0))`. Equivalent to pwr
|
|
64
|
+
* r and column sums c, `p0 = r c'` and `sqrt(sum((p - p0)^2 / p0))`. Equivalent to `pwr::ES.w2()` in R.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* esW2([[0.3, 0.2], [0.1, 0.4]]); // 0.40824829046386296
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @category Effect sizes and power
|
|
29
72
|
*/
|
|
30
73
|
export declare function esW2(p: readonly (readonly number[])[]): number;
|
|
31
74
|
/** Common options of the pwr functions */
|
|
@@ -40,7 +83,11 @@ interface PwrAlternative extends PwrCommon {
|
|
|
40
83
|
/** `"two.sided"` (default), `"less"` or `"greater"`; unambiguous abbreviations are accepted. */
|
|
41
84
|
alternative?: Alternative | (string & {});
|
|
42
85
|
}
|
|
43
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Options for {@link pwrTTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
88
|
+
*
|
|
89
|
+
* @category Effect sizes and power
|
|
90
|
+
*/
|
|
44
91
|
export interface PwrTTestOptions extends PwrAlternative {
|
|
45
92
|
/** Number of observations (per group, or of pairs). */
|
|
46
93
|
n?: number | null;
|
|
@@ -49,28 +96,45 @@ export interface PwrTTestOptions extends PwrAlternative {
|
|
|
49
96
|
/** `"two.sample"` (default), `"one.sample"` or `"paired"`. */
|
|
50
97
|
type?: "two.sample" | "one.sample" | "paired" | (string & {});
|
|
51
98
|
}
|
|
52
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Result of {@link pwrTTest}.
|
|
101
|
+
*
|
|
102
|
+
* @category Effect sizes and power
|
|
103
|
+
*/
|
|
53
104
|
export interface PwrTTestResult {
|
|
105
|
+
/** Number of observations (per group, or of pairs). */
|
|
54
106
|
n: number;
|
|
107
|
+
/** Effect size d. */
|
|
55
108
|
d: number;
|
|
109
|
+
/** Significance level (R's `sig.level`). */
|
|
56
110
|
sigLevel: number;
|
|
111
|
+
/** Power of the test. */
|
|
57
112
|
power: number;
|
|
113
|
+
/** The alternative hypothesis. */
|
|
58
114
|
alternative: Alternative;
|
|
115
|
+
/** A note on the sample size. */
|
|
59
116
|
note?: string;
|
|
117
|
+
/** Description of the calculation. */
|
|
60
118
|
method: string;
|
|
61
119
|
}
|
|
62
120
|
/**
|
|
63
|
-
* Power of a t test of means, or the sample size, effect size or significance level for a given power.
|
|
64
|
-
* to
|
|
121
|
+
* Power of a t test of means, or the sample size, effect size or significance level for a given power.
|
|
122
|
+
* Equivalent to `pwr::pwr.t.test()` in R.
|
|
65
123
|
*
|
|
66
124
|
* @example
|
|
67
125
|
* ```ts
|
|
68
126
|
* pwrTTest({ n: 20, d: 0.5 }).power; // 0.3379390289250411
|
|
69
127
|
* pwrTTest({ d: 0.5, power: 0.8 }).n; // 63.76561044415068
|
|
70
128
|
* ```
|
|
129
|
+
*
|
|
130
|
+
* @category Effect sizes and power
|
|
71
131
|
*/
|
|
72
132
|
export declare function pwrTTest(options?: PwrTTestOptions): PwrTTestResult;
|
|
73
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Options for {@link pwrT2nTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
135
|
+
*
|
|
136
|
+
* @category Effect sizes and power
|
|
137
|
+
*/
|
|
74
138
|
export interface PwrT2nTestOptions extends PwrAlternative {
|
|
75
139
|
/** Number of observations in the first group. */
|
|
76
140
|
n1?: number | null;
|
|
@@ -79,70 +143,146 @@ export interface PwrT2nTestOptions extends PwrAlternative {
|
|
|
79
143
|
/** Effect size d, or `"small"`, `"medium"`, `"large"`. */
|
|
80
144
|
d?: EffectSize | null;
|
|
81
145
|
}
|
|
82
|
-
/**
|
|
146
|
+
/**
|
|
147
|
+
* Result of {@link pwrT2nTest}.
|
|
148
|
+
*
|
|
149
|
+
* @category Effect sizes and power
|
|
150
|
+
*/
|
|
83
151
|
export interface PwrT2nTestResult {
|
|
152
|
+
/** Number of observations in the first group. */
|
|
84
153
|
n1: number;
|
|
154
|
+
/** Number of observations in the second group. */
|
|
85
155
|
n2: number;
|
|
156
|
+
/** Effect size d. */
|
|
86
157
|
d: number;
|
|
158
|
+
/** Significance level (R's `sig.level`). */
|
|
87
159
|
sigLevel: number;
|
|
160
|
+
/** Power of the test. */
|
|
88
161
|
power: number;
|
|
162
|
+
/** The alternative hypothesis. */
|
|
89
163
|
alternative: Alternative;
|
|
164
|
+
/** Description of the calculation. */
|
|
90
165
|
method: string;
|
|
91
166
|
}
|
|
92
167
|
/**
|
|
93
168
|
* Power of a two-sample t test with unequal sample sizes, or a sample size, the effect size or the significance
|
|
94
|
-
* level for a given power. Equivalent to
|
|
169
|
+
* level for a given power. Equivalent to `pwr::pwr.t2n.test()` in R.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```ts
|
|
173
|
+
* pwrT2nTest({ n1: 20, n2: 30, d: 0.5 }).power; // 0.39656999440895696
|
|
174
|
+
* pwrT2nTest({ n1: 50, d: 0.5, power: 0.8 }).n2; // 87.70891347276086
|
|
175
|
+
* ```
|
|
176
|
+
*
|
|
177
|
+
* @category Effect sizes and power
|
|
95
178
|
*/
|
|
96
179
|
export declare function pwrT2nTest(options?: PwrT2nTestOptions): PwrT2nTestResult;
|
|
97
|
-
/**
|
|
180
|
+
/**
|
|
181
|
+
* Options for {@link pwr2pTest} and {@link pwrPTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
182
|
+
*
|
|
183
|
+
* @category Effect sizes and power
|
|
184
|
+
*/
|
|
98
185
|
export interface Pwr2pTestOptions extends PwrAlternative {
|
|
99
186
|
/** Effect size h ({@link esH}), or `"small"`, `"medium"`, `"large"`. */
|
|
100
187
|
h?: EffectSize | null;
|
|
101
188
|
/** Number of observations (per group for {@link pwr2pTest}). */
|
|
102
189
|
n?: number | null;
|
|
103
190
|
}
|
|
104
|
-
/**
|
|
191
|
+
/**
|
|
192
|
+
* Result of {@link pwr2pTest} and {@link pwrPTest}.
|
|
193
|
+
*
|
|
194
|
+
* @category Effect sizes and power
|
|
195
|
+
*/
|
|
105
196
|
export interface Pwr2pTestResult {
|
|
197
|
+
/** Effect size h. */
|
|
106
198
|
h: number;
|
|
199
|
+
/** Number of observations (per group for {@link pwr2pTest}). */
|
|
107
200
|
n: number;
|
|
201
|
+
/** Significance level (R's `sig.level`). */
|
|
108
202
|
sigLevel: number;
|
|
203
|
+
/** Power of the test. */
|
|
109
204
|
power: number;
|
|
205
|
+
/** The alternative hypothesis. */
|
|
110
206
|
alternative: Alternative;
|
|
207
|
+
/** Description of the calculation. */
|
|
111
208
|
method: string;
|
|
209
|
+
/** A note on the sample sizes (absent for {@link pwrPTest}). */
|
|
112
210
|
note?: string;
|
|
113
211
|
}
|
|
114
212
|
/**
|
|
115
213
|
* Power of the test of two proportions with equal sample sizes (arcsine transformation), or the effect size, sample
|
|
116
|
-
* size or significance level for a given power. Equivalent to
|
|
214
|
+
* size or significance level for a given power. Equivalent to `pwr::pwr.2p.test()` in R.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```ts
|
|
218
|
+
* pwr2pTest({ h: 0.3, n: 80 }).power; // 0.47510087057263806
|
|
219
|
+
* pwr2pTest({ h: esH(0.65, 0.45), power: 0.8 }).n; // 95.76938656160651
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* @category Effect sizes and power
|
|
117
223
|
*/
|
|
118
224
|
export declare function pwr2pTest(options?: Pwr2pTestOptions): Pwr2pTestResult;
|
|
119
225
|
/**
|
|
120
226
|
* Power of the test of one proportion (arcsine transformation), or the effect size, sample size or significance
|
|
121
|
-
* level for a given power. Equivalent to
|
|
227
|
+
* level for a given power. Equivalent to `pwr::pwr.p.test()` in R.
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```ts
|
|
231
|
+
* pwrPTest({ h: 0.2, n: 60 }).power; // 0.34084512406749834
|
|
232
|
+
* pwrPTest({ h: 0.2, power: 0.8 }).n; // 196.221512550509
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* @category Effect sizes and power
|
|
122
236
|
*/
|
|
123
237
|
export declare function pwrPTest(options?: Pwr2pTestOptions): Pwr2pTestResult;
|
|
124
|
-
/**
|
|
238
|
+
/**
|
|
239
|
+
* Options for {@link pwrNormTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
240
|
+
*
|
|
241
|
+
* @category Effect sizes and power
|
|
242
|
+
*/
|
|
125
243
|
export interface PwrNormTestOptions extends PwrAlternative {
|
|
126
244
|
/** Effect size d (difference of means over the known standard deviation), or `"small"`, `"medium"`, `"large"`. */
|
|
127
245
|
d?: EffectSize | null;
|
|
128
246
|
/** Number of observations. */
|
|
129
247
|
n?: number | null;
|
|
130
248
|
}
|
|
131
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* Result of {@link pwrNormTest}.
|
|
251
|
+
*
|
|
252
|
+
* @category Effect sizes and power
|
|
253
|
+
*/
|
|
132
254
|
export interface PwrNormTestResult {
|
|
255
|
+
/** Effect size d. */
|
|
133
256
|
d: number;
|
|
257
|
+
/** Number of observations. */
|
|
134
258
|
n: number;
|
|
259
|
+
/** Significance level (R's `sig.level`). */
|
|
135
260
|
sigLevel: number;
|
|
261
|
+
/** Power of the test. */
|
|
136
262
|
power: number;
|
|
263
|
+
/** The alternative hypothesis. */
|
|
137
264
|
alternative: Alternative;
|
|
265
|
+
/** Description of the calculation. */
|
|
138
266
|
method: string;
|
|
139
267
|
}
|
|
140
268
|
/**
|
|
141
269
|
* Power of the test of a mean of a normal distribution with known variance, or the effect size, sample size or
|
|
142
|
-
* significance level for a given power. Equivalent to
|
|
270
|
+
* significance level for a given power. Equivalent to `pwr::pwr.norm.test()` in R.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```ts
|
|
274
|
+
* pwrNormTest({ d: 0.3, n: 50 }).power; // 0.5641160254310038
|
|
275
|
+
* pwrNormTest({ d: 0.3, power: 0.8 }).n; // 87.20953791564195
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @category Effect sizes and power
|
|
143
279
|
*/
|
|
144
280
|
export declare function pwrNormTest(options?: PwrNormTestOptions): PwrNormTestResult;
|
|
145
|
-
/**
|
|
281
|
+
/**
|
|
282
|
+
* Options for {@link pwr2p2nTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
283
|
+
*
|
|
284
|
+
* @category Effect sizes and power
|
|
285
|
+
*/
|
|
146
286
|
export interface Pwr2p2nTestOptions extends PwrAlternative {
|
|
147
287
|
/** Effect size h ({@link esH}), or `"small"`, `"medium"`, `"large"`. */
|
|
148
288
|
h?: EffectSize | null;
|
|
@@ -151,45 +291,91 @@ export interface Pwr2p2nTestOptions extends PwrAlternative {
|
|
|
151
291
|
/** Number of observations in the second group. */
|
|
152
292
|
n2?: number | null;
|
|
153
293
|
}
|
|
154
|
-
/**
|
|
294
|
+
/**
|
|
295
|
+
* Result of {@link pwr2p2nTest}.
|
|
296
|
+
*
|
|
297
|
+
* @category Effect sizes and power
|
|
298
|
+
*/
|
|
155
299
|
export interface Pwr2p2nTestResult {
|
|
300
|
+
/** Effect size h. */
|
|
156
301
|
h: number;
|
|
302
|
+
/** Number of observations in the first group. */
|
|
157
303
|
n1: number;
|
|
304
|
+
/** Number of observations in the second group. */
|
|
158
305
|
n2: number;
|
|
306
|
+
/** Significance level (R's `sig.level`). */
|
|
159
307
|
sigLevel: number;
|
|
308
|
+
/** Power of the test. */
|
|
160
309
|
power: number;
|
|
310
|
+
/** The alternative hypothesis. */
|
|
161
311
|
alternative: Alternative;
|
|
312
|
+
/** Description of the calculation. */
|
|
162
313
|
method: string;
|
|
314
|
+
/** A note on the sample sizes. */
|
|
163
315
|
note: string;
|
|
164
316
|
}
|
|
165
317
|
/**
|
|
166
318
|
* Power of the test of two proportions with unequal sample sizes (arcsine transformation), or the effect size, a
|
|
167
|
-
* sample size or the significance level for a given power. Equivalent to
|
|
319
|
+
* sample size or the significance level for a given power. Equivalent to `pwr::pwr.2p2n.test()` in R.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* pwr2p2nTest({ h: 0.3, n1: 80, n2: 120 }).power; // 0.5471899635264242
|
|
324
|
+
* pwr2p2nTest({ h: 0.3, n1: 200, power: 0.8 }).n2; // 154.6399892648981
|
|
325
|
+
* ```
|
|
326
|
+
*
|
|
327
|
+
* @category Effect sizes and power
|
|
168
328
|
*/
|
|
169
329
|
export declare function pwr2p2nTest(options?: Pwr2p2nTestOptions): Pwr2p2nTestResult;
|
|
170
|
-
/**
|
|
330
|
+
/**
|
|
331
|
+
* Options for {@link pwrRTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
332
|
+
*
|
|
333
|
+
* @category Effect sizes and power
|
|
334
|
+
*/
|
|
171
335
|
export interface PwrRTestOptions extends PwrAlternative {
|
|
172
336
|
/** Number of observations. */
|
|
173
337
|
n?: number | null;
|
|
174
338
|
/** Correlation, or `"small"`, `"medium"`, `"large"`. */
|
|
175
339
|
r?: EffectSize | null;
|
|
176
340
|
}
|
|
177
|
-
/**
|
|
341
|
+
/**
|
|
342
|
+
* Result of {@link pwrRTest}.
|
|
343
|
+
*
|
|
344
|
+
* @category Effect sizes and power
|
|
345
|
+
*/
|
|
178
346
|
export interface PwrRTestResult {
|
|
347
|
+
/** Number of observations. */
|
|
179
348
|
n: number;
|
|
349
|
+
/** Correlation. */
|
|
180
350
|
r: number;
|
|
351
|
+
/** Significance level (R's `sig.level`). */
|
|
181
352
|
sigLevel: number;
|
|
353
|
+
/** Power of the test. */
|
|
182
354
|
power: number;
|
|
355
|
+
/** The alternative hypothesis. */
|
|
183
356
|
alternative: Alternative;
|
|
357
|
+
/** Description of the calculation. */
|
|
184
358
|
method: string;
|
|
185
359
|
}
|
|
186
360
|
/**
|
|
187
361
|
* Power of the test of a correlation (Fisher's z transformation), or the sample size, correlation or significance
|
|
188
|
-
* level for a given power. Equivalent to
|
|
362
|
+
* level for a given power. Equivalent to `pwr::pwr.r.test()` in R. As in pwr, the power computed for `"less"` reports
|
|
189
363
|
* `r` negated.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* pwrRTest({ n: 50, r: 0.3 }).power; // 0.571555841860208
|
|
368
|
+
* pwrRTest({ r: 0.3, power: 0.8 }).n; // 84.07363978228769
|
|
369
|
+
* ```
|
|
370
|
+
*
|
|
371
|
+
* @category Effect sizes and power
|
|
190
372
|
*/
|
|
191
373
|
export declare function pwrRTest(options?: PwrRTestOptions): PwrRTestResult;
|
|
192
|
-
/**
|
|
374
|
+
/**
|
|
375
|
+
* Options for {@link pwrChisqTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
376
|
+
*
|
|
377
|
+
* @category Effect sizes and power
|
|
378
|
+
*/
|
|
193
379
|
export interface PwrChisqTestOptions extends PwrCommon {
|
|
194
380
|
/** Effect size w ({@link esW1}, {@link esW2}), or `"small"`, `"medium"`, `"large"`. */
|
|
195
381
|
w?: EffectSize | null;
|
|
@@ -198,22 +384,45 @@ export interface PwrChisqTestOptions extends PwrCommon {
|
|
|
198
384
|
/** Degrees of freedom. */
|
|
199
385
|
df: number;
|
|
200
386
|
}
|
|
201
|
-
/**
|
|
387
|
+
/**
|
|
388
|
+
* Result of {@link pwrChisqTest}.
|
|
389
|
+
*
|
|
390
|
+
* @category Effect sizes and power
|
|
391
|
+
*/
|
|
202
392
|
export interface PwrChisqTestResult {
|
|
393
|
+
/** Effect size w. */
|
|
203
394
|
w: number;
|
|
395
|
+
/** Total number of observations. */
|
|
204
396
|
N: number;
|
|
397
|
+
/** Degrees of freedom. */
|
|
205
398
|
df: number;
|
|
399
|
+
/** Significance level (R's `sig.level`). */
|
|
206
400
|
sigLevel: number;
|
|
401
|
+
/** Power of the test. */
|
|
207
402
|
power: number;
|
|
403
|
+
/** Description of the calculation. */
|
|
208
404
|
method: string;
|
|
405
|
+
/** A note on the sample size. */
|
|
209
406
|
note: string;
|
|
210
407
|
}
|
|
211
408
|
/**
|
|
212
409
|
* Power of a chi-squared test, or the effect size, number of observations or significance level for a given power.
|
|
213
|
-
* Equivalent to
|
|
410
|
+
* Equivalent to `pwr::pwr.chisq.test()` in R.
|
|
411
|
+
*
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* pwrChisqTest({ w: 0.3, N: 100, df: 3 }).power; // 0.7112535997950422
|
|
415
|
+
* pwrChisqTest({ w: 0.3, df: 3, power: 0.8 }).N; // 121.13959310294602
|
|
416
|
+
* ```
|
|
417
|
+
*
|
|
418
|
+
* @category Effect sizes and power
|
|
214
419
|
*/
|
|
215
420
|
export declare function pwrChisqTest(options: PwrChisqTestOptions): PwrChisqTestResult;
|
|
216
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* Options for {@link pwrAnovaTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
423
|
+
*
|
|
424
|
+
* @category Effect sizes and power
|
|
425
|
+
*/
|
|
217
426
|
export interface PwrAnovaTestOptions extends PwrCommon {
|
|
218
427
|
/** Number of groups. */
|
|
219
428
|
k?: number | null;
|
|
@@ -222,22 +431,45 @@ export interface PwrAnovaTestOptions extends PwrCommon {
|
|
|
222
431
|
/** Effect size f, or `"small"`, `"medium"`, `"large"`. */
|
|
223
432
|
f?: EffectSize | null;
|
|
224
433
|
}
|
|
225
|
-
/**
|
|
434
|
+
/**
|
|
435
|
+
* Result of {@link pwrAnovaTest}.
|
|
436
|
+
*
|
|
437
|
+
* @category Effect sizes and power
|
|
438
|
+
*/
|
|
226
439
|
export interface PwrAnovaTestResult {
|
|
440
|
+
/** Number of groups. */
|
|
227
441
|
k: number;
|
|
442
|
+
/** Number of observations per group. */
|
|
228
443
|
n: number;
|
|
444
|
+
/** Effect size f. */
|
|
229
445
|
f: number;
|
|
446
|
+
/** Significance level (R's `sig.level`). */
|
|
230
447
|
sigLevel: number;
|
|
448
|
+
/** Power of the test. */
|
|
231
449
|
power: number;
|
|
450
|
+
/** A note on the sample size. */
|
|
232
451
|
note: string;
|
|
452
|
+
/** Description of the calculation. */
|
|
233
453
|
method: string;
|
|
234
454
|
}
|
|
235
455
|
/**
|
|
236
456
|
* Power of the F test of a balanced one-way analysis of variance, or the number of groups, sample size, effect size
|
|
237
|
-
* or significance level for a given power. Equivalent to
|
|
457
|
+
* or significance level for a given power. Equivalent to `pwr::pwr.anova.test()` in R.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```ts
|
|
461
|
+
* pwrAnovaTest({ k: 4, n: 20, f: 0.25 }).power; // 0.42039009037704295
|
|
462
|
+
* pwrAnovaTest({ k: 4, f: 0.25, power: 0.8 }).n; // 44.59927432039623
|
|
463
|
+
* ```
|
|
464
|
+
*
|
|
465
|
+
* @category Effect sizes and power
|
|
238
466
|
*/
|
|
239
467
|
export declare function pwrAnovaTest(options?: PwrAnovaTestOptions): PwrAnovaTestResult;
|
|
240
|
-
/**
|
|
468
|
+
/**
|
|
469
|
+
* Options for {@link pwrF2Test}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for.
|
|
470
|
+
*
|
|
471
|
+
* @category Effect sizes and power
|
|
472
|
+
*/
|
|
241
473
|
export interface PwrF2TestOptions extends PwrCommon {
|
|
242
474
|
/** Degrees of freedom of the numerator. */
|
|
243
475
|
u?: number | null;
|
|
@@ -246,18 +478,36 @@ export interface PwrF2TestOptions extends PwrCommon {
|
|
|
246
478
|
/** Effect size f², or `"small"`, `"medium"`, `"large"`. */
|
|
247
479
|
f2?: EffectSize | null;
|
|
248
480
|
}
|
|
249
|
-
/**
|
|
481
|
+
/**
|
|
482
|
+
* Result of {@link pwrF2Test}.
|
|
483
|
+
*
|
|
484
|
+
* @category Effect sizes and power
|
|
485
|
+
*/
|
|
250
486
|
export interface PwrF2TestResult {
|
|
487
|
+
/** Degrees of freedom of the numerator. */
|
|
251
488
|
u: number;
|
|
489
|
+
/** Degrees of freedom of the denominator. */
|
|
252
490
|
v: number;
|
|
491
|
+
/** Effect size f². */
|
|
253
492
|
f2: number;
|
|
493
|
+
/** Significance level (R's `sig.level`). */
|
|
254
494
|
sigLevel: number;
|
|
495
|
+
/** Power of the test. */
|
|
255
496
|
power: number;
|
|
497
|
+
/** Description of the calculation. */
|
|
256
498
|
method: string;
|
|
257
499
|
}
|
|
258
500
|
/**
|
|
259
501
|
* Power of the F test of a general linear model, or the degrees of freedom, effect size or significance level for a
|
|
260
|
-
* given power. Equivalent to
|
|
502
|
+
* given power. Equivalent to `pwr::pwr.f2.test()` in R.
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```ts
|
|
506
|
+
* pwrF2Test({ u: 3, v: 60, f2: 0.15 }).power; // 0.7109605416866717
|
|
507
|
+
* pwrF2Test({ u: 3, f2: 0.15, power: 0.8 }).v; // 72.70582657950871
|
|
508
|
+
* ```
|
|
509
|
+
*
|
|
510
|
+
* @category Effect sizes and power
|
|
261
511
|
*/
|
|
262
512
|
export declare function pwrF2Test(options?: PwrF2TestOptions): PwrF2TestResult;
|
|
263
513
|
export {};
|