@numero-uno-jpn/rstats 0.10.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (280) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.ja.md +13 -9
  3. package/README.md +13 -8
  4. package/dist/chunks/{chunk-QJJWGNJP.js → chunk-2X7JYQBI.js} +2 -2
  5. package/dist/chunks/{chunk-O6PT7IVU.js → chunk-36GVER3O.js} +2 -2
  6. package/dist/chunks/{chunk-EWC6I75B.js → chunk-3WUXRSM6.js} +1 -1
  7. package/dist/chunks/{chunk-4NM37MGA.js → chunk-6I6QKTFK.js} +2 -2
  8. package/dist/chunks/{chunk-2XKG3DX4.js → chunk-ETOEZTGL.js} +1 -1
  9. package/dist/chunks/{chunk-IT354SHV.js → chunk-FVPDVRJQ.js} +2 -2
  10. package/dist/chunks/{chunk-QULPY6YM.js → chunk-GG4BJMJW.js} +1 -1
  11. package/dist/chunks/{chunk-7HPVUVZB.js → chunk-HITD7CX6.js} +1 -1
  12. package/dist/chunks/{chunk-LIMZKONM.js → chunk-KK4GE65D.js} +2 -2
  13. package/dist/chunks/chunk-LAUYSGV4.js +3 -0
  14. package/dist/chunks/chunk-M6GDXKKS.js +2 -0
  15. package/dist/chunks/{chunk-QFULZNHL.js → chunk-PHHUHR7T.js} +1 -1
  16. package/dist/chunks/{chunk-ENL43FNO.js → chunk-WQPFDDIY.js} +2 -2
  17. package/dist/chunks/chunk-X2AWQSVS.js +2 -0
  18. package/dist/chunks/{chunk-ZRIM4R4A.js → chunk-ZRJQD7VS.js} +2 -2
  19. package/dist/data/grouping.d.ts +100 -0
  20. package/dist/data/grouping.js +264 -0
  21. package/dist/descriptive/basic.d.ts +130 -17
  22. package/dist/descriptive/basic.js +115 -14
  23. package/dist/descriptive/cov.d.ts +22 -12
  24. package/dist/descriptive/dataFrames.d.ts +138 -0
  25. package/dist/descriptive/dataFrames.js +400 -0
  26. package/dist/descriptive/factanal.d.ts +26 -6
  27. package/dist/descriptive/factanal.js +7 -3
  28. package/dist/descriptive/hist.d.ts +27 -6
  29. package/dist/descriptive/hist.js +9 -3
  30. package/dist/descriptive/missing.d.ts +42 -0
  31. package/dist/descriptive/missing.js +52 -0
  32. package/dist/descriptive/moments.d.ts +91 -13
  33. package/dist/descriptive/moments.js +66 -9
  34. package/dist/descriptive/omega.d.ts +28 -6
  35. package/dist/descriptive/omega.js +16 -4
  36. package/dist/descriptive/pivot.d.ts +105 -0
  37. package/dist/descriptive/pivot.js +347 -0
  38. package/dist/descriptive/quantile.d.ts +33 -5
  39. package/dist/descriptive/quantile.js +20 -2
  40. package/dist/descriptive/rank.d.ts +12 -2
  41. package/dist/descriptive/rank.js +2 -0
  42. package/dist/descriptive/table.d.ts +55 -7
  43. package/dist/descriptive/table.js +38 -4
  44. package/dist/descriptive.js +2 -2
  45. package/dist/distributions/arcsine.d.ts +40 -5
  46. package/dist/distributions/arcsine.js +35 -4
  47. package/dist/distributions/beta.d.ts +12 -0
  48. package/dist/distributions/beta.js +12 -0
  49. package/dist/distributions/binomial.d.ts +18 -0
  50. package/dist/distributions/binomial.js +18 -0
  51. package/dist/distributions/bvnorm.d.ts +4 -1
  52. package/dist/distributions/bvnorm.js +4 -1
  53. package/dist/distributions/cauchy.d.ts +24 -0
  54. package/dist/distributions/cauchy.js +24 -0
  55. package/dist/distributions/chisq.d.ts +18 -0
  56. package/dist/distributions/chisq.js +18 -0
  57. package/dist/distributions/exponential.d.ts +29 -1
  58. package/dist/distributions/exponential.js +24 -0
  59. package/dist/distributions/f.d.ts +18 -0
  60. package/dist/distributions/f.js +18 -0
  61. package/dist/distributions/gamma.d.ts +20 -0
  62. package/dist/distributions/gamma.js +18 -0
  63. package/dist/distributions/geometric.d.ts +24 -0
  64. package/dist/distributions/geometric.js +24 -0
  65. package/dist/distributions/hypergeometric.d.ts +24 -0
  66. package/dist/distributions/hypergeometric.js +24 -0
  67. package/dist/distributions/invgamma.d.ts +32 -4
  68. package/dist/distributions/invgamma.js +27 -3
  69. package/dist/distributions/kumaraswamy.d.ts +31 -3
  70. package/dist/distributions/kumaraswamy.js +31 -3
  71. package/dist/distributions/laplace.d.ts +36 -4
  72. package/dist/distributions/laplace.js +31 -3
  73. package/dist/distributions/logistic.d.ts +29 -1
  74. package/dist/distributions/logistic.js +24 -0
  75. package/dist/distributions/lognormal.d.ts +29 -1
  76. package/dist/distributions/lognormal.js +24 -0
  77. package/dist/distributions/multinomial.d.ts +7 -1
  78. package/dist/distributions/multinomial.js +2 -0
  79. package/dist/distributions/negbinomial.d.ts +29 -1
  80. package/dist/distributions/negbinomial.js +24 -0
  81. package/dist/distributions/normal.d.ts +11 -1
  82. package/dist/distributions/normal.js +6 -0
  83. package/dist/distributions/pareto.d.ts +36 -4
  84. package/dist/distributions/pareto.js +31 -3
  85. package/dist/distributions/poisson.d.ts +18 -0
  86. package/dist/distributions/poisson.js +18 -0
  87. package/dist/distributions/signrank.d.ts +24 -0
  88. package/dist/distributions/signrank.js +24 -0
  89. package/dist/distributions/summary.d.ts +20 -2
  90. package/dist/distributions/summary.js +4 -0
  91. package/dist/distributions/t.d.ts +18 -0
  92. package/dist/distributions/t.js +18 -0
  93. package/dist/distributions/triangular.d.ts +36 -4
  94. package/dist/distributions/triangular.js +31 -3
  95. package/dist/distributions/tukey.d.ts +15 -1
  96. package/dist/distributions/tukey.js +10 -0
  97. package/dist/distributions/uniform.d.ts +29 -1
  98. package/dist/distributions/uniform.js +24 -0
  99. package/dist/distributions/weibull.d.ts +29 -1
  100. package/dist/distributions/weibull.js +24 -0
  101. package/dist/distributions/wilcox.d.ts +24 -0
  102. package/dist/distributions/wilcox.js +24 -0
  103. package/dist/distributions.js +2 -2
  104. package/dist/entries/descriptive.d.ts +5 -1
  105. package/dist/entries/descriptive.js +4 -0
  106. package/dist/entries/numerics.d.ts +1 -1
  107. package/dist/entries/tests.js +1 -1
  108. package/dist/htest/agreement.d.ts +61 -23
  109. package/dist/htest/agreement.js +19 -9
  110. package/dist/htest/ansariTest.d.ts +19 -1
  111. package/dist/htest/ansariTest.js +5 -17
  112. package/dist/htest/aov.d.ts +43 -10
  113. package/dist/htest/aov.js +17 -3
  114. package/dist/htest/binomTest.d.ts +12 -2
  115. package/dist/htest/binomTest.js +2 -0
  116. package/dist/htest/brunnerMunzelTest.d.ts +9 -3
  117. package/dist/htest/brunnerMunzelTest.js +4 -2
  118. package/dist/htest/chisqTest.d.ts +19 -3
  119. package/dist/htest/cor.d.ts +31 -3
  120. package/dist/htest/cor.js +9 -27
  121. package/dist/htest/effectSize.d.ts +70 -12
  122. package/dist/htest/effectSize.js +40 -7
  123. package/dist/htest/fisherTest.d.ts +9 -1
  124. package/dist/htest/fisherTest.js +2 -0
  125. package/dist/htest/groups.d.ts +5 -1
  126. package/dist/htest/ksTest.d.ts +32 -2
  127. package/dist/htest/ksTest.js +5 -8
  128. package/dist/htest/leveneTest.d.ts +15 -4
  129. package/dist/htest/leveneTest.js +5 -2
  130. package/dist/htest/mantelhaenTest.d.ts +25 -3
  131. package/dist/htest/mantelhaenTest.js +15 -1
  132. package/dist/htest/mcnemarTest.d.ts +14 -4
  133. package/dist/htest/mcnemarTest.js +4 -2
  134. package/dist/htest/multipleComparisons.d.ts +173 -29
  135. package/dist/htest/multipleComparisons.js +123 -19
  136. package/dist/htest/normalityTests.d.ts +56 -9
  137. package/dist/htest/normalityTests.js +40 -6
  138. package/dist/htest/onewayTest.d.ts +45 -2
  139. package/dist/htest/onewayTest.js +15 -7
  140. package/dist/htest/pAdjust.d.ts +9 -1
  141. package/dist/htest/pAdjust.js +2 -0
  142. package/dist/htest/pairwise.d.ts +50 -5
  143. package/dist/htest/pairwise.js +25 -0
  144. package/dist/htest/poissonTest.d.ts +12 -2
  145. package/dist/htest/poissonTest.js +2 -0
  146. package/dist/htest/polycor.d.ts +29 -10
  147. package/dist/htest/power.d.ts +60 -6
  148. package/dist/htest/power.js +6 -0
  149. package/dist/htest/propTest.d.ts +13 -2
  150. package/dist/htest/propTest.js +2 -0
  151. package/dist/htest/pwr.d.ts +286 -36
  152. package/dist/htest/pwr.js +116 -15
  153. package/dist/htest/rankTests.d.ts +132 -7
  154. package/dist/htest/rankTests.js +30 -33
  155. package/dist/htest/tTest.d.ts +32 -2
  156. package/dist/htest/tTest.js +19 -24
  157. package/dist/htest/testFormula.d.ts +57 -0
  158. package/dist/htest/testFormula.js +171 -0
  159. package/dist/htest/trendTests.d.ts +29 -8
  160. package/dist/htest/trendTests.js +8 -4
  161. package/dist/htest/types.d.ts +14 -2
  162. package/dist/htest/varTest.d.ts +46 -6
  163. package/dist/htest/varTest.js +11 -21
  164. package/dist/htest/wilcoxTest.d.ts +23 -1
  165. package/dist/htest/wilcoxTest.js +9 -24
  166. package/dist/internal/dpq.d.ts +4 -0
  167. package/dist/internal/noncentral.d.ts +2 -0
  168. package/dist/internal/vectorize.d.ts +4 -0
  169. package/dist/linalg/basic.d.ts +39 -5
  170. package/dist/linalg/basic.js +15 -0
  171. package/dist/linalg/chol.d.ts +26 -5
  172. package/dist/linalg/chol.js +7 -0
  173. package/dist/linalg/eigen.d.ts +16 -7
  174. package/dist/linalg/eigen.js +6 -5
  175. package/dist/linalg/expm.d.ts +15 -5
  176. package/dist/linalg/expm.js +5 -3
  177. package/dist/linalg/kappa.d.ts +21 -1
  178. package/dist/linalg/kappa.js +16 -0
  179. package/dist/linalg/lu.d.ts +30 -6
  180. package/dist/linalg/lu.js +15 -3
  181. package/dist/linalg/matrix.d.ts +4 -0
  182. package/dist/linalg/norm.d.ts +16 -1
  183. package/dist/linalg/norm.js +9 -0
  184. package/dist/linalg/ops.d.ts +168 -36
  185. package/dist/linalg/ops.js +116 -20
  186. package/dist/linalg/qr.d.ts +87 -12
  187. package/dist/linalg/qr.js +31 -0
  188. package/dist/linalg/schur.d.ts +8 -2
  189. package/dist/linalg/schur.js +3 -1
  190. package/dist/linalg/solve.d.ts +42 -6
  191. package/dist/linalg/solve.js +22 -0
  192. package/dist/linalg/svd.d.ts +12 -2
  193. package/dist/linalg/svd.js +2 -0
  194. package/dist/linalg.js +2 -2
  195. package/dist/models/anovaSequential.d.ts +26 -4
  196. package/dist/models/anovaSequential.js +3 -1
  197. package/dist/models/aovEz.d.ts +29 -6
  198. package/dist/models/aovEz.js +5 -2
  199. package/dist/models/aovStrata.d.ts +12 -2
  200. package/dist/models/carAnova.d.ts +9 -3
  201. package/dist/models/carAnova.js +4 -2
  202. package/dist/models/coxph.d.ts +33 -7
  203. package/dist/models/coxph.js +8 -3
  204. package/dist/models/glm.d.ts +128 -21
  205. package/dist/models/glm.js +71 -14
  206. package/dist/models/glmAnova.d.ts +30 -5
  207. package/dist/models/glmAnova.js +15 -2
  208. package/dist/models/glmConfint.d.ts +16 -2
  209. package/dist/models/glmConfint.js +9 -1
  210. package/dist/models/glmFamily.d.ts +27 -5
  211. package/dist/models/lm.d.ts +75 -17
  212. package/dist/models/lm.js +22 -4
  213. package/dist/models/mauchly.d.ts +20 -5
  214. package/dist/models/mauchly.js +7 -3
  215. package/dist/models/modelFrame.d.ts +5 -1
  216. package/dist/models/modelMatrix.d.ts +18 -4
  217. package/dist/models/modelMatrix.js +3 -1
  218. package/dist/models/survival.d.ts +41 -9
  219. package/dist/models/survival.js +10 -4
  220. package/dist/numerics/deriv.d.ts +21 -6
  221. package/dist/numerics/deriv.js +16 -5
  222. package/dist/numerics/integrate.d.ts +37 -7
  223. package/dist/numerics/integrate.js +8 -2
  224. package/dist/numerics/interp.d.ts +63 -12
  225. package/dist/numerics/interp.js +30 -6
  226. package/dist/numerics/ode.d.ts +15 -5
  227. package/dist/numerics/ode.js +5 -3
  228. package/dist/numerics.js +2 -2
  229. package/dist/optim/optim.d.ts +32 -8
  230. package/dist/optim/optim.js +8 -4
  231. package/dist/random/beta.d.ts +8 -0
  232. package/dist/random/beta.js +8 -0
  233. package/dist/random/binomial.d.ts +16 -0
  234. package/dist/random/binomial.js +16 -0
  235. package/dist/random/continuous.d.ts +51 -0
  236. package/dist/random/continuous.js +51 -0
  237. package/dist/random/extra.d.ts +66 -6
  238. package/dist/random/extra.js +66 -6
  239. package/dist/random/gamma.d.ts +33 -0
  240. package/dist/random/gamma.js +33 -0
  241. package/dist/random/hyper.d.ts +8 -0
  242. package/dist/random/hyper.js +8 -0
  243. package/dist/random/poisson.d.ts +25 -0
  244. package/dist/random/poisson.js +25 -0
  245. package/dist/random/r2dtable.d.ts +2 -0
  246. package/dist/random/r2dtable.js +2 -0
  247. package/dist/random/rank.d.ts +16 -0
  248. package/dist/random/rank.js +16 -0
  249. package/dist/random/rng.d.ts +49 -6
  250. package/dist/random/rng.js +29 -2
  251. package/dist/random/sample.d.ts +10 -2
  252. package/dist/random/sample.js +5 -1
  253. package/dist/random/streams.d.ts +13 -0
  254. package/dist/random/streams.js +13 -0
  255. package/dist/rstats.js +14 -14
  256. package/dist/special/besselIK.d.ts +11 -3
  257. package/dist/special/besselIK.js +6 -2
  258. package/dist/special/besselJY.d.ts +6 -2
  259. package/dist/special/besselJY.js +6 -2
  260. package/dist/special/beta.d.ts +16 -2
  261. package/dist/special/beta.js +16 -2
  262. package/dist/special/choose.d.ts +13 -5
  263. package/dist/special/choose.js +13 -5
  264. package/dist/special/erf.d.ts +8 -3
  265. package/dist/special/erf.js +8 -3
  266. package/dist/special/extra.d.ts +30 -10
  267. package/dist/special/extra.js +25 -9
  268. package/dist/special/gamma.d.ts +18 -2
  269. package/dist/special/gamma.js +18 -2
  270. package/dist/special/log1p.d.ts +16 -7
  271. package/dist/special/log1p.js +16 -7
  272. package/dist/special/psigamma.d.ts +9 -3
  273. package/dist/special/psigamma.js +9 -3
  274. package/dist/special/rCompatible.d.ts +5 -1
  275. package/dist/special.js +2 -2
  276. package/dist/tests.js +12 -13
  277. package/llms.txt +14 -0
  278. package/package.json +1 -1
  279. package/dist/chunks/chunk-AECGWZHD.js +0 -2
  280. package/dist/chunks/chunk-XWTZ4RTR.js +0 -2
