@numero-uno-jpn/rstats 0.11.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 (269) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.ja.md +5 -4
  3. package/README.md +6 -4
  4. package/dist/chunks/{chunk-YSWGDOWK.js → chunk-2X7JYQBI.js} +2 -2
  5. package/dist/chunks/{chunk-F5EDJFEO.js → chunk-36GVER3O.js} +2 -2
  6. package/dist/chunks/{chunk-7GQMKH3Z.js → chunk-3WUXRSM6.js} +1 -1
  7. package/dist/chunks/{chunk-JWBO5WVN.js → chunk-6I6QKTFK.js} +2 -2
  8. package/dist/chunks/{chunk-EZWBRCJL.js → chunk-ETOEZTGL.js} +1 -1
  9. package/dist/chunks/{chunk-VJ4BDBMU.js → chunk-FVPDVRJQ.js} +2 -2
  10. package/dist/chunks/{chunk-EZAFN5CD.js → chunk-GG4BJMJW.js} +1 -1
  11. package/dist/chunks/{chunk-5WDJPHYY.js → chunk-HITD7CX6.js} +1 -1
  12. package/dist/chunks/{chunk-Y5PYRAYP.js → chunk-KK4GE65D.js} +2 -2
  13. package/dist/chunks/{chunk-AHHS6AC4.js → chunk-LAUYSGV4.js} +2 -2
  14. package/dist/chunks/{chunk-ALM3VHFP.js → chunk-M6GDXKKS.js} +1 -1
  15. package/dist/chunks/{chunk-C5XTWMGB.js → chunk-PHHUHR7T.js} +1 -1
  16. package/dist/chunks/{chunk-TOGXTCZO.js → chunk-WQPFDDIY.js} +2 -2
  17. package/dist/chunks/{chunk-CGBNKHNZ.js → chunk-X2AWQSVS.js} +2 -2
  18. package/dist/chunks/{chunk-Y5CNQ266.js → chunk-ZRJQD7VS.js} +2 -2
  19. package/dist/data/grouping.d.ts +33 -12
  20. package/dist/data/grouping.js +2 -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 +39 -11
  25. package/dist/descriptive/dataFrames.js +14 -6
  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 +13 -6
  31. package/dist/descriptive/missing.js +4 -2
  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 +22 -6
  37. package/dist/descriptive/pivot.js +7 -3
  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 +1 -1
  105. package/dist/entries/numerics.d.ts +1 -1
  106. package/dist/entries/tests.js +1 -1
  107. package/dist/htest/agreement.d.ts +61 -23
  108. package/dist/htest/agreement.js +19 -9
  109. package/dist/htest/ansariTest.d.ts +8 -2
  110. package/dist/htest/aov.d.ts +43 -10
  111. package/dist/htest/aov.js +17 -3
  112. package/dist/htest/binomTest.d.ts +12 -2
  113. package/dist/htest/binomTest.js +2 -0
  114. package/dist/htest/brunnerMunzelTest.d.ts +9 -3
  115. package/dist/htest/brunnerMunzelTest.js +4 -2
  116. package/dist/htest/chisqTest.d.ts +19 -3
  117. package/dist/htest/cor.d.ts +20 -4
  118. package/dist/htest/effectSize.d.ts +70 -12
  119. package/dist/htest/effectSize.js +40 -7
  120. package/dist/htest/fisherTest.d.ts +9 -1
  121. package/dist/htest/fisherTest.js +2 -0
  122. package/dist/htest/groups.d.ts +5 -1
  123. package/dist/htest/ksTest.d.ts +20 -3
  124. package/dist/htest/leveneTest.d.ts +15 -4
  125. package/dist/htest/leveneTest.js +5 -2
  126. package/dist/htest/mantelhaenTest.d.ts +25 -3
  127. package/dist/htest/mantelhaenTest.js +15 -1
  128. package/dist/htest/mcnemarTest.d.ts +14 -4
  129. package/dist/htest/mcnemarTest.js +4 -2
  130. package/dist/htest/multipleComparisons.d.ts +173 -29
  131. package/dist/htest/multipleComparisons.js +123 -19
  132. package/dist/htest/normalityTests.d.ts +56 -9
  133. package/dist/htest/normalityTests.js +40 -6
  134. package/dist/htest/onewayTest.d.ts +32 -3
  135. package/dist/htest/onewayTest.js +10 -0
  136. package/dist/htest/pAdjust.d.ts +9 -1
  137. package/dist/htest/pAdjust.js +2 -0
  138. package/dist/htest/pairwise.d.ts +50 -5
  139. package/dist/htest/pairwise.js +25 -0
  140. package/dist/htest/poissonTest.d.ts +12 -2
  141. package/dist/htest/poissonTest.js +2 -0
  142. package/dist/htest/polycor.d.ts +29 -10
  143. package/dist/htest/power.d.ts +60 -6
  144. package/dist/htest/power.js +6 -0
  145. package/dist/htest/propTest.d.ts +13 -2
  146. package/dist/htest/propTest.js +2 -0
  147. package/dist/htest/pwr.d.ts +286 -36
  148. package/dist/htest/pwr.js +116 -15
  149. package/dist/htest/rankTests.d.ts +80 -12
  150. package/dist/htest/rankTests.js +11 -2
  151. package/dist/htest/tTest.d.ts +13 -3
  152. package/dist/htest/trendTests.d.ts +29 -8
  153. package/dist/htest/trendTests.js +8 -4
  154. package/dist/htest/types.d.ts +14 -2
  155. package/dist/htest/varTest.d.ts +25 -8
  156. package/dist/htest/wilcoxTest.d.ts +10 -2
  157. package/dist/internal/dpq.d.ts +4 -0
  158. package/dist/internal/noncentral.d.ts +2 -0
  159. package/dist/internal/vectorize.d.ts +4 -0
  160. package/dist/linalg/basic.d.ts +39 -5
  161. package/dist/linalg/basic.js +15 -0
  162. package/dist/linalg/chol.d.ts +26 -5
  163. package/dist/linalg/chol.js +7 -0
  164. package/dist/linalg/eigen.d.ts +16 -7
  165. package/dist/linalg/eigen.js +6 -5
  166. package/dist/linalg/expm.d.ts +15 -5
  167. package/dist/linalg/expm.js +5 -3
  168. package/dist/linalg/kappa.d.ts +21 -1
  169. package/dist/linalg/kappa.js +16 -0
  170. package/dist/linalg/lu.d.ts +30 -6
  171. package/dist/linalg/lu.js +15 -3
  172. package/dist/linalg/matrix.d.ts +4 -0
  173. package/dist/linalg/norm.d.ts +16 -1
  174. package/dist/linalg/norm.js +9 -0
  175. package/dist/linalg/ops.d.ts +156 -35
  176. package/dist/linalg/ops.js +96 -15
  177. package/dist/linalg/qr.d.ts +87 -12
  178. package/dist/linalg/qr.js +31 -0
  179. package/dist/linalg/schur.d.ts +8 -2
  180. package/dist/linalg/schur.js +3 -1
  181. package/dist/linalg/solve.d.ts +42 -6
  182. package/dist/linalg/solve.js +22 -0
  183. package/dist/linalg/svd.d.ts +12 -2
  184. package/dist/linalg/svd.js +2 -0
  185. package/dist/linalg.js +2 -2
  186. package/dist/models/anovaSequential.d.ts +26 -4
  187. package/dist/models/anovaSequential.js +3 -1
  188. package/dist/models/aovEz.d.ts +29 -6
  189. package/dist/models/aovEz.js +5 -2
  190. package/dist/models/aovStrata.d.ts +12 -2
  191. package/dist/models/carAnova.d.ts +9 -3
  192. package/dist/models/carAnova.js +4 -2
  193. package/dist/models/coxph.d.ts +33 -7
  194. package/dist/models/coxph.js +8 -3
  195. package/dist/models/glm.d.ts +128 -21
  196. package/dist/models/glm.js +71 -14
  197. package/dist/models/glmAnova.d.ts +30 -5
  198. package/dist/models/glmAnova.js +15 -2
  199. package/dist/models/glmConfint.d.ts +16 -2
  200. package/dist/models/glmConfint.js +9 -1
  201. package/dist/models/glmFamily.d.ts +27 -5
  202. package/dist/models/lm.d.ts +75 -17
  203. package/dist/models/lm.js +22 -4
  204. package/dist/models/mauchly.d.ts +20 -5
  205. package/dist/models/mauchly.js +7 -3
  206. package/dist/models/modelFrame.d.ts +5 -1
  207. package/dist/models/modelMatrix.d.ts +18 -4
  208. package/dist/models/modelMatrix.js +3 -1
  209. package/dist/models/survival.d.ts +41 -9
  210. package/dist/models/survival.js +10 -4
  211. package/dist/numerics/deriv.d.ts +21 -6
  212. package/dist/numerics/deriv.js +16 -5
  213. package/dist/numerics/integrate.d.ts +37 -7
  214. package/dist/numerics/integrate.js +8 -2
  215. package/dist/numerics/interp.d.ts +63 -12
  216. package/dist/numerics/interp.js +30 -6
  217. package/dist/numerics/ode.d.ts +15 -5
  218. package/dist/numerics/ode.js +5 -3
  219. package/dist/numerics.js +2 -2
  220. package/dist/optim/optim.d.ts +32 -8
  221. package/dist/optim/optim.js +8 -4
  222. package/dist/random/beta.d.ts +8 -0
  223. package/dist/random/beta.js +8 -0
  224. package/dist/random/binomial.d.ts +16 -0
  225. package/dist/random/binomial.js +16 -0
  226. package/dist/random/continuous.d.ts +51 -0
  227. package/dist/random/continuous.js +51 -0
  228. package/dist/random/extra.d.ts +66 -6
  229. package/dist/random/extra.js +66 -6
  230. package/dist/random/gamma.d.ts +33 -0
  231. package/dist/random/gamma.js +33 -0
  232. package/dist/random/hyper.d.ts +8 -0
  233. package/dist/random/hyper.js +8 -0
  234. package/dist/random/poisson.d.ts +25 -0
  235. package/dist/random/poisson.js +25 -0
  236. package/dist/random/r2dtable.d.ts +2 -0
  237. package/dist/random/r2dtable.js +2 -0
  238. package/dist/random/rank.d.ts +16 -0
  239. package/dist/random/rank.js +16 -0
  240. package/dist/random/rng.d.ts +49 -6
  241. package/dist/random/rng.js +29 -2
  242. package/dist/random/sample.d.ts +10 -2
  243. package/dist/random/sample.js +5 -1
  244. package/dist/random/streams.d.ts +13 -0
  245. package/dist/random/streams.js +13 -0
  246. package/dist/rstats.js +1 -1
  247. package/dist/special/besselIK.d.ts +11 -3
  248. package/dist/special/besselIK.js +6 -2
  249. package/dist/special/besselJY.d.ts +6 -2
  250. package/dist/special/besselJY.js +6 -2
  251. package/dist/special/beta.d.ts +16 -2
  252. package/dist/special/beta.js +16 -2
  253. package/dist/special/choose.d.ts +13 -5
  254. package/dist/special/choose.js +13 -5
  255. package/dist/special/erf.d.ts +8 -3
  256. package/dist/special/erf.js +8 -3
  257. package/dist/special/extra.d.ts +30 -10
  258. package/dist/special/extra.js +25 -9
  259. package/dist/special/gamma.d.ts +18 -2
  260. package/dist/special/gamma.js +18 -2
  261. package/dist/special/log1p.d.ts +16 -7
  262. package/dist/special/log1p.js +16 -7
  263. package/dist/special/psigamma.d.ts +9 -3
  264. package/dist/special/psigamma.js +9 -3
  265. package/dist/special/rCompatible.d.ts +5 -1
  266. package/dist/special.js +2 -2
  267. package/dist/tests.js +2 -2
  268. package/llms.txt +2 -0
  269. package/package.json +1 -1
