@numero-uno-jpn/rstats 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (289) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.ja.md +44 -13
  3. package/README.md +43 -11
  4. package/dist/chunks/{chunk-VJ4BDBMU.js → chunk-3VMBBQLV.js} +2 -2
  5. package/dist/chunks/chunk-4OKAZJJG.js +3 -0
  6. package/dist/chunks/{chunk-EZAFN5CD.js → chunk-6BH65HGN.js} +1 -1
  7. package/dist/chunks/chunk-ATC4F4BX.js +2 -0
  8. package/dist/chunks/{chunk-JWBO5WVN.js → chunk-EDH53DXN.js} +2 -2
  9. package/dist/chunks/{chunk-Y5CNQ266.js → chunk-EZ2KD5NA.js} +2 -2
  10. package/dist/chunks/{chunk-Y5PYRAYP.js → chunk-GSPOO2G3.js} +2 -2
  11. package/dist/chunks/{chunk-F5EDJFEO.js → chunk-K7AZ65H7.js} +2 -2
  12. package/dist/chunks/{chunk-YSWGDOWK.js → chunk-LEIH4U5X.js} +2 -2
  13. package/dist/chunks/{chunk-EZWBRCJL.js → chunk-OX3SBG5X.js} +1 -1
  14. package/dist/chunks/chunk-SGZQDJRR.js +2 -0
  15. package/dist/chunks/{chunk-C5XTWMGB.js → chunk-UH2N3ZQW.js} +1 -1
  16. package/dist/chunks/chunk-UV2MZYDQ.js +2 -0
  17. package/dist/chunks/{chunk-TOGXTCZO.js → chunk-VQHEOBTM.js} +2 -2
  18. package/dist/chunks/chunk-WJQZZYOI.js +2 -0
  19. package/dist/chunks/chunk-WKEFHOFR.js +2 -0
  20. package/dist/chunks/{chunk-CGBNKHNZ.js → chunk-WXC25OPJ.js} +2 -2
  21. package/dist/chunks/{chunk-5WDJPHYY.js → chunk-XJQKSR52.js} +1 -1
  22. package/dist/data/grouping.d.ts +39 -15
  23. package/dist/data/grouping.js +21 -22
  24. package/dist/descriptive/basic.d.ts +130 -17
  25. package/dist/descriptive/basic.js +115 -14
  26. package/dist/descriptive/cov.d.ts +22 -12
  27. package/dist/descriptive/dataFrames.d.ts +39 -11
  28. package/dist/descriptive/dataFrames.js +14 -6
  29. package/dist/descriptive/factanal.d.ts +26 -6
  30. package/dist/descriptive/factanal.js +7 -3
  31. package/dist/descriptive/hist.d.ts +27 -6
  32. package/dist/descriptive/hist.js +9 -3
  33. package/dist/descriptive/missing.d.ts +13 -6
  34. package/dist/descriptive/missing.js +4 -2
  35. package/dist/descriptive/moments.d.ts +91 -13
  36. package/dist/descriptive/moments.js +66 -9
  37. package/dist/descriptive/omega.d.ts +28 -6
  38. package/dist/descriptive/omega.js +16 -4
  39. package/dist/descriptive/pivot.d.ts +22 -6
  40. package/dist/descriptive/pivot.js +7 -3
  41. package/dist/descriptive/quantile.d.ts +33 -5
  42. package/dist/descriptive/quantile.js +20 -2
  43. package/dist/descriptive/rank.d.ts +12 -2
  44. package/dist/descriptive/rank.js +2 -0
  45. package/dist/descriptive/table.d.ts +55 -7
  46. package/dist/descriptive/table.js +38 -4
  47. package/dist/descriptive.js +2 -2
  48. package/dist/distributions/arcsine.d.ts +40 -5
  49. package/dist/distributions/arcsine.js +35 -4
  50. package/dist/distributions/beta.d.ts +12 -0
  51. package/dist/distributions/beta.js +12 -0
  52. package/dist/distributions/binomial.d.ts +18 -0
  53. package/dist/distributions/binomial.js +18 -0
  54. package/dist/distributions/bvnorm.d.ts +4 -1
  55. package/dist/distributions/bvnorm.js +4 -1
  56. package/dist/distributions/cauchy.d.ts +24 -0
  57. package/dist/distributions/cauchy.js +24 -0
  58. package/dist/distributions/chisq.d.ts +18 -0
  59. package/dist/distributions/chisq.js +18 -0
  60. package/dist/distributions/exponential.d.ts +29 -1
  61. package/dist/distributions/exponential.js +24 -0
  62. package/dist/distributions/f.d.ts +18 -0
  63. package/dist/distributions/f.js +18 -0
  64. package/dist/distributions/gamma.d.ts +20 -0
  65. package/dist/distributions/gamma.js +18 -0
  66. package/dist/distributions/geometric.d.ts +24 -0
  67. package/dist/distributions/geometric.js +24 -0
  68. package/dist/distributions/hypergeometric.d.ts +24 -0
  69. package/dist/distributions/hypergeometric.js +24 -0
  70. package/dist/distributions/invgamma.d.ts +32 -4
  71. package/dist/distributions/invgamma.js +27 -3
  72. package/dist/distributions/kumaraswamy.d.ts +31 -3
  73. package/dist/distributions/kumaraswamy.js +31 -3
  74. package/dist/distributions/laplace.d.ts +36 -4
  75. package/dist/distributions/laplace.js +31 -3
  76. package/dist/distributions/logistic.d.ts +29 -1
  77. package/dist/distributions/logistic.js +24 -0
  78. package/dist/distributions/lognormal.d.ts +29 -1
  79. package/dist/distributions/lognormal.js +24 -0
  80. package/dist/distributions/multinomial.d.ts +7 -1
  81. package/dist/distributions/multinomial.js +2 -0
  82. package/dist/distributions/negbinomial.d.ts +29 -1
  83. package/dist/distributions/negbinomial.js +24 -0
  84. package/dist/distributions/normal.d.ts +11 -1
  85. package/dist/distributions/normal.js +6 -0
  86. package/dist/distributions/pareto.d.ts +36 -4
  87. package/dist/distributions/pareto.js +31 -3
  88. package/dist/distributions/poisson.d.ts +18 -0
  89. package/dist/distributions/poisson.js +18 -0
  90. package/dist/distributions/signrank.d.ts +24 -0
  91. package/dist/distributions/signrank.js +24 -0
  92. package/dist/distributions/summary.d.ts +20 -2
  93. package/dist/distributions/summary.js +4 -0
  94. package/dist/distributions/t.d.ts +18 -0
  95. package/dist/distributions/t.js +18 -0
  96. package/dist/distributions/triangular.d.ts +36 -4
  97. package/dist/distributions/triangular.js +31 -3
  98. package/dist/distributions/tukey.d.ts +15 -1
  99. package/dist/distributions/tukey.js +10 -0
  100. package/dist/distributions/uniform.d.ts +29 -1
  101. package/dist/distributions/uniform.js +24 -0
  102. package/dist/distributions/weibull.d.ts +29 -1
  103. package/dist/distributions/weibull.js +24 -0
  104. package/dist/distributions/wilcox.d.ts +24 -0
  105. package/dist/distributions/wilcox.js +24 -0
  106. package/dist/distributions.js +2 -2
  107. package/dist/entries/descriptive.d.ts +1 -1
  108. package/dist/entries/mixed.d.ts +1 -0
  109. package/dist/entries/mixed.js +2 -0
  110. package/dist/entries/numerics.d.ts +1 -1
  111. package/dist/entries/tests.js +1 -1
  112. package/dist/htest/agreement.d.ts +61 -23
  113. package/dist/htest/agreement.js +19 -9
  114. package/dist/htest/ansariTest.d.ts +8 -2
  115. package/dist/htest/aov.d.ts +43 -10
  116. package/dist/htest/aov.js +17 -3
  117. package/dist/htest/binomTest.d.ts +12 -2
  118. package/dist/htest/binomTest.js +2 -0
  119. package/dist/htest/brunnerMunzelTest.d.ts +9 -3
  120. package/dist/htest/brunnerMunzelTest.js +4 -2
  121. package/dist/htest/chisqTest.d.ts +19 -3
  122. package/dist/htest/cor.d.ts +20 -4
  123. package/dist/htest/effectSize.d.ts +70 -12
  124. package/dist/htest/effectSize.js +40 -7
  125. package/dist/htest/fisherTest.d.ts +9 -1
  126. package/dist/htest/fisherTest.js +2 -0
  127. package/dist/htest/groups.d.ts +5 -1
  128. package/dist/htest/ksTest.d.ts +20 -3
  129. package/dist/htest/leveneTest.d.ts +15 -4
  130. package/dist/htest/leveneTest.js +5 -2
  131. package/dist/htest/mantelhaenTest.d.ts +25 -3
  132. package/dist/htest/mantelhaenTest.js +15 -1
  133. package/dist/htest/mcnemarTest.d.ts +14 -4
  134. package/dist/htest/mcnemarTest.js +4 -2
  135. package/dist/htest/multipleComparisons.d.ts +173 -29
  136. package/dist/htest/multipleComparisons.js +123 -19
  137. package/dist/htest/normalityTests.d.ts +56 -9
  138. package/dist/htest/normalityTests.js +40 -6
  139. package/dist/htest/onewayTest.d.ts +32 -3
  140. package/dist/htest/onewayTest.js +10 -0
  141. package/dist/htest/pAdjust.d.ts +9 -1
  142. package/dist/htest/pAdjust.js +2 -0
  143. package/dist/htest/pairwise.d.ts +50 -5
  144. package/dist/htest/pairwise.js +25 -0
  145. package/dist/htest/poissonTest.d.ts +12 -2
  146. package/dist/htest/poissonTest.js +2 -0
  147. package/dist/htest/polycor.d.ts +29 -10
  148. package/dist/htest/power.d.ts +60 -6
  149. package/dist/htest/power.js +6 -0
  150. package/dist/htest/propTest.d.ts +13 -2
  151. package/dist/htest/propTest.js +2 -0
  152. package/dist/htest/pwr.d.ts +286 -36
  153. package/dist/htest/pwr.js +116 -15
  154. package/dist/htest/rankTests.d.ts +80 -12
  155. package/dist/htest/rankTests.js +11 -2
  156. package/dist/htest/tTest.d.ts +13 -3
  157. package/dist/htest/testFormula.js +6 -3
  158. package/dist/htest/trendTests.d.ts +29 -8
  159. package/dist/htest/trendTests.js +8 -4
  160. package/dist/htest/types.d.ts +14 -2
  161. package/dist/htest/varTest.d.ts +25 -8
  162. package/dist/htest/wilcoxTest.d.ts +10 -2
  163. package/dist/internal/dpq.d.ts +4 -0
  164. package/dist/internal/noncentral.d.ts +2 -0
  165. package/dist/internal/vectorize.d.ts +4 -0
  166. package/dist/linalg/basic.d.ts +39 -5
  167. package/dist/linalg/basic.js +15 -0
  168. package/dist/linalg/chol.d.ts +26 -5
  169. package/dist/linalg/chol.js +7 -0
  170. package/dist/linalg/eigen.d.ts +16 -7
  171. package/dist/linalg/eigen.js +6 -5
  172. package/dist/linalg/expm.d.ts +15 -5
  173. package/dist/linalg/expm.js +5 -3
  174. package/dist/linalg/kappa.d.ts +21 -1
  175. package/dist/linalg/kappa.js +16 -0
  176. package/dist/linalg/lu.d.ts +30 -6
  177. package/dist/linalg/lu.js +15 -3
  178. package/dist/linalg/matrix.d.ts +4 -0
  179. package/dist/linalg/norm.d.ts +16 -1
  180. package/dist/linalg/norm.js +9 -0
  181. package/dist/linalg/ops.d.ts +156 -35
  182. package/dist/linalg/ops.js +96 -15
  183. package/dist/linalg/qr.d.ts +87 -12
  184. package/dist/linalg/qr.js +31 -0
  185. package/dist/linalg/schur.d.ts +8 -2
  186. package/dist/linalg/schur.js +3 -1
  187. package/dist/linalg/solve.d.ts +42 -6
  188. package/dist/linalg/solve.js +22 -0
  189. package/dist/linalg/svd.d.ts +12 -2
  190. package/dist/linalg/svd.js +2 -0
  191. package/dist/linalg.js +2 -2
  192. package/dist/mixed.js +3 -0
  193. package/dist/models/anovaSequential.d.ts +26 -4
  194. package/dist/models/anovaSequential.js +3 -1
  195. package/dist/models/aovEz.d.ts +29 -6
  196. package/dist/models/aovEz.js +5 -2
  197. package/dist/models/aovStrata.d.ts +13 -3
  198. package/dist/models/aovStrata.js +5 -1
  199. package/dist/models/carAnova.d.ts +9 -3
  200. package/dist/models/carAnova.js +4 -2
  201. package/dist/models/coxph.d.ts +33 -7
  202. package/dist/models/coxph.js +8 -3
  203. package/dist/models/formula.d.ts +26 -1
  204. package/dist/models/formula.js +125 -9
  205. package/dist/models/glm.d.ts +128 -21
  206. package/dist/models/glm.js +71 -14
  207. package/dist/models/glmAnova.d.ts +30 -5
  208. package/dist/models/glmAnova.js +15 -2
  209. package/dist/models/glmConfint.d.ts +16 -2
  210. package/dist/models/glmConfint.js +9 -1
  211. package/dist/models/glmFamily.d.ts +27 -5
  212. package/dist/models/lm.d.ts +77 -19
  213. package/dist/models/lm.js +22 -4
  214. package/dist/models/lmer.d.ts +162 -0
  215. package/dist/models/lmer.js +457 -0
  216. package/dist/models/mauchly.d.ts +20 -5
  217. package/dist/models/mauchly.js +7 -3
  218. package/dist/models/mixedDeviance.d.ts +44 -0
  219. package/dist/models/mixedDeviance.js +872 -0
  220. package/dist/models/mixedStructure.d.ts +82 -0
  221. package/dist/models/mixedStructure.js +309 -0
  222. package/dist/models/modelFrame.d.ts +17 -2
  223. package/dist/models/modelFrame.js +36 -21
  224. package/dist/models/modelMatrix.d.ts +33 -8
  225. package/dist/models/modelMatrix.js +21 -5
  226. package/dist/models/survival.d.ts +41 -9
  227. package/dist/models/survival.js +10 -4
  228. package/dist/numerics/deriv.d.ts +21 -6
  229. package/dist/numerics/deriv.js +16 -5
  230. package/dist/numerics/integrate.d.ts +37 -7
  231. package/dist/numerics/integrate.js +8 -2
  232. package/dist/numerics/interp.d.ts +63 -12
  233. package/dist/numerics/interp.js +30 -6
  234. package/dist/numerics/ode.d.ts +15 -5
  235. package/dist/numerics/ode.js +5 -3
  236. package/dist/numerics.js +2 -2
  237. package/dist/optim/optim.d.ts +32 -8
  238. package/dist/optim/optim.js +8 -4
  239. package/dist/random/beta.d.ts +8 -0
  240. package/dist/random/beta.js +8 -0
  241. package/dist/random/binomial.d.ts +16 -0
  242. package/dist/random/binomial.js +16 -0
  243. package/dist/random/continuous.d.ts +51 -0
  244. package/dist/random/continuous.js +51 -0
  245. package/dist/random/extra.d.ts +66 -6
  246. package/dist/random/extra.js +66 -6
  247. package/dist/random/gamma.d.ts +33 -0
  248. package/dist/random/gamma.js +33 -0
  249. package/dist/random/hyper.d.ts +8 -0
  250. package/dist/random/hyper.js +8 -0
  251. package/dist/random/poisson.d.ts +25 -0
  252. package/dist/random/poisson.js +25 -0
  253. package/dist/random/r2dtable.d.ts +2 -0
  254. package/dist/random/r2dtable.js +2 -0
  255. package/dist/random/rank.d.ts +16 -0
  256. package/dist/random/rank.js +16 -0
  257. package/dist/random/rng.d.ts +49 -6
  258. package/dist/random/rng.js +29 -2
  259. package/dist/random/sample.d.ts +10 -2
  260. package/dist/random/sample.js +5 -1
  261. package/dist/random/streams.d.ts +13 -0
  262. package/dist/random/streams.js +13 -0
  263. package/dist/rstats.js +14 -14
  264. package/dist/special/besselIK.d.ts +11 -3
  265. package/dist/special/besselIK.js +6 -2
  266. package/dist/special/besselJY.d.ts +6 -2
  267. package/dist/special/besselJY.js +6 -2
  268. package/dist/special/beta.d.ts +16 -2
  269. package/dist/special/beta.js +16 -2
  270. package/dist/special/choose.d.ts +13 -5
  271. package/dist/special/choose.js +13 -5
  272. package/dist/special/erf.d.ts +8 -3
  273. package/dist/special/erf.js +8 -3
  274. package/dist/special/extra.d.ts +30 -10
  275. package/dist/special/extra.js +25 -9
  276. package/dist/special/gamma.d.ts +18 -2
  277. package/dist/special/gamma.js +18 -2
  278. package/dist/special/log1p.d.ts +16 -7
  279. package/dist/special/log1p.js +16 -7
  280. package/dist/special/psigamma.d.ts +9 -3
  281. package/dist/special/psigamma.js +9 -3
  282. package/dist/special/rCompatible.d.ts +5 -1
  283. package/dist/special.js +2 -2
  284. package/dist/tests.js +12 -12
  285. package/llms.txt +13 -3
  286. package/package.json +5 -1
  287. package/dist/chunks/chunk-7GQMKH3Z.js +0 -2
  288. package/dist/chunks/chunk-AHHS6AC4.js +0 -3
  289. package/dist/chunks/chunk-ALM3VHFP.js +0 -2