@@ -1,31 +1,74 @@
1
1
  import type { Alternative } from "./types.js";
2
- /** An effect size: a number, or Cohen's conventional `"small"`, `"medium"` or `"large"` */
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
- /** The tests of {@link cohenES} */
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
- /** Result of {@link cohenES}. */
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's `cohen.ES(test, size)`.
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
- /** Effect size h of two proportions: `2 asin(sqrt(p1)) - 2 asin(sqrt(p2))`. Equivalent to pwr's `ES.h`. */
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
- /** Effect size w of a goodness-of-fit test, `sqrt(sum((p1 - p0)^2 / p0))`. Equivalent to pwr's `ES.w1`. */
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's `ES.w2`.
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
- /** Options for {@link pwrTTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwrTTest}. */
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. Equivalent
64
- * to pwr's `pwr.t.test()`.
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
- /** Options for {@link pwrT2nTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwrT2nTest}. */
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 pwr's `pwr.t2n.test()`.
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
- /** Options for {@link pwr2pTest} and {@link pwrPTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwr2pTest} and {@link pwrPTest}. */
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 pwr's `pwr.2p.test()`.
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 pwr's `pwr.p.test()`.
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
- /** Options for {@link pwrNormTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwrNormTest}. */
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 pwr's `pwr.norm.test()`.
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
- /** Options for {@link pwr2p2nTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwr2p2nTest}. */
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 pwr's `pwr.2p2n.test()`.
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
- /** Options for {@link pwrRTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwrRTest}. */
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 pwr's `pwr.r.test()`. As in pwr, the power computed for `"less"` reports
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
- /** Options for {@link pwrChisqTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwrChisqTest}. */
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 pwr's `pwr.chisq.test()`.
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
- /** Options for {@link pwrAnovaTest}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwrAnovaTest}. */
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 pwr's `pwr.anova.test()`.
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
- /** Options for {@link pwrF2Test}. The quantity given as `null` (or omitted, except `sigLevel`) is solved for. */
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
- /** Result of {@link pwrF2Test}. */
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 pwr's `pwr.f2.test()`.
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 {};