@@ -28,8 +28,8 @@ function requireComplete(x, what) {
28
28
  /** Two-sided normal p-value 2 Φ(−|z|) */
29
29
  const twoSidedP = (z) => 2 * pnorm(-Math.abs(z));
30
30
  /**
31
- * Cohen's kappa for two raters, unweighted or weighted, with the z test of kappa = 0. Equivalent to irr's
32
- * `kappa2(ratings, weight)` (numeric ratings).
31
+ * Cohen's kappa for two raters, unweighted or weighted, with the z test of kappa = 0. Equivalent to
32
+ * `irr::kappa2(ratings, weight)` in R. The ratings are numeric.
33
33
  *
34
34
  * The levels are the distinct ratings of both raters sorted as R sorts their character forms (so 10 sorts before 2,
35
35
  * which matters for the weighted kappas). Rows with a missing value (`NaN`) are dropped. The variance of the test is
@@ -43,6 +43,8 @@ const twoSidedP = (z) => 2 * pnorm(-Math.abs(z));
43
43
  * ```ts
44
44
  * kappa2([[1, 1], [2, 2], [3, 2], [1, 1], [2, 3], [3, 3]]); // { value: 0.49999999999999994, statistic: 1.7320508075688772, pValue: 0.08326451666355043 }
45
45
  * ```
46
+ *
47
+ * @category Agreement, reliability and factor analysis
46
48
  */
47
49
  export function kappa2(ratings, options = {}) {
48
50
  const weight = matchChoice(options.weight, ["unweighted", "equal", "squared"]);
@@ -81,7 +83,7 @@ export function kappa2(ratings, options = {}) {
81
83
  }
82
84
  /**
83
85
  * Fleiss' kappa for several raters (or Conger's exact kappa), with the z test of kappa = 0 for Fleiss' kappa.
84
- * Equivalent to irr's `kappam.fleiss(ratings, exact)` (numeric ratings, no missing values).
86
+ * Equivalent to `irr::kappam.fleiss(ratings, exact)` in R. The ratings are numeric, without missing values.
85
87
  *
86
88
  * The p-value is computed as 2 Φ(−|z|), so small p-values are more accurate than irr's.
87
89
  *
@@ -92,6 +94,8 @@ export function kappa2(ratings, options = {}) {
92
94
  * ```ts
93
95
  * kappamFleiss([[1, 1, 2], [2, 2, 2], [3, 3, 2], [1, 1, 1], [2, 3, 3]]).value; // 0.3918918918918918
94
96
  * ```
97
+ *
98
+ * @category Agreement, reliability and factor analysis
95
99
  */
96
100
  export function kappamFleiss(ratings, options = {}) {
97
101
  const exact = options.exact ?? false;
@@ -132,8 +136,8 @@ export function kappamFleiss(ratings, options = {}) {
132
136
  return { value, statistic, pValue: twoSidedP(statistic) };
133
137
  }
134
138
  /**
135
- * Intraclass correlation coefficient with its F test and confidence interval (McGraw and Wong's forms). Equivalent
136
- * to irr's `icc(ratings, model, type, unit, r0, conf.level)` (no missing values).
139
+ * Intraclass correlation coefficient with its F test and confidence interval (McGraw and Wong's forms).
140
+ * Equivalent to `irr::icc(ratings, model, type, unit, r0, conf.level)` in R. No missing values are allowed.
137
141
  *
138
142
  * @param ratings - An n × k matrix (array of rows): the ratings of the k raters for each of the n subjects.
139
143
  * @param options - See {@link IccOptions}.
@@ -143,6 +147,8 @@ export function kappamFleiss(ratings, options = {}) {
143
147
  * icc([[9, 2, 5, 8], [6, 1, 3, 2], [8, 4, 6, 8], [7, 1, 2, 6], [10, 5, 6, 9], [6, 2, 4, 7]],
144
148
  * { model: "twoway", type: "agreement" }).value; // 0.28976377952755905
145
149
  * ```
150
+ *
151
+ * @category Agreement, reliability and factor analysis
146
152
  */
147
153
  export function icc(ratings, options = {}) {
148
154
  const model = matchChoice(options.model, ["oneway", "twoway"]);
@@ -206,8 +212,8 @@ function rawAlphaOf(C, keep) {
206
212
  }
207
213
  /**
208
214
  * Cronbach's alpha of a set of items, standardized alpha, Guttman's lambda 6 and the mean inter-item correlation,
209
- * and alpha with each item dropped. Equivalent to the `total` row and `alpha.drop$raw_alpha` of psych's `alpha(x)`
210
- * with its defaults (no missing values, no reversed items).
215
+ * and alpha with each item dropped. Equivalent to `psych::alpha()` in R. It gives the `total` row and
216
+ * `alpha.drop$raw_alpha` of `alpha(x)` with its defaults (no missing values, no reversed items).
211
217
  *
212
218
  * @param x - An n × k matrix (array of rows): k items observed on n subjects.
213
219
  *
@@ -215,6 +221,8 @@ function rawAlphaOf(C, keep) {
215
221
  * ```ts
216
222
  * cronbachAlpha([[1, 2, 2], [2, 3, 3], [3, 3, 4], [4, 5, 4], [2, 2, 3]]).rawAlpha; // 0.935483870967742
217
223
  * ```
224
+ *
225
+ * @category Agreement, reliability and factor analysis
218
226
  */
219
227
  export function cronbachAlpha(x) {
220
228
  const k = columnsOf(x, "x").length;
@@ -236,8 +244,8 @@ export function cronbachAlpha(x) {
236
244
  };
237
245
  }
238
246
  /**
239
- * Partial correlation of columns `i` and `j` of `x` given all its other columns. Equivalent to psych's
240
- * `partial.r(x, c(i, j), others)` (its off-diagonal element; no missing values).
247
+ * Partial correlation of columns `i` and `j` of `x` given all its other columns. Equivalent to
248
+ * `psych::partial.r(x, c(i, j), others)` in R. Returns its off-diagonal element (no missing values).
241
249
  *
242
250
  * @param x - An n × p matrix (array of rows), the variables in the columns.
243
251
  * @param i - 0-based column index.
@@ -247,6 +255,8 @@ export function cronbachAlpha(x) {
247
255
  * ```ts
248
256
  * partialR([[1, 2, 3], [2, 1, 5], [3, 5, 4], [4, 3, 8], [5, 6, 7]], 0, 1); // 0.9804877404385672
249
257
  * ```
258
+ *
259
+ * @category Agreement, reliability and factor analysis
250
260
  */
251
261
  export function partialR(x, i, j) {
252
262
  const p = columnsOf(x, "x").length;
@@ -1,6 +1,10 @@
1
1
  import type { DataFrame } from "../models/modelFrame.js";
2
2
  import { type Alternative, type HTest, type Sample } from "./types.js";
3
- /** Options for {@link ansariTest}. */
3
+ /**
4
+ * Options for {@link ansariTest}.
5
+ *
6
+ * @category Hypothesis tests
7
+ */
4
8
  export interface AnsariTestOptions {
5
9
  /** Alternative hypothesis (unambiguous abbreviations accepted). Default `"two.sided"`. */
6
10
  alternative?: Alternative | "two" | "l" | "g";
@@ -29,10 +33,12 @@ export interface AnsariTestOptions {
29
33
  * ```
30
34
  *
31
35
  * There is also a formula form, `ansariTest("y ~ g", data, options)` (next overload).
36
+ *
37
+ * @category Hypothesis tests
32
38
  */
33
39
  export declare function ansariTest(x: Sample, y: Sample, options?: AnsariTestOptions): HTest;
34
40
  /**
35
- * Ansari-Bradley test from a formula and a data frame. Equivalent to R's `ansari.test(formula, data)`: `"y ~ g"`
41
+ * Ansari-Bradley test from a formula and a data frame. As R's `ansari.test(formula, data)`: `"y ~ g"`
36
42
  * compares the two levels of `g` (the first level is `x`). Only the variables of the formula count: the rows where
37
43
  * one of them is missing are dropped.
38
44
  *
@@ -3,7 +3,11 @@ import { type LmFormulaOptions, type LmFormulaResult } from "../models/lm.js";
3
3
  import type { DataFrame } from "../models/modelFrame.js";
4
4
  import { type GroupLabel } from "./groups.js";
5
5
  import { type Alternative, type HTest, type Sample } from "./types.js";
6
- /** Result of {@link aov}: the one-way ANOVA table, rows "between groups" and "residuals". */
6
+ /**
7
+ * Result of {@link aov}: the one-way ANOVA table, rows "between groups" and "residuals".
8
+ *
9
+ * @category Linear models and ANOVA
10
+ */
7
11
  export interface AovResult {
8
12
  /** Degrees of freedom `[k - 1, N - k]`. */
9
13
  df: [number, number];
@@ -17,7 +21,8 @@ export interface AovResult {
17
21
  pValue: number;
18
22
  }
19
23
  /**
20
- * One-way analysis of variance. Equivalent to the table of R's `summary(aov(y ~ g))` for one factor.
24
+ * One-way analysis of variance. Equivalent to R's `aov()`. Gives the table of R's `summary(aov(y ~ g))` for one
25
+ * factor.
21
26
  *
22
27
  * @param x An array of samples (groups), or one sample with group labels `g`.
23
28
  * @param g Group labels, parallel to `x`.
@@ -25,13 +30,15 @@ export interface AovResult {
25
30
  * @example
26
31
  * ```ts
27
32
  * const r = aov([[2.9, 3.0, 2.5, 2.6, 3.2], [3.8, 2.7, 4.0, 2.4], [2.8, 3.4, 3.7, 2.2, 2.0]]);
28
- * r.fValue; // 0.5600732600732597
33
+ * r.fValue; // 0.56007326007326
29
34
  * r.pValue; // 0.586632991041738
30
35
  * ```
36
+ *
37
+ * @category Linear models and ANOVA
31
38
  */
32
39
  export declare function aov(x: Sample | readonly Sample[], g?: readonly GroupLabel[]): AovResult;
33
40
  /**
34
- * Analysis of variance from a model formula. Equivalent to R's `aov(formula, data)` (with `weights` and
41
+ * Analysis of variance from a model formula, as R's `aov(formula, data)` (with `weights` and
35
42
  * `contrasts`): the same fit as {@link lm} with a formula; {@link aovSummary} gives the table of R's
36
43
  * `summary(aov(...))`. With one `Error()` term (`y ~ W + Error(id/W)`) the fit has error strata: the result is an
37
44
  * {@link AovStrataFit} whose tables {@link aovSummary} returns, one per stratum.
@@ -46,12 +53,20 @@ export declare function aov(x: Sample | readonly Sample[], g?: readonly GroupLab
46
53
  * ```
47
54
  */
48
55
  export declare function aov(formula: string, data: DataFrame, options?: LmFormulaOptions): LmFormulaResult | AovStrataFit;
49
- /** Options for {@link TukeyHSD}. */
56
+ /**
57
+ * Options for {@link TukeyHSD}.
58
+ *
59
+ * @category Multiple comparisons
60
+ */
50
61
  export interface TukeyHSDOptions {
51
62
  /** Family-wise confidence level. Default `0.95`. */
52
63
  confLevel?: number;
53
64
  }
54
- /** Result of {@link TukeyHSD}: one entry per pair of groups, in R's order (2-1, 3-1, ..., k-1, 3-2, ...). */
65
+ /**
66
+ * Result of {@link TukeyHSD}: one entry per pair of groups, in R's order (2-1, 3-1, ..., k-1, 3-2, ...).
67
+ *
68
+ * @category Multiple comparisons
69
+ */
55
70
  export interface TukeyHSDResult {
56
71
  /**
57
72
  * Labels of the comparisons, `"a-b"`: the group labels when given, otherwise the positions of the samples in the
@@ -76,9 +91,25 @@ export interface TukeyHSDResult {
76
91
  * sizes). Equivalent to R's `TukeyHSD(aov(y ~ g))`.
77
92
  *
78
93
  * @param x An array of samples (groups), or one sample with group labels `g` (then `options` comes third).
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
98
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
99
+ * const r = TukeyHSD(x, g);
100
+ * r.names; // ["b-a", "c-a", "c-b"]
101
+ * r.diff; // [1.4333333333333336, 2.7666666666666666, 1.333333333333333]
102
+ * r.pAdj; // [0.03403130149294014, 0.001492661804896774, 0.04527523376597547]
103
+ * ```
104
+ *
105
+ * @category Multiple comparisons
79
106
  */
80
107
  export declare function TukeyHSD(x: Sample | readonly Sample[], g?: readonly GroupLabel[] | TukeyHSDOptions, options?: TukeyHSDOptions): TukeyHSDResult;
81
- /** Options for {@link zTest}. */
108
+ /**
109
+ * Options for {@link zTest}.
110
+ *
111
+ * @category Hypothesis tests
112
+ */
82
113
  export interface ZTestOptions {
83
114
  /** Known standard deviation of the population of `x` (required). */
84
115
  sigmaX?: number;
@@ -93,12 +124,14 @@ export interface ZTestOptions {
93
124
  }
94
125
  /**
95
126
  * z test for the mean of one sample, or the difference of the means of two, with known standard deviations.
96
- * Equivalent to `BSDA::z.test()` (the open end of a one-sided interval is ±Infinity here, NA in BSDA). `NaN` values
97
- * are dropped.
127
+ * Equivalent to `BSDA::z.test()` in R. The open end of a one-sided interval is ±Infinity here (NA in BSDA). `NaN`
128
+ * values are dropped.
98
129
  *
99
130
  * @example
100
131
  * ```ts
101
- * zTest([5.1, 4.9, 5.6, 5.8, 6.0], { mu: 5, sigmaX: 0.5 }).pValue;
132
+ * zTest([5.1, 4.9, 5.6, 5.8, 6.0], { mu: 5, sigmaX: 0.5 }).pValue; // 0.031823127386490346
102
133
  * ```
134
+ *
135
+ * @category Hypothesis tests
103
136
  */
104
137
  export declare function zTest(x: Sample, y?: Sample | ZTestOptions, options?: ZTestOptions): HTest;
package/dist/htest/aov.js CHANGED
@@ -78,6 +78,18 @@ function aovOneway(x, g) {
78
78
  * sizes). Equivalent to R's `TukeyHSD(aov(y ~ g))`.
79
79
  *
80
80
  * @param x An array of samples (groups), or one sample with group labels `g` (then `options` comes third).
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * const x = [1.2, 2.3, 1.8, 2.9, 3.1, 3.6, 4.0, 4.4, 5.2];
85
+ * const g = ["a", "a", "a", "b", "b", "b", "c", "c", "c"];
86
+ * const r = TukeyHSD(x, g);
87
+ * r.names; // ["b-a", "c-a", "c-b"]
88
+ * r.diff; // [1.4333333333333336, 2.7666666666666666, 1.333333333333333]
89
+ * r.pAdj; // [0.03403130149294014, 0.001492661804896774, 0.04527523376597547]
90
+ * ```
91
+ *
92
+ * @category Multiple comparisons
81
93
  */
82
94
  export function TukeyHSD(x, g, options = {}) {
83
95
  let labels;
@@ -115,13 +127,15 @@ export function TukeyHSD(x, g, options = {}) {
115
127
  }
116
128
  /**
117
129
  * z test for the mean of one sample, or the difference of the means of two, with known standard deviations.
118
- * Equivalent to `BSDA::z.test()` (the open end of a one-sided interval is ±Infinity here, NA in BSDA). `NaN` values
119
- * are dropped.
130
+ * Equivalent to `BSDA::z.test()` in R. The open end of a one-sided interval is ±Infinity here (NA in BSDA). `NaN`
131
+ * values are dropped.
120
132
  *
121
133
  * @example
122
134
  * ```ts
123
- * zTest([5.1, 4.9, 5.6, 5.8, 6.0], { mu: 5, sigmaX: 0.5 }).pValue;
135
+ * zTest([5.1, 4.9, 5.6, 5.8, 6.0], { mu: 5, sigmaX: 0.5 }).pValue; // 0.031823127386490346
124
136
  * ```
137
+ *
138
+ * @category Hypothesis tests
125
139
  */
126
140
  export function zTest(x, y, options = {}) {
127
141
  let ys;
@@ -1,5 +1,9 @@
1
1
  import { type Alternative, type HTest } from "./types.js";
2
- /** Options for {@link binomTest}. */
2
+ /**
3
+ * Options for {@link binomTest}.
4
+ *
5
+ * @category Hypothesis tests
6
+ */
3
7
  export interface BinomTestOptions {
4
8
  /** Hypothesized probability of success. Default `0.5`. */
5
9
  p?: number;
@@ -8,7 +12,11 @@ export interface BinomTestOptions {
8
12
  /** Confidence level of the interval. Default `0.95`. */
9
13
  confLevel?: number;
10
14
  }
11
- /** Result of {@link binomTest}. */
15
+ /**
16
+ * Result of {@link binomTest}.
17
+ *
18
+ * @category Hypothesis tests
19
+ */
12
20
  export interface BinomTestResult extends HTest {
13
21
  /** Number of trials (`parameterName` is `"number of trials"`). */
14
22
  parameter: number;
@@ -32,5 +40,7 @@ export interface BinomTestResult extends HTest {
32
40
  * ```ts
33
41
  * binomTest(682, 925, { p: 0.75 }).pValue; // 0.3824916
34
42
  * ```
43
+ *
44
+ * @category Hypothesis tests
35
45
  */
36
46
  export declare function binomTest(x: number | readonly [number, number], n?: number | BinomTestOptions, options?: BinomTestOptions): BinomTestResult;
@@ -55,6 +55,8 @@ function twoSidedP(x, n, p) {
55
55
  * ```ts
56
56
  * binomTest(682, 925, { p: 0.75 }).pValue; // 0.3824916
57
57
  * ```
58
+ *
59
+ * @category Hypothesis tests
58
60
  */
59
61
  export function binomTest(x, n, options = {}) {
60
62
  let xs;
@@ -1,5 +1,9 @@
1
1
  import { type Alternative, type HTest, type Sample } from "./types.js";
2
- /** Options for {@link brunnerMunzelTest}. */
2
+ /**
3
+ * Options for {@link brunnerMunzelTest}.
4
+ *
5
+ * @category Hypothesis tests
6
+ */
3
7
  export interface BrunnerMunzelTestOptions {
4
8
  /**
5
9
  * Alternative hypothesis (unambiguous abbreviations accepted). Default `"two.sided"`. As in lawstat, `"greater"`
@@ -11,7 +15,7 @@ export interface BrunnerMunzelTestOptions {
11
15
  }
12
16
  /**
13
17
  * Brunner-Munzel test that two samples have the relative effect P(X < Y) + P(X = Y)/2 = 1/2, without assuming equal
14
- * variances or shapes. Equivalent to `lawstat::brunner.munzel.test()`. `NaN` values are dropped.
18
+ * variances or shapes. Equivalent to `lawstat::brunner.munzel.test()` in R. `NaN` values are dropped.
15
19
  *
16
20
  * `estimate` is the estimated relative effect and `confInt` its two-sided interval (not clipped to [0, 1]). When a
17
21
  * sample has one value, or when the variance estimates are 0 (for example completely separated samples), the
@@ -21,8 +25,10 @@ export interface BrunnerMunzelTestOptions {
21
25
  * ```ts
22
26
  * const r = brunnerMunzelTest([1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1], [3, 3, 4, 3, 1, 2, 3, 1, 1, 5, 4]);
23
27
  * r.statistic; // 3.1374674823029509
24
- * r.pValue; // 0.0057862086661515377
28
+ * r.pValue; // 0.0057862086661514605
25
29
  * r.estimate; // 0.78896103896103909
26
30
  * ```
31
+ *
32
+ * @category Hypothesis tests
27
33
  */
28
34
  export declare function brunnerMunzelTest(x: Sample, y: Sample, options?: BrunnerMunzelTestOptions): HTest;
@@ -16,7 +16,7 @@ import { rank } from "../internal/summary.js";
16
16
  import { checkConfLevel, matchAlternative } from "./types.js";
17
17
  /**
18
18
  * Brunner-Munzel test that two samples have the relative effect P(X < Y) + P(X = Y)/2 = 1/2, without assuming equal
19
- * variances or shapes. Equivalent to `lawstat::brunner.munzel.test()`. `NaN` values are dropped.
19
+ * variances or shapes. Equivalent to `lawstat::brunner.munzel.test()` in R. `NaN` values are dropped.
20
20
  *
21
21
  * `estimate` is the estimated relative effect and `confInt` its two-sided interval (not clipped to [0, 1]). When a
22
22
  * sample has one value, or when the variance estimates are 0 (for example completely separated samples), the
@@ -26,9 +26,11 @@ import { checkConfLevel, matchAlternative } from "./types.js";
26
26
  * ```ts
27
27
  * const r = brunnerMunzelTest([1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1], [3, 3, 4, 3, 1, 2, 3, 1, 1, 5, 4]);
28
28
  * r.statistic; // 3.1374674823029509
29
- * r.pValue; // 0.0057862086661515377
29
+ * r.pValue; // 0.0057862086661514605
30
30
  * r.estimate; // 0.78896103896103909
31
31
  * ```
32
+ *
33
+ * @category Hypothesis tests
32
34
  */
33
35
  export function brunnerMunzelTest(x, y, options = {}) {
34
36
  const xs = Array.from(x).filter((v) => !Number.isNaN(v));
@@ -1,5 +1,9 @@
1
1
  import type { HTest, Counts } from "./types.js";
2
- /** Options for {@link chisqTest}. */
2
+ /**
3
+ * Options for {@link chisqTest}.
4
+ *
5
+ * @category Hypothesis tests
6
+ */
3
7
  export interface ChisqTestOptions {
4
8
  /** Apply Yates' continuity correction (2 x 2 tables only). Default `true`. */
5
9
  correct?: boolean;
@@ -17,6 +21,8 @@ export interface ChisqTestOptions {
17
21
  }
18
22
  /**
19
23
  * Result of {@link chisqTest}. Has no `alternative`, because R's `chisq.test()` does not return one.
24
+ *
25
+ * @category Hypothesis tests
20
26
  */
21
27
  export interface ChisqTestResult extends Omit<HTest, "alternative"> {
22
28
  /** Degrees of freedom (`parameterName` is `"df"`). */
@@ -34,7 +40,11 @@ export interface ChisqTestResult extends Omit<HTest, "alternative"> {
34
40
  */
35
41
  stdres: number[] | number[][];
36
42
  }
37
- /** Result of {@link chisqTest} with two factor vectors: also the levels that label the rows and columns. */
43
+ /**
44
+ * Result of {@link chisqTest} with two factor vectors: also the levels that label the rows and columns.
45
+ *
46
+ * @category Hypothesis tests
47
+ */
38
48
  export interface ChisqTestFactorsResult extends ChisqTestResult {
39
49
  observed: number[][];
40
50
  expected: number[][];
@@ -45,7 +55,11 @@ export interface ChisqTestFactorsResult extends ChisqTestResult {
45
55
  /** Levels of `y` (columns of the table), sorted by code point. */
46
56
  colLevels: string[];
47
57
  }
48
- /** A factor: category labels, with `null` or `undefined` for missing values (R's NA). */
58
+ /**
59
+ * A factor: category labels, with `null` or `undefined` for missing values (R's NA).
60
+ *
61
+ * @category Hypothesis tests
62
+ */
49
63
  export type Factor = readonly (string | null | undefined)[];
50
64
  /**
51
65
  * Pearson's chi-squared test. Equivalent to R's `chisq.test()`.
@@ -82,6 +96,8 @@ export type Factor = readonly (string | null | undefined)[];
82
96
  *
83
97
  * chisqTest(["a", "b", "a", "b"], ["u", "u", "v", "v"]).rowLevels; // ["a", "b"]
84
98
  * ```
99
+ *
100
+ * @category Hypothesis tests
85
101
  */
86
102
  export declare function chisqTest(x: Counts | readonly Counts[], options?: ChisqTestOptions): ChisqTestResult;
87
103
  export declare function chisqTest(x: Factor, y: Factor, options?: ChisqTestOptions): ChisqTestFactorsResult;
@@ -1,14 +1,26 @@
1
1
  import { type DD } from "../special/dd.js";
2
2
  import type { DataFrame } from "../models/modelFrame.js";
3
3
  import { type Alternative, type HTest, type Sample } from "./types.js";
4
- /** Correlation coefficient: Pearson's r, Kendall's tau or Spearman's rho. */
4
+ /**
5
+ * Correlation coefficient: Pearson's r, Kendall's tau or Spearman's rho.
6
+ *
7
+ * @category Descriptive statistics
8
+ */
5
9
  export type CorMethod = "pearson" | "kendall" | "spearman";
6
- /** Options for {@link cor}. */
10
+ /**
11
+ * Options for {@link cor}.
12
+ *
13
+ * @category Hypothesis tests
14
+ */
7
15
  export interface CorOptions {
8
16
  /** Correlation coefficient to compute. Default `"pearson"`. Unambiguous abbreviations are accepted. */
9
17
  method?: CorMethod | (string & {});
10
18
  }
11
- /** Options for {@link corTest}. */
19
+ /**
20
+ * Options for {@link corTest}.
21
+ *
22
+ * @category Hypothesis tests
23
+ */
12
24
  export interface CorTestOptions extends CorOptions {
13
25
  /**
14
26
  * Alternative hypothesis: `"two.sided"`, `"less"` or `"greater"`. Default `"two.sided"`.
@@ -29,6 +41,8 @@ export interface CorTestOptions extends CorOptions {
29
41
  /**
30
42
  * Result of {@link corTest}. For Pearson, `statisticName` is `"t"` with `parameter` (df)
31
43
  * and `confInt`; for Kendall `"T"` (exact) or `"z"`; for Spearman `"S"`.
44
+ *
45
+ * @category Hypothesis tests
32
46
  */
33
47
  export interface CorTestResult extends HTest {
34
48
  /** Sample correlation coefficient. */
@@ -93,10 +107,12 @@ export declare function kendall(x: readonly number[], y: readonly number[]): Ken
93
107
  * ```
94
108
  *
95
109
  * There is also a formula form, `corTest("~ x + y", data, options)` (next overload).
110
+ *
111
+ * @category Hypothesis tests
96
112
  */
97
113
  export declare function corTest(x: Sample, y: Sample, options?: CorTestOptions): CorTestResult;
98
114
  /**
99
- * Test for correlation from a formula and a data frame. Equivalent to R's `cor.test(formula, data)`: the one-sided
115
+ * Test for correlation from a formula and a data frame. As R's `cor.test(formula, data)`: the one-sided
100
116
  * formula `"~ x + y"` names the two variables. Only they count: the rows where one of them is missing are dropped.
101
117
  *
102
118
  * @param formula `"~ x + y"` (exactly two variables, no response).
@@ -3,7 +3,11 @@ import type { AovEzResult } from "../models/aovEz.js";
3
3
  import type { AovStrataFit } from "../models/aovStrata.js";
4
4
  import type { LmFormulaResult } from "../models/lm.js";
5
5
  import type { Alternative, Sample } from "./types.js";
6
- /** Options for {@link cohensD} and {@link hedgesG}. */
6
+ /**
7
+ * Options for {@link cohensD} and {@link hedgesG}.
8
+ *
9
+ * @category Effect sizes and power
10
+ */
7
11
  export interface CohensDOptions {
8
12
  /** Two samples: standardize by the pooled standard deviation (default `true`) or by `sqrt((s1² + s2²)/2)`. */
9
13
  pooledSd?: boolean;
@@ -18,35 +22,55 @@ export interface CohensDOptions {
18
22
  /** {@link cohensD} only: apply Hedges' small-sample correction (the result is Hedges' g). Default `false`. */
19
23
  adjust?: boolean;
20
24
  }
21
- /** Result of {@link cohensD} and {@link hedgesG}. */
25
+ /**
26
+ * Result of {@link cohensD} and {@link hedgesG}.
27
+ *
28
+ * @category Effect sizes and power
29
+ */
22
30
  export interface CohensDResult {
23
31
  /** `"Cohens_d"` or `"Hedges_g"`. */
24
32
  name: "Cohens_d" | "Hedges_g";
33
+ /** The effect size. */
25
34
  value: number;
26
35
  /** Confidence level (absent without an interval). */
27
36
  ci?: number;
37
+ /** Lower confidence limit (R's `CI_low`; `-Infinity` for `"less"`). */
28
38
  ciLow?: number;
39
+ /** Upper confidence limit (R's `CI_high`; `Infinity` for `"greater"`). */
29
40
  ciHigh?: number;
30
41
  /** effectsize's warnings. */
31
42
  warnings: string[];
32
43
  }
33
44
  /**
34
45
  * Cohen's d: the standardized difference of means of two samples (pooled or averaged standard deviation), of paired
35
- * samples, or of one sample against `mu`, with a confidence interval from the noncentral t distribution. Equivalent
36
- * to effectsize's `cohens_d()`.
46
+ * samples, or of one sample against `mu`, with a confidence interval from the noncentral t distribution.
47
+ * Equivalent to `effectsize::cohens_d()` in R.
37
48
  *
38
49
  * @example
39
50
  * ```ts
40
51
  * cohensD([5.1, 4.9, 6.2, 5.8], [4.1, 4.5, 3.9, 5.0]).value; // 2.049693834034246
41
52
  * ```
53
+ *
54
+ * @category Effect sizes and power
42
55
  */
43
56
  export declare function cohensD(x: Sample, y?: Sample, options?: CohensDOptions): CohensDResult;
44
57
  /**
45
- * Hedges' g: Cohen's d and its interval multiplied by the small-sample correction J(df). Equivalent to effectsize's
46
- * `hedges_g()`.
58
+ * Hedges' g: Cohen's d and its interval multiplied by the small-sample correction J(df). Equivalent to
59
+ * `effectsize::hedges_g()` in R.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * hedgesG([5.1, 4.9, 6.2, 5.8], [4.1, 4.5, 3.9, 5.0]).value; // 1.7804187661174387
64
+ * ```
65
+ *
66
+ * @category Effect sizes and power
47
67
  */
48
68
  export declare function hedgesG(x: Sample, y?: Sample, options?: Omit<CohensDOptions, "adjust">): CohensDResult;
49
- /** Options for {@link etaSquared}, {@link omegaSquared} and {@link epsilonSquared}. */
69
+ /**
70
+ * Options for {@link etaSquared}, {@link omegaSquared} and {@link epsilonSquared}.
71
+ *
72
+ * @category Effect sizes and power
73
+ */
50
74
  export interface AnovaEffectSizeOptions {
51
75
  /**
52
76
  * Partial effect sizes (default `true`). A table with a single term always gives the non-partial one (not so for
@@ -58,7 +82,11 @@ export interface AnovaEffectSizeOptions {
58
82
  /** `"greater"` (default: the interval is [lower, 1]), `"two.sided"` or `"less"` ([0, upper]). */
59
83
  alternative?: Alternative | (string & {});
60
84
  }
61
- /** Options for {@link etaSquared}. */
85
+ /**
86
+ * Options for {@link etaSquared}.
87
+ *
88
+ * @category Effect sizes and power
89
+ */
62
90
  export interface EtaSquaredOptions extends AnovaEffectSizeOptions {
63
91
  /**
64
92
  * Generalized eta squared: `true` (all factors manipulated) or the names of the observed factors. Default
@@ -66,7 +94,11 @@ export interface EtaSquaredOptions extends AnovaEffectSizeOptions {
66
94
  */
67
95
  generalized?: boolean | readonly string[];
68
96
  }
69
- /** Result of the ANOVA effect sizes: one row per term. */
97
+ /**
98
+ * Result of the ANOVA effect sizes: one row per term.
99
+ *
100
+ * @category Effect sizes and power
101
+ */
70
102
  export interface AnovaEffectSizeTable {
71
103
  /** effectsize's columns: the effect size (`"Eta2_partial"`, `"Omega2"`, ...), then `"CI"`, `"CI_low"`, `"CI_high"`. */
72
104
  colNames: string[];
@@ -82,11 +114,13 @@ export interface AnovaEffectSizeTable {
82
114
  /**
83
115
  * A model of the ANOVA effect sizes: a table of `anova()` or `Anova()`, a fit from `lm()` or `aov()` (also with
84
116
  * `Error()`), the `aovSummary()` of an `aov()` fit with `Error()`, or a result of `aovEz()`.
117
+ *
118
+ * @category Effect sizes and power
85
119
  */
86
120
  export type AnovaEffectSizeModel = AnovaTable | LmFormulaResult | AovStrataFit | AovStrataSummary | AovEzResult;
87
121
  /**
88
122
  * Eta squared of the terms of an analysis-of-variance table (partial by default, or generalized), with confidence
89
- * intervals from the noncentral F distribution. Equivalent to effectsize's `eta_squared()` for a table of
123
+ * intervals from the noncentral F distribution. Equivalent to `effectsize::eta_squared()` in R. It takes a table of
90
124
  * `anova()` or `Anova()`; a fit from `lm()` with a formula is replaced by its `anova()` table.
91
125
  *
92
126
  * Repeated measures: for a fit of `aov()` with an `Error()` term (or its {@link aovSummary}) each term is measured
@@ -95,18 +129,42 @@ export type AnovaEffectSizeModel = AnovaTable | LmFormulaResult | AovStrataFit |
95
129
  *
96
130
  * @example
97
131
  * ```ts
132
+ * const data = { y: [2.1, 3.9, 6.2, 7.8, 10.1, 11.8], g: ["a", "a", "b", "b", "c", "c"] };
98
133
  * etaSquared(anova(lm("y ~ g", data))).colNames; // ["Eta2", "CI", "CI_low", "CI_high"]
134
+ * const long = {
135
+ * y: [5, 7, 8, 4, 6, 9, 6, 8, 8, 5, 5, 7],
136
+ * W: ["a", "b", "c", "a", "b", "c", "a", "b", "c", "a", "b", "c"],
137
+ * id: ["s1", "s1", "s1", "s2", "s2", "s2", "s3", "s3", "s3", "s4", "s4", "s4"],
138
+ * };
99
139
  * etaSquared(aov("y ~ W + Error(id/W)", long)).groups; // ["id:W"]
100
140
  * ```
141
+ *
142
+ * @category Effect sizes and power
101
143
  */
102
144
  export declare function etaSquared(model: AnovaEffectSizeModel, options?: EtaSquaredOptions): AnovaEffectSizeTable;
103
145
  /**
104
146
  * Omega squared of the terms of an analysis-of-variance table, also of repeated-measures designs (see
105
- * {@link etaSquared}). Equivalent to effectsize's `omega_squared()`.
147
+ * {@link etaSquared}). Equivalent to `effectsize::omega_squared()` in R.
148
+ *
149
+ * @example
150
+ * ```ts
151
+ * const data = { y: [2.1, 3.9, 6.2, 7.8, 10.1, 11.8], g: ["a", "a", "b", "b", "c", "c"] };
152
+ * omegaSquared(anova(lm("y ~ g", data))).table; // [[0.8740518865645682, 0.95, 0.0566677410780818, 1]]
153
+ * ```
154
+ *
155
+ * @category Effect sizes and power
106
156
  */
107
157
  export declare function omegaSquared(model: AnovaEffectSizeModel, options?: AnovaEffectSizeOptions): AnovaEffectSizeTable;
108
158
  /**
109
159
  * Epsilon squared of the terms of an analysis-of-variance table, also of repeated-measures designs (see
110
- * {@link etaSquared}). Equivalent to effectsize's `epsilon_squared()`.
160
+ * {@link etaSquared}). Equivalent to `effectsize::epsilon_squared()` in R.
161
+ *
162
+ * @example
163
+ * ```ts
164
+ * const data = { y: [2.1, 3.9, 6.2, 7.8, 10.1, 11.8], g: ["a", "a", "b", "b", "c", "c"] };
165
+ * epsilonSquared(anova(lm("y ~ g", data))).table; // [[0.8927928150213428, 0.95, 0.1720126241673212, 1]]
166
+ * ```
167
+ *
168
+ * @category Effect sizes and power
111
169
  */
112
170
  export declare function epsilonSquared(model: AnovaEffectSizeModel, options?: AnovaEffectSizeOptions): AnovaEffectSizeTable;