@numero-uno-jpn/rstats 1.2.0 → 1.4.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 (89) hide show
  1. package/CHANGELOG.md +128 -0
  2. package/README.ja.md +28 -11
  3. package/README.md +27 -10
  4. package/dist/chunks/{chunk-RRO4LMCB.js → chunk-27VFB3SA.js} +2 -2
  5. package/dist/chunks/{chunk-BKV3FINA.js → chunk-56GFP4UU.js} +2 -2
  6. package/dist/chunks/{chunk-JWBSEL3V.js → chunk-5SW3L6J3.js} +2 -2
  7. package/dist/chunks/{chunk-NSU6U3ET.js → chunk-6FZAJQ4H.js} +2 -2
  8. package/dist/chunks/{chunk-VERBXW6E.js → chunk-BQJFFGYP.js} +2 -2
  9. package/dist/chunks/{chunk-ORE5ZRCY.js → chunk-F6Z3GLWA.js} +2 -2
  10. package/dist/chunks/{chunk-2NNBUYHJ.js → chunk-GBSMRVUY.js} +2 -2
  11. package/dist/chunks/{chunk-7WG7X2UI.js → chunk-GEF2YRBV.js} +2 -2
  12. package/dist/chunks/{chunk-L23RSC2N.js → chunk-GIER5WMB.js} +2 -2
  13. package/dist/chunks/{chunk-IAWXF73N.js → chunk-GLGOV3A5.js} +2 -2
  14. package/dist/chunks/{chunk-F3EQLL4F.js → chunk-H72MW7YP.js} +2 -2
  15. package/dist/chunks/{chunk-T5DRIITM.js → chunk-HWB7XRX2.js} +2 -2
  16. package/dist/chunks/chunk-J72MLFUG.js +2 -0
  17. package/dist/chunks/{chunk-TNETWBF5.js → chunk-PZ66PUWC.js} +2 -2
  18. package/dist/chunks/{chunk-IMPRIQE5.js → chunk-RUZATICF.js} +1 -1
  19. package/dist/chunks/{chunk-BI7NYJWP.js → chunk-RY7CCWVU.js} +1 -1
  20. package/dist/chunks/{chunk-7INBXTVV.js → chunk-S2YCFUCA.js} +2 -2
  21. package/dist/chunks/chunk-SVS54D6Z.js +2 -0
  22. package/dist/chunks/{chunk-HBHMEPGY.js → chunk-TEHMTQNB.js} +3 -3
  23. package/dist/chunks/chunk-UMMCVF53.js +2 -0
  24. package/dist/chunks/{chunk-5SGTWSCB.js → chunk-UNP4HBPP.js} +2 -2
  25. package/dist/chunks/{chunk-A66M3ZEA.js → chunk-V2KVTAVV.js} +2 -2
  26. package/dist/chunks/{chunk-EEU7D4RU.js → chunk-WWJGCBWH.js} +1 -1
  27. package/dist/chunks/chunk-X7K6EF7S.js +2 -0
  28. package/dist/chunks/{chunk-73LNRWU3.js → chunk-YBOSCQF2.js} +1 -1
  29. package/dist/chunks/{chunk-6FZHTD5G.js → chunk-ZQSOMEIM.js} +2 -2
  30. package/dist/chunks/{chunk-4AOTAT3O.js → chunk-ZRFZ5UIB.js} +2 -2
  31. package/dist/descriptive.js +2 -2
  32. package/dist/distributions.js +2 -2
  33. package/dist/entries/tests.d.ts +13 -0
  34. package/dist/entries/tests.js +13 -0
  35. package/dist/htest/agreement.d.ts +2 -2
  36. package/dist/htest/blandAltman.d.ts +100 -0
  37. package/dist/htest/blandAltman.js +159 -0
  38. package/dist/htest/diagnosticTests.d.ts +91 -0
  39. package/dist/htest/diagnosticTests.js +116 -0
  40. package/dist/htest/iccPsych.d.ts +106 -0
  41. package/dist/htest/iccPsych.js +332 -0
  42. package/dist/htest/ksTest.d.ts +1 -1
  43. package/dist/htest/mcreg.d.ts +209 -0
  44. package/dist/htest/mcreg.js +735 -0
  45. package/dist/htest/roc.d.ts +287 -0
  46. package/dist/htest/roc.js +635 -0
  47. package/dist/htest/rocTest.d.ts +139 -0
  48. package/dist/htest/rocTest.js +444 -0
  49. package/dist/htest/tTOST.d.ts +202 -0
  50. package/dist/htest/tTOST.js +558 -0
  51. package/dist/htest/trendTests.d.ts +1 -1
  52. package/dist/htest/trendTests.js +1 -1
  53. package/dist/internal/summary.js +5 -0
  54. package/dist/linalg/qr.d.ts +3 -0
  55. package/dist/linalg/qr.js +3 -0
  56. package/dist/linalg.js +2 -2
  57. package/dist/mixed.js +2 -2
  58. package/dist/models/coeftest.d.ts +139 -0
  59. package/dist/models/coeftest.js +237 -0
  60. package/dist/models/competingRisks.d.ts +188 -0
  61. package/dist/models/competingRisks.js +673 -0
  62. package/dist/models/coxZph.d.ts +67 -0
  63. package/dist/models/coxZph.js +479 -0
  64. package/dist/models/coxph.d.ts +107 -16
  65. package/dist/models/coxph.js +641 -72
  66. package/dist/models/glm.d.ts +11 -1
  67. package/dist/models/glm.js +19 -2
  68. package/dist/models/inputRows.d.ts +10 -0
  69. package/dist/models/inputRows.js +23 -0
  70. package/dist/models/lm.d.ts +8 -0
  71. package/dist/models/lm.js +14 -2
  72. package/dist/models/rmst2.d.ts +126 -0
  73. package/dist/models/rmst2.js +365 -0
  74. package/dist/models/sandwich.d.ts +177 -0
  75. package/dist/models/sandwich.js +923 -0
  76. package/dist/models/survival.d.ts +65 -24
  77. package/dist/models/survival.js +407 -72
  78. package/dist/models/survreg.d.ts +160 -0
  79. package/dist/models/survreg.js +809 -0
  80. package/dist/numerics.js +2 -2
  81. package/dist/random/rng.d.ts +8 -1
  82. package/dist/random/rng.js +14 -1
  83. package/dist/rstats.js +16 -16
  84. package/dist/special.js +2 -2
  85. package/dist/tests.js +13 -13
  86. package/llms.txt +25 -0
  87. package/package.json +1 -1
  88. package/dist/chunks/chunk-47IIPUFN.js +0 -2
  89. package/dist/chunks/chunk-CQB4BJBR.js +0 -2