@@ -1,6 +1,14 @@
1
- /** Rotations of {@link factanal} */
1
+ /**
2
+ * Rotations of {@link factanal}
3
+ *
4
+ * @category Agreement, reliability and factor analysis
5
+ */
2
6
  export type FactanalRotation = "varimax" | "promax" | "none";
3
- /** Options of {@link factanal} */
7
+ /**
8
+ * Options of {@link factanal}
9
+ *
10
+ * @category Agreement, reliability and factor analysis
11
+ */
4
12
  export interface FactanalOptions {
5
13
  /** A covariance (or correlation) matrix to analyse instead of the data `x` (pass `null` as `x`). */
6
14
  covmat?: readonly (readonly number[])[];
@@ -8,6 +16,7 @@ export interface FactanalOptions {
8
16
  nObs?: number;
9
17
  /** Default `"varimax"`. */
10
18
  rotation?: FactanalRotation;
19
+ /** Settings of the optimisation (part of R's `control` list). */
11
20
  control?: {
12
21
  /** Lower bound of the uniquenesses. Default 0.005. */
13
22
  lower?: number;
@@ -15,8 +24,13 @@ export interface FactanalOptions {
15
24
  start?: readonly number[];
16
25
  };
17
26
  }
18
- /** Result of {@link factanal} */
27
+ /**
28
+ * Result of {@link factanal}
29
+ *
30
+ * @category Agreement, reliability and factor analysis
31
+ */
19
32
  export interface FactanalResult {
33
+ /** The uniquenesses, one per variable: the variance not explained by the factors. */
20
34
  uniquenesses: number[];
21
35
  /** The (rotated) loadings, p rows by `factors` columns, columns sorted by decreasing sum of squares, each column's sum positive */
22
36
  loadings: number[][];
@@ -24,9 +38,11 @@ export interface FactanalResult {
24
38
  rotmat?: number[][];
25
39
  /** The likelihood-ratio statistic (NaN without n.obs or with no degrees of freedom) */
26
40
  STATISTIC: number;
41
+ /** Degrees of freedom of the statistic, ((p - factors)^2 - (p + factors)) / 2. */
27
42
  dof: number;
28
43
  /** Its upper chi-squared tail probability (NaN as STATISTIC) */
29
44
  PVAL: number;
45
+ /** Whether the optimisation converged. */
30
46
  converged: boolean;
31
47
  /** The minimised criterion */
32
48
  objective: number;
@@ -42,15 +58,19 @@ export declare function varimax(L: readonly (readonly number[])[]): {
42
58
  };
43
59
  /**
44
60
  * Maximum-likelihood factor analysis of a data matrix (rows are observations) or, with `options.covmat`, of a
45
- * covariance matrix. Equivalent to R's `factanal()` with `rotation` `"varimax"`, `"promax"` or `"none"`.
61
+ * covariance matrix. Equivalent to R's `factanal()`. With `rotation` `"varimax"`, `"promax"` or `"none"`.
46
62
  *
47
63
  * @param x The data matrix (array of rows), or `null` with `options.covmat`.
48
64
  * @param factors The number of factors.
49
65
  *
50
66
  * @example
51
67
  * ```ts
52
- * const fa = factanal(x, 2); // x: an n x 6 data matrix
53
- * fa.uniquenesses; fa.loadings; fa.PVAL;
68
+ * const R = [[1, 0.72, 0.63], [0.72, 1, 0.56], [0.63, 0.56, 1]];
69
+ * const fa = factanal(null, 1, { covmat: R });
70
+ * fa.uniquenesses; // [0.19, 0.36, 0.51]
71
+ * fa.loadings; // [[0.9], [0.8], [0.7]]
54
72
  * ```
73
+ *
74
+ * @category Agreement, reliability and factor analysis
55
75
  */
56
76
  export declare function factanal(x: readonly (readonly number[])[] | null, factors: number, options?: FactanalOptions): FactanalResult;
@@ -92,16 +92,20 @@ function promax(L) {
92
92
  }
93
93
  /**
94
94
  * Maximum-likelihood factor analysis of a data matrix (rows are observations) or, with `options.covmat`, of a
95
- * covariance matrix. Equivalent to R's `factanal()` with `rotation` `"varimax"`, `"promax"` or `"none"`.
95
+ * covariance matrix. Equivalent to R's `factanal()`. With `rotation` `"varimax"`, `"promax"` or `"none"`.
96
96
  *
97
97
  * @param x The data matrix (array of rows), or `null` with `options.covmat`.
98
98
  * @param factors The number of factors.
99
99
  *
100
100
  * @example
101
101
  * ```ts
102
- * const fa = factanal(x, 2); // x: an n x 6 data matrix
103
- * fa.uniquenesses; fa.loadings; fa.PVAL;
102
+ * const R = [[1, 0.72, 0.63], [0.72, 1, 0.56], [0.63, 0.56, 1]];
103
+ * const fa = factanal(null, 1, { covmat: R });
104
+ * fa.uniquenesses; // [0.19, 0.36, 0.51]
105
+ * fa.loadings; // [[0.9], [0.8], [0.7]]
104
106
  * ```
107
+ *
108
+ * @category Agreement, reliability and factor analysis
105
109
  */
106
110
  export function factanal(x, factors, options = {}) {
107
111
  let cv;
@@ -1,5 +1,9 @@
1
1
  import type { Sample } from "../htest/types.js";
2
- /** Options for {@link pretty}. */
2
+ /**
3
+ * Options for {@link pretty}.
4
+ *
5
+ * @category Descriptive statistics
6
+ */
3
7
  export interface PrettyOptions {
4
8
  /** Desired number of intervals. Default `5`. */
5
9
  n?: number;
@@ -20,9 +24,15 @@ export interface PrettyOptions {
20
24
  * ```ts
21
25
  * pretty([0.3, 9.6]); // [0, 2, 4, 6, 8, 10]
22
26
  * ```
27
+ *
28
+ * @category Descriptive statistics
23
29
  */
24
30
  export declare function pretty(x: Sample, options?: PrettyOptions): number[];
25
- /** Options for {@link hist}. */
31
+ /**
32
+ * Options for {@link hist}.
33
+ *
34
+ * @category Descriptive statistics
35
+ */
26
36
  export interface HistOptions {
27
37
  /**
28
38
  * Break points, a number of cells (a suggestion for pretty), or a rule: `"Sturges"` (default), `"Scott"` or
@@ -34,22 +44,31 @@ export interface HistOptions {
34
44
  /** Close the first cell on the left (the last on the right when `right` is false). Default `true`. */
35
45
  includeLowest?: boolean;
36
46
  }
37
- /** Result of {@link hist}. */
47
+ /**
48
+ * Result of {@link hist}.
49
+ *
50
+ * @category Descriptive statistics
51
+ */
38
52
  export interface HistResult {
53
+ /** The cell boundaries, one more than the cells. */
39
54
  breaks: number[];
55
+ /** Number of values in each cell. */
40
56
  counts: number[];
41
57
  /** counts / (n * cell width) */
42
58
  density: number[];
59
+ /** Cell midpoints. */
43
60
  mids: number[];
44
61
  }
45
62
  /**
46
- * Histogram counts. Equivalent to R's `hist(x, plot = FALSE)`: break points (by default pretty points over the range
63
+ * Histogram counts. Equivalent to R's `hist(x, plot = FALSE)`. Break points (by default pretty points over the range
47
64
  * with about Sturges' number of cells), counts, densities and cell midpoints. Non-finite values are dropped.
48
65
  *
49
66
  * @example
50
67
  * ```ts
51
- * hist([1, 2, 2, 3, 3, 3, 4]).counts; // [3, 3, 1] for breaks [1, 2, 3, 4]
68
+ * hist([1, 2, 2, 3, 3, 3, 4]).counts; // [3, 3, 1] (for breaks [1, 2, 3, 4])
52
69
  * ```
70
+ *
71
+ * @category Descriptive statistics
53
72
  */
54
73
  export declare function hist(x: Sample, options?: HistOptions): HistResult;
55
74
  /**
@@ -58,7 +77,9 @@ export declare function hist(x: Sample, options?: HistOptions): HistResult;
58
77
  *
59
78
  * @example
60
79
  * ```ts
61
- * ecdf([3, 1, 2])(2); // 2/3
80
+ * ecdf([3, 1, 2])(2); // 0.6666666666666666
62
81
  * ```
82
+ *
83
+ * @category Descriptive statistics
63
84
  */
64
85
  export declare function ecdf(x: Sample): (q: number) => number;
@@ -19,6 +19,8 @@ import { seqLength } from "../internal/seq.js";
19
19
  * ```ts
20
20
  * pretty([0.3, 9.6]); // [0, 2, 4, 6, 8, 10]
21
21
  * ```
22
+ *
23
+ * @category Descriptive statistics
22
24
  */
23
25
  export function pretty(x, options = {}) {
24
26
  const finite = Array.from(x).filter(Number.isFinite);
@@ -176,13 +178,15 @@ function fuzzScale(br, dataRange) {
176
178
  return Math.min(...widths.filter((w) => w > 0));
177
179
  }
178
180
  /**
179
- * Histogram counts. Equivalent to R's `hist(x, plot = FALSE)`: break points (by default pretty points over the range
181
+ * Histogram counts. Equivalent to R's `hist(x, plot = FALSE)`. Break points (by default pretty points over the range
180
182
  * with about Sturges' number of cells), counts, densities and cell midpoints. Non-finite values are dropped.
181
183
  *
182
184
  * @example
183
185
  * ```ts
184
- * hist([1, 2, 2, 3, 3, 3, 4]).counts; // [3, 3, 1] for breaks [1, 2, 3, 4]
186
+ * hist([1, 2, 2, 3, 3, 3, 4]).counts; // [3, 3, 1] (for breaks [1, 2, 3, 4])
185
187
  * ```
188
+ *
189
+ * @category Descriptive statistics
186
190
  */
187
191
  export function hist(x, options = {}) {
188
192
  const xs = Array.from(x).filter(Number.isFinite);
@@ -277,8 +281,10 @@ function cellOf(v, f, right, includeLowest) {
277
281
  *
278
282
  * @example
279
283
  * ```ts
280
- * ecdf([3, 1, 2])(2); // 2/3
284
+ * ecdf([3, 1, 2])(2); // 0.6666666666666666
281
285
  * ```
286
+ *
287
+ * @category Descriptive statistics
282
288
  */
283
289
  export function ecdf(x) {
284
290
  const s = Array.from(x)
@@ -1,9 +1,13 @@
1
1
  import type { DataFrame } from "../models/modelFrame.js";
2
- /** A vector: numbers (`NaN` missing), or strings, booleans or numbers with `null` for a missing value. */
2
+ /**
3
+ * A vector: numbers (`NaN` missing), or strings, booleans or numbers with `null` for a missing value.
4
+ *
5
+ * @category Data frames
6
+ */
3
7
  export type MissingVector = readonly (number | string | boolean | null)[] | Float64Array;
4
8
  /**
5
- * Which rows have no missing value. Equivalent to R's `complete.cases()`: one boolean per row, true when no column of
6
- * any argument is missing (`null`, or `NaN` in a numeric column) in that row.
9
+ * Which rows have no missing value. Equivalent to R's `complete.cases()`. One boolean per row, true when no column
10
+ * of any argument is missing (`null`, or `NaN` in a numeric column) in that row.
7
11
  *
8
12
  * @param args Data frames (objects of equal-length columns) or arrays, all with the same number of rows.
9
13
  *
@@ -11,21 +15,24 @@ export type MissingVector = readonly (number | string | boolean | null)[] | Floa
11
15
  * ```ts
12
16
  * completeCases({ a: [1, NaN, 3], s: ["u", "v", null] }); // [true, false, false]
13
17
  * ```
18
+ *
19
+ * @category Data frames
14
20
  */
15
21
  export declare function completeCases(...args: (MissingVector | DataFrame)[]): boolean[];
16
22
  /**
17
- * The values that are not missing. Equivalent to R's `na.omit()` for a vector.
23
+ * The values that are not missing. Equivalent to R's `na.omit()`. For a vector.
18
24
  *
19
25
  * @example
20
26
  * ```ts
21
27
  * naOmit([1, NaN, 3]); // [1, 3]
22
28
  * ```
29
+ *
30
+ * @category Data frames
23
31
  */
24
32
  export declare function naOmit(x: readonly number[] | Float64Array): number[];
25
33
  export declare function naOmit<T extends string | boolean | number>(x: readonly (T | null)[]): T[];
26
34
  /**
27
- * The complete rows of a data frame. Equivalent to R's `na.omit()` for a data frame: the same columns, in order,
28
- * restricted to the rows where none is missing (`null`, or `NaN` in a numeric column); see {@link completeCases}.
35
+ * The complete rows of a data frame, as R's `na.omit()` for a data frame: the same columns, in order, restricted to the rows where none is missing (`null`, or `NaN` in a numeric column); see {@link completeCases}.
29
36
  *
30
37
  * @example
31
38
  * ```ts
@@ -17,8 +17,8 @@ function columnsOf(x) {
17
17
  return { columns, rows };
18
18
  }
19
19
  /**
20
- * Which rows have no missing value. Equivalent to R's `complete.cases()`: one boolean per row, true when no column of
21
- * any argument is missing (`null`, or `NaN` in a numeric column) in that row.
20
+ * Which rows have no missing value. Equivalent to R's `complete.cases()`. One boolean per row, true when no column
21
+ * of any argument is missing (`null`, or `NaN` in a numeric column) in that row.
22
22
  *
23
23
  * @param args Data frames (objects of equal-length columns) or arrays, all with the same number of rows.
24
24
  *
@@ -26,6 +26,8 @@ function columnsOf(x) {
26
26
  * ```ts
27
27
  * completeCases({ a: [1, NaN, 3], s: ["u", "v", null] }); // [true, false, false]
28
28
  * ```
29
+ *
30
+ * @category Data frames
29
31
  */
30
32
  export function completeCases(...args) {
31
33
  if (args.length === 0)
@@ -1,48 +1,116 @@
1
1
  import { type NaRmOptions } from "./basic.js";
2
2
  import type { Sample } from "../htest/types.js";
3
- /** Options for {@link skewness} and {@link kurtosis}. */
3
+ /**
4
+ * Options for {@link skewness} and {@link kurtosis}.
5
+ *
6
+ * @category Descriptive statistics
7
+ */
4
8
  export interface MomentOptions {
5
9
  /** e1071's type: 1, 2 or 3. Default `3`. */
6
10
  type?: 1 | 2 | 3;
7
11
  }
8
12
  /**
9
- * Sample skewness. Equivalent to `e1071::skewness()` (missing values dropped); `{ type: 1 }` is jStat's skewness.
13
+ * Sample skewness. Equivalent to `e1071::skewness()` in R. Missing values are dropped; `{ type: 1 }` is jStat's
14
+ * skewness.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * skewness([1, 2, 3, 10]); // 0.6614
19
+ * skewness([1, 2, 3, 10], { type: 2 }); // 1.7636
20
+ * ```
21
+ *
22
+ * @category Descriptive statistics
10
23
  */
11
24
  export declare function skewness(x: Sample, options?: MomentOptions): number;
12
25
  /**
13
- * Sample excess kurtosis. Equivalent to `e1071::kurtosis()` (missing values dropped); `{ type: 1 }` is jStat's
14
- * kurtosis.
26
+ * Sample excess kurtosis. Equivalent to `e1071::kurtosis()` in R. Missing values are dropped; `{ type: 1 }` is
27
+ * jStat's kurtosis.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * kurtosis([1, 2, 3, 10]); // -1.7454
32
+ * kurtosis([1, 2, 3, 10], { type: 1 }); // -0.7696
33
+ * ```
34
+ *
35
+ * @category Descriptive statistics
15
36
  */
16
37
  export declare function kurtosis(x: Sample, options?: MomentOptions): number;
17
38
  /**
18
- * Geometric mean exp(mean(log x)). Equivalent to `DescTools::Gmean()`: NaN with a negative value, 0 with a zero.
39
+ * Geometric mean exp(mean(log x)). Equivalent to `DescTools::Gmean()` in R. NaN with a negative value, 0 with a
40
+ * zero.
41
+ *
42
+ * @example
43
+ * ```ts
44
+ * geometricMean([1, 2, 4, 8]); // 2.82842712474619
45
+ * ```
46
+ *
47
+ * @category Descriptive statistics
19
48
  */
20
49
  export declare function geometricMean(x: Sample, options?: NaRmOptions): number;
21
50
  /**
22
- * The most frequent values (all of them, in increasing order) and their frequency. Equivalent to `DescTools::Mode()`
23
- * (missing values dropped): `value` is `[NaN]` and `frequency` NaN when every value occurs once.
51
+ * The most frequent values (all of them, in increasing order) and their frequency. Equivalent to
52
+ * `DescTools::Mode()` in R. Missing values are dropped; `value` is `[NaN]` and `frequency` NaN when every value
53
+ * occurs once.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * modes([1, 2, 2, 3, 3, 4]); // { value: [2, 3], frequency: 2 }
58
+ * ```
59
+ *
60
+ * @category Descriptive statistics
24
61
  */
25
62
  export declare function modes(x: Sample): {
63
+ /** The most frequent values, in increasing order (`[NaN]` when every value occurs once). */
26
64
  value: number[];
65
+ /** How often each of them occurs (NaN when every value occurs once). */
27
66
  frequency: number;
28
67
  };
29
- /** Options for {@link meanAD}. */
68
+ /**
69
+ * Options for {@link meanAD}.
70
+ *
71
+ * @category Descriptive statistics
72
+ */
30
73
  export interface MeanADOptions {
31
74
  /** Centre: the mean (default) or `"median"`, or a number. */
32
75
  center?: "mean" | "median" | number;
33
76
  }
34
- /** Mean absolute deviation from the centre. Equivalent to `DescTools::MeanAD()` (missing values dropped). */
77
+ /**
78
+ * Mean absolute deviation from the centre. Equivalent to `DescTools::MeanAD()` in R. Missing values are dropped.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * meanAD([1, 2, 3, 10]); // 3
83
+ * meanAD([1, 2, 3, 10], { center: "median" }); // 2.5
84
+ * ```
85
+ *
86
+ * @category Descriptive statistics
87
+ */
35
88
  export declare function meanAD(x: Sample, options?: MeanADOptions): number;
36
- /** Options for {@link cv}. */
89
+ /**
90
+ * Options for {@link cv}.
91
+ *
92
+ * @category Descriptive statistics
93
+ */
37
94
  export interface CvOptions extends NaRmOptions {
38
95
  /** Small-sample correction. Default `false`. */
39
96
  unbiased?: boolean;
40
97
  }
41
98
  /**
42
- * Coefficient of variation sd / mean (sample standard deviation). Equivalent to `DescTools::CoefVar()`.
99
+ * Coefficient of variation sd / mean (sample standard deviation). Equivalent to `DescTools::CoefVar()` in R.
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * cv([2, 4, 4, 4, 5, 5, 7, 9]); // 0.4276
104
+ * ```
105
+ *
106
+ * @category Descriptive statistics
43
107
  */
44
108
  export declare function cv(x: Sample, options?: CvOptions): number;
45
- /** Options for {@link scale}. */
109
+ /**
110
+ * Options for {@link scale}.
111
+ *
112
+ * @category Descriptive statistics
113
+ */
46
114
  export interface ScaleOptions {
47
115
  /** Subtract the column means (`true`, default), nothing (`false`) or the given values. */
48
116
  center?: boolean | readonly number[];
@@ -53,11 +121,21 @@ export interface ScaleOptions {
53
121
  scale?: boolean | readonly number[];
54
122
  }
55
123
  /**
56
- * Centre and scale the columns of a matrix (array of rows; a vector is one column). Equivalent to R's `scale()`:
124
+ * Centre and scale the columns of a matrix (array of rows; a vector is one column). Equivalent to R's `scale()`.
57
125
  * `center` and `scale` report the values used (R's attributes), when any.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * scale([1, 2, 3]); // { scaled: [[-1], [0], [1]], center: [2], scale: [1] }
130
+ * ```
131
+ *
132
+ * @category Descriptive statistics
58
133
  */
59
134
  export declare function scale(x: Sample | readonly (readonly number[])[], options?: ScaleOptions): {
135
+ /** The centred and scaled matrix, as an array of rows (R's returned matrix). */
60
136
  scaled: number[][];
137
+ /** The values subtracted from each column (R's `scaled:center` attribute); absent with `center: false`. */
61
138
  center?: number[];
139
+ /** The values each column was divided by (R's `scaled:scale` attribute); absent with `scale: false`. */
62
140
  scale?: number[];
63
141
  };
@@ -29,7 +29,16 @@ function checkType(type) {
29
29
  throw new RangeError("Invalid 'type' argument.");
30
30
  }
31
31
  /**
32
- * Sample skewness. Equivalent to `e1071::skewness()` (missing values dropped); `{ type: 1 }` is jStat's skewness.
32
+ * Sample skewness. Equivalent to `e1071::skewness()` in R. Missing values are dropped; `{ type: 1 }` is jStat's
33
+ * skewness.
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * skewness([1, 2, 3, 10]); // 0.6614
38
+ * skewness([1, 2, 3, 10], { type: 2 }); // 1.7636
39
+ * ```
40
+ *
41
+ * @category Descriptive statistics
33
42
  */
34
43
  export function skewness(x, options = {}) {
35
44
  const type = options.type ?? 3;
@@ -48,8 +57,16 @@ export function skewness(x, options = {}) {
48
57
  return g1 * (1 - 1 / n) ** 1.5;
49
58
  }
50
59
  /**
51
- * Sample excess kurtosis. Equivalent to `e1071::kurtosis()` (missing values dropped); `{ type: 1 }` is jStat's
52
- * kurtosis.
60
+ * Sample excess kurtosis. Equivalent to `e1071::kurtosis()` in R. Missing values are dropped; `{ type: 1 }` is
61
+ * jStat's kurtosis.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * kurtosis([1, 2, 3, 10]); // -1.7454
66
+ * kurtosis([1, 2, 3, 10], { type: 1 }); // -0.7696
67
+ * ```
68
+ *
69
+ * @category Descriptive statistics
53
70
  */
54
71
  export function kurtosis(x, options = {}) {
55
72
  const type = options.type ?? 3;
@@ -68,7 +85,15 @@ export function kurtosis(x, options = {}) {
68
85
  return r * (1 - 1 / n) ** 2 - 3;
69
86
  }
70
87
  /**
71
- * Geometric mean exp(mean(log x)). Equivalent to `DescTools::Gmean()`: NaN with a negative value, 0 with a zero.
88
+ * Geometric mean exp(mean(log x)). Equivalent to `DescTools::Gmean()` in R. NaN with a negative value, 0 with a
89
+ * zero.
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * geometricMean([1, 2, 4, 8]); // 2.82842712474619
94
+ * ```
95
+ *
96
+ * @category Descriptive statistics
72
97
  */
73
98
  export function geometricMean(x, options = {}) {
74
99
  const xs = values(x, options.naRm);
@@ -81,8 +106,16 @@ export function geometricMean(x, options = {}) {
81
106
  return Math.exp(meanOf(xs.map(Math.log)));
82
107
  }
83
108
  /**
84
- * The most frequent values (all of them, in increasing order) and their frequency. Equivalent to `DescTools::Mode()`
85
- * (missing values dropped): `value` is `[NaN]` and `frequency` NaN when every value occurs once.
109
+ * The most frequent values (all of them, in increasing order) and their frequency. Equivalent to
110
+ * `DescTools::Mode()` in R. Missing values are dropped; `value` is `[NaN]` and `frequency` NaN when every value
111
+ * occurs once.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * modes([1, 2, 2, 3, 3, 4]); // { value: [2, 3], frequency: 2 }
116
+ * ```
117
+ *
118
+ * @category Descriptive statistics
86
119
  */
87
120
  export function modes(x) {
88
121
  const xs = values(x, true);
@@ -97,7 +130,17 @@ export function modes(x) {
97
130
  const value = [...counts.entries()].filter(([, c]) => c === best).map(([v]) => v);
98
131
  return { value: value.sort((a, b) => a - b), frequency: best };
99
132
  }
100
- /** Mean absolute deviation from the centre. Equivalent to `DescTools::MeanAD()` (missing values dropped). */
133
+ /**
134
+ * Mean absolute deviation from the centre. Equivalent to `DescTools::MeanAD()` in R. Missing values are dropped.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * meanAD([1, 2, 3, 10]); // 3
139
+ * meanAD([1, 2, 3, 10], { center: "median" }); // 2.5
140
+ * ```
141
+ *
142
+ * @category Descriptive statistics
143
+ */
101
144
  export function meanAD(x, options = {}) {
102
145
  const xs = values(x, true);
103
146
  const c = options.center ?? "mean";
@@ -105,7 +148,14 @@ export function meanAD(x, options = {}) {
105
148
  return meanOf(xs.map((v) => Math.abs(v - center)));
106
149
  }
107
150
  /**
108
- * Coefficient of variation sd / mean (sample standard deviation). Equivalent to `DescTools::CoefVar()`.
151
+ * Coefficient of variation sd / mean (sample standard deviation). Equivalent to `DescTools::CoefVar()` in R.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * cv([2, 4, 4, 4, 5, 5, 7, 9]); // 0.4276
156
+ * ```
157
+ *
158
+ * @category Descriptive statistics
109
159
  */
110
160
  export function cv(x, options = {}) {
111
161
  const xs = values(x, options.naRm);
@@ -118,8 +168,15 @@ export function cv(x, options = {}) {
118
168
  return res;
119
169
  }
120
170
  /**
121
- * Centre and scale the columns of a matrix (array of rows; a vector is one column). Equivalent to R's `scale()`:
171
+ * Centre and scale the columns of a matrix (array of rows; a vector is one column). Equivalent to R's `scale()`.
122
172
  * `center` and `scale` report the values used (R's attributes), when any.
173
+ *
174
+ * @example
175
+ * ```ts
176
+ * scale([1, 2, 3]); // { scaled: [[-1], [0], [1]], center: [2], scale: [1] }
177
+ * ```
178
+ *
179
+ * @category Descriptive statistics
123
180
  */
124
181
  export function scale(x, options = {}) {
125
182
  const rows = x.length > 0 && Array.isArray(x[0]) ? x.map((r) => [...r]) : Array.from(x, (v) => [v]);
@@ -1,11 +1,19 @@
1
- /** Options of {@link omega} */
1
+ /**
2
+ * Options of {@link omega}
3
+ *
4
+ * @category Agreement, reliability and factor analysis
5
+ */
2
6
  export interface OmegaOptions {
3
7
  /** The number of first-order (group) factors. Default 3. */
4
8
  nfactors?: number;
5
9
  /** A correlation (or covariance) matrix to analyse instead of the data `x` (pass `null` as `x`). */
6
10
  covmat?: readonly (readonly number[])[];
7
11
  }
8
- /** Result of {@link omega} */
12
+ /**
13
+ * Result of {@link omega}
14
+ *
15
+ * @category Agreement, reliability and factor analysis
16
+ */
9
17
  export interface OmegaResult {
10
18
  /** Omega hierarchical: the share of the total variance due to the general factor */
11
19
  omegaH: number;
@@ -35,13 +43,15 @@ export interface OmegaResult {
35
43
  key: number[];
36
44
  /** Rows g, F1*, ...; columns total, general, group (NaN for a group with no items) */
37
45
  omegaGroup: number[][];
46
+ /** The warnings R would give (e.g. an ultra-Heywood case, or one factor), each once. */
38
47
  warnings: string[];
48
+ /** The messages R would print (e.g. for two factors), each once. */
39
49
  messages: string[];
40
50
  }
41
51
  /**
42
52
  * McDonald's omega (hierarchical, asymptotic and total) from a Schmid-Leiman transformation of an oblique minres
43
- * factor solution. Equivalent to R's `psych::omega(x, nfactors)` with its defaults (`fm = "minres"`, `rotate =
44
- * "oblimin"`, `option = "equal"`, `flip = TRUE`).
53
+ * factor solution. Equivalent to `psych::omega()` in R. With its defaults (`fm = "minres"`, `rotate = "oblimin"`,
54
+ * `option = "equal"`, `flip = TRUE`).
45
55
  *
46
56
  * @param x The data matrix (array of rows, NaN for missing values: correlations of pairwise complete observations),
47
57
  * or `null` with `options.covmat`.
@@ -49,8 +59,20 @@ export interface OmegaResult {
49
59
  *
50
60
  * @example
51
61
  * ```ts
52
- * const om = omega(x); // x: an n x 12 data matrix
53
- * om.omegaH; om.omegaTot; om.sl;
62
+ * // 6 items: general loadings 0.6, three pairs with group loadings 0.4
63
+ * const R = [
64
+ * [1, 0.52, 0.36, 0.36, 0.36, 0.36],
65
+ * [0.52, 1, 0.36, 0.36, 0.36, 0.36],
66
+ * [0.36, 0.36, 1, 0.52, 0.36, 0.36],
67
+ * [0.36, 0.36, 0.52, 1, 0.36, 0.36],
68
+ * [0.36, 0.36, 0.36, 0.36, 1, 0.52],
69
+ * [0.36, 0.36, 0.36, 0.36, 0.52, 1],
70
+ * ];
71
+ * const om = omega(null, { covmat: R });
72
+ * om.omegaH; // 0.7297
73
+ * om.omegaTot; // 0.8378378378378378
54
74
  * ```
75
+ *
76
+ * @category Agreement, reliability and factor analysis
55
77
  */
56
78
  export declare function omega(x: readonly (readonly number[])[] | null, options?: OmegaOptions): OmegaResult;
@@ -183,8 +183,8 @@ function oblimin(A) {
183
183
  }
184
184
  /**
185
185
  * McDonald's omega (hierarchical, asymptotic and total) from a Schmid-Leiman transformation of an oblique minres
186
- * factor solution. Equivalent to R's `psych::omega(x, nfactors)` with its defaults (`fm = "minres"`, `rotate =
187
- * "oblimin"`, `option = "equal"`, `flip = TRUE`).
186
+ * factor solution. Equivalent to `psych::omega()` in R. With its defaults (`fm = "minres"`, `rotate = "oblimin"`,
187
+ * `option = "equal"`, `flip = TRUE`).
188
188
  *
189
189
  * @param x The data matrix (array of rows, NaN for missing values: correlations of pairwise complete observations),
190
190
  * or `null` with `options.covmat`.
@@ -192,9 +192,21 @@ function oblimin(A) {
192
192
  *
193
193
  * @example
194
194
  * ```ts
195
- * const om = omega(x); // x: an n x 12 data matrix
196
- * om.omegaH; om.omegaTot; om.sl;
195
+ * // 6 items: general loadings 0.6, three pairs with group loadings 0.4
196
+ * const R = [
197
+ * [1, 0.52, 0.36, 0.36, 0.36, 0.36],
198
+ * [0.52, 1, 0.36, 0.36, 0.36, 0.36],
199
+ * [0.36, 0.36, 1, 0.52, 0.36, 0.36],
200
+ * [0.36, 0.36, 0.52, 1, 0.36, 0.36],
201
+ * [0.36, 0.36, 0.36, 0.36, 1, 0.52],
202
+ * [0.36, 0.36, 0.36, 0.36, 0.52, 1],
203
+ * ];
204
+ * const om = omega(null, { covmat: R });
205
+ * om.omegaH; // 0.7297
206
+ * om.omegaTot; // 0.8378378378378378
197
207
  * ```
208
+ *
209
+ * @category Agreement, reliability and factor analysis
198
210
  */
199
211
  export function omega(x, options = {}) {
200
212
  const q = options.nfactors ?? 3;