@@ -0,0 +1,160 @@
1
+ /** Built-in parametric distributions supported by {@link survreg}.
2
+ * @category Survival analysis
3
+ */
4
+ export type SurvregDistribution = "extreme" | "logistic" | "gaussian" | "weibull" | "exponential" | "rayleigh" | "loggaussian" | "lognormal" | "loglogistic" | "t";
5
+ /** Censoring representation accepted by {@link survreg}.
6
+ * @category Survival analysis
7
+ */
8
+ export type SurvregType = "right" | "left" | "interval" | "interval2";
9
+ /** Iteration controls for {@link survreg}.
10
+ * @category Survival analysis
11
+ */
12
+ export interface SurvregControl {
13
+ maxiter?: number;
14
+ relTolerance?: number;
15
+ tolerChol?: number;
16
+ }
17
+ /** Options for {@link survreg}.
18
+ * @category Survival analysis
19
+ */
20
+ export interface SurvregOptions {
21
+ type?: SurvregType;
22
+ time2?: readonly number[];
23
+ dist?: SurvregDistribution;
24
+ weights?: readonly number[];
25
+ offset?: readonly number[];
26
+ strata?: readonly (string | number | boolean)[];
27
+ scale?: number;
28
+ init?: readonly number[];
29
+ df?: number;
30
+ control?: SurvregControl;
31
+ intercept?: boolean;
32
+ confLevel?: number;
33
+ }
34
+ /** Coefficient and log-scale summary table.
35
+ * @category Survival analysis
36
+ */
37
+ export interface SurvregTable {
38
+ value: number[];
39
+ se: number[];
40
+ z: number[];
41
+ p: number[];
42
+ }
43
+ /** Result of {@link survreg}, including the fitted model data needed by diagnostics.
44
+ * @category Survival analysis
45
+ */
46
+ export interface SurvregResult {
47
+ coefficients: number[];
48
+ coefNames: string[];
49
+ scale: number[];
50
+ table: SurvregTable;
51
+ strataLevels: (string | number | boolean)[];
52
+ hasOffset: boolean;
53
+ icoef: number[];
54
+ var: number[][];
55
+ loglik: [number, number];
56
+ iter: number;
57
+ df: number;
58
+ idf: number;
59
+ dfResidual: number;
60
+ n: number;
61
+ linearPredictors: number[];
62
+ means: number[];
63
+ score: number[];
64
+ tableRowNames: string[];
65
+ value: number[];
66
+ se: number[];
67
+ z: number[];
68
+ p: number[];
69
+ chi: number;
70
+ chiDf: number;
71
+ chiP: number;
72
+ dist: SurvregDistribution;
73
+ distributionDf: number;
74
+ parms: number;
75
+ intercept: boolean;
76
+ x: number[][];
77
+ offset: number[];
78
+ rows: number[];
79
+ weights: number[];
80
+ strata: number[];
81
+ y: number[];
82
+ lower: number[];
83
+ upper: number[];
84
+ status: number[];
85
+ type: SurvregType;
86
+ warnings: string[];
87
+ }
88
+ /** Prediction options for {@link survregPredict}.
89
+ * @category Survival analysis
90
+ */
91
+ export interface SurvregPredictOptions {
92
+ type?: "lp" | "linear" | "link" | "response" | "quantile" | "uquantile";
93
+ p?: number | readonly number[];
94
+ newX?: readonly (readonly number[])[];
95
+ newStrata?: readonly (string | number | boolean)[];
96
+ newOffset?: readonly number[];
97
+ seFit?: boolean;
98
+ }
99
+ /** Predictions and their standard errors.
100
+ * @category Survival analysis
101
+ */
102
+ export interface SurvregPredictionResult {
103
+ fit: number[] | number[][];
104
+ seFit?: number[] | number[][];
105
+ warnings: string[];
106
+ }
107
+ /** Residual options for {@link survregResiduals}.
108
+ * @category Survival analysis
109
+ */
110
+ export interface SurvregResidualsOptions {
111
+ type?: "response" | "deviance" | "working" | "dfbeta" | "dfbetas" | "ldcase" | "ldresp" | "ldshape" | "matrix";
112
+ weighted?: boolean;
113
+ }
114
+ /**
115
+ * Fit a parametric survival regression model. Equivalent to R's `survival::survreg()`.
116
+ *
117
+ * Supports right, left and interval censoring, separate log-scales by stratum, case weights, offsets and the
118
+ * extreme-value, logistic, Gaussian and t families (including their log-time forms).
119
+ *
120
+ * @param time Observed time or lower interval endpoint.
121
+ * @param event Event/status indicator; for interval data use 0=right, 1=exact, 2=left, 3=interval.
122
+ * @param x Predictor matrix (one row per observation); the intercept is added by default.
123
+ * @param options Distribution, censoring, weights, strata, scale, starting values and iteration controls.
124
+ * @returns The fitted coefficients, covariance, likelihoods, score, summary table and data needed for predictions/residuals.
125
+ *
126
+ * @example
127
+ * ```ts
128
+ * const fit = survreg([1, 2, 3, 4, 5, 6], [1, 1, 0, 1, 0, 1], [[0], [1], [0], [1], [0], [1]], { dist: "weibull" });
129
+ * fit.coefficients.length; // 2
130
+ * ```
131
+ *
132
+ * @category Survival analysis
133
+ */
134
+ export declare function survreg(time: readonly number[], event?: readonly (number | boolean)[], x?: readonly (readonly number[])[], options?: SurvregOptions): SurvregResult;
135
+ /**
136
+ * Predictions from a parametric survival regression fit. Equivalent to R's `predict.survreg()`.
137
+ * @param fit A fit returned by {@link survreg}.
138
+ * @param options Prediction type, quantile probabilities and optional new covariates.
139
+ * @returns Predictions; a matrix is returned for multiple quantiles.
140
+ * @example
141
+ * ```ts
142
+ * const fit = survreg([1, 2, 3, 4, 5], [1, 1, 0, 1, 0], [[0], [1], [0], [1], [0]]);
143
+ * survregPredict(fit, { type: "response" });
144
+ * ```
145
+ * @category Survival analysis
146
+ */
147
+ export declare function survregPredict(fit: SurvregResult, options?: SurvregPredictOptions): number[] | number[][] | SurvregPredictionResult;
148
+ /**
149
+ * Residuals from a parametric survival regression fit. Equivalent to R's `residuals.survreg()`.
150
+ * @param fit A fit returned by {@link survreg}.
151
+ * @param options Residual type and whether to multiply by case weights.
152
+ * @returns A vector or matrix of residual diagnostics.
153
+ * @example
154
+ * ```ts
155
+ * const fit = survreg([1, 2, 3, 4, 5], [1, 1, 0, 1, 0]);
156
+ * survregResiduals(fit, { type: "working" });
157
+ * ```
158
+ * @category Survival analysis
159
+ */
160
+ export declare function survregResiduals(fit: SurvregResult, options?: SurvregResidualsOptions): number[] | number[][];