@numero-uno-jpn/rstats 1.17.0 → 1.19.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 (97) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.ja.md +7 -7
  3. package/README.md +7 -7
  4. package/dist/causal/mediationProcedures.js +18 -1
  5. package/dist/causal/moderation.js +11 -2
  6. package/dist/causal.js +2 -2
  7. package/dist/chunks/chunk-2S45NNTL.js +2 -0
  8. package/dist/chunks/chunk-4JFGT4PN.js +2 -0
  9. package/dist/chunks/chunk-4JRJU5F5.js +2 -0
  10. package/dist/chunks/{chunk-KY53MB3J.js → chunk-5NW4WT4F.js} +2 -2
  11. package/dist/chunks/chunk-6ZGEYAFC.js +2 -0
  12. package/dist/chunks/{chunk-XR7Y4ZV6.js → chunk-7D7FBLWD.js} +2 -2
  13. package/dist/chunks/chunk-ANFN3X2M.js +2 -0
  14. package/dist/chunks/{chunk-NCRL33PQ.js → chunk-AS2XTRHH.js} +2 -2
  15. package/dist/chunks/chunk-BJ5WAL2C.js +2 -0
  16. package/dist/chunks/{chunk-EIUK6TKF.js → chunk-CEOSH3H2.js} +2 -2
  17. package/dist/chunks/{chunk-VZSQAGL2.js → chunk-CMNKXRZF.js} +2 -2
  18. package/dist/chunks/{chunk-XEJX5HBJ.js → chunk-CNJLPH6W.js} +2 -2
  19. package/dist/chunks/{chunk-TTOJDLIQ.js → chunk-DXSVV47D.js} +2 -2
  20. package/dist/chunks/{chunk-GIIURG5X.js → chunk-FAKOND5W.js} +2 -2
  21. package/dist/chunks/chunk-FCGTZ6BD.js +2 -0
  22. package/dist/chunks/{chunk-O4D43LWM.js → chunk-FELX2TZZ.js} +2 -2
  23. package/dist/chunks/{chunk-EB45CDFA.js → chunk-G4B2SQR6.js} +2 -2
  24. package/dist/chunks/chunk-HPIZAWMT.js +2 -0
  25. package/dist/chunks/chunk-I5XUWUEV.js +2 -0
  26. package/dist/chunks/{chunk-JG4TWDQ4.js → chunk-ILQ4VWSD.js} +2 -2
  27. package/dist/chunks/chunk-JLFRYDYO.js +2 -0
  28. package/dist/chunks/{chunk-GTSK4IN4.js → chunk-JXKHFSGK.js} +1 -1
  29. package/dist/chunks/{chunk-YMI33F7W.js → chunk-LBU73UMS.js} +2 -2
  30. package/dist/chunks/{chunk-ZRKXHVTJ.js → chunk-LSZTDKIB.js} +2 -2
  31. package/dist/chunks/chunk-LWFKGF43.js +2 -0
  32. package/dist/chunks/{chunk-NCDPZSI2.js → chunk-M5J3DHXB.js} +2 -2
  33. package/dist/chunks/{chunk-DD2GG4EC.js → chunk-MOYWWJP4.js} +1 -1
  34. package/dist/chunks/{chunk-I2KJMF4G.js → chunk-MPBFXHXT.js} +1 -1
  35. package/dist/chunks/chunk-NWNJEAKI.js +2 -0
  36. package/dist/chunks/{chunk-GOYTZ5RB.js → chunk-OTETSONJ.js} +2 -2
  37. package/dist/chunks/{chunk-V54MBEJM.js → chunk-QH4GK3JN.js} +2 -2
  38. package/dist/chunks/chunk-QVE7V5UG.js +2 -0
  39. package/dist/chunks/{chunk-RNGDVSTS.js → chunk-RMGEIU4Z.js} +2 -2
  40. package/dist/chunks/{chunk-LKKUUREA.js → chunk-SAFH76DR.js} +2 -2
  41. package/dist/chunks/{chunk-QCPGV7XH.js → chunk-SJJJ7Y4X.js} +2 -2
  42. package/dist/chunks/{chunk-L77QFL3C.js → chunk-TVU4N6BA.js} +2 -2
  43. package/dist/chunks/{chunk-6MLDKHTY.js → chunk-U6RXYALO.js} +2 -2
  44. package/dist/chunks/chunk-VNLSP22M.js +2 -0
  45. package/dist/chunks/chunk-W4EITKLJ.js +2 -0
  46. package/dist/chunks/{chunk-JHABMYNH.js → chunk-WWRKCRTZ.js} +1 -1
  47. package/dist/chunks/{chunk-NPWWGIFG.js → chunk-XHHDBEHB.js} +2 -2
  48. package/dist/chunks/{chunk-72I7GDWL.js → chunk-XJMBX6A2.js} +2 -2
  49. package/dist/chunks/chunk-YZ6SBFFG.js +2 -0
  50. package/dist/descriptive/qcc.d.ts +320 -0
  51. package/dist/descriptive/qcc.js +524 -0
  52. package/dist/descriptive/qccTools.d.ts +301 -0
  53. package/dist/descriptive/qccTools.js +390 -0
  54. package/dist/descriptive.js +2 -2
  55. package/dist/distributions/normal.d.ts +4 -0
  56. package/dist/distributions/normal.js +4 -2
  57. package/dist/distributions.js +2 -2
  58. package/dist/entries/descriptive.d.ts +2 -0
  59. package/dist/entries/descriptive.js +2 -0
  60. package/dist/entries/regression.d.ts +1 -0
  61. package/dist/entries/regression.js +2 -0
  62. package/dist/entries/tests.d.ts +1 -0
  63. package/dist/entries/tests.js +1 -0
  64. package/dist/htest/timeROC.d.ts +564 -0
  65. package/dist/htest/timeROC.js +1106 -0
  66. package/dist/linalg.js +2 -2
  67. package/dist/mixed.js +2 -2
  68. package/dist/models/betareg.js +14 -2
  69. package/dist/models/bradleyterry.d.ts +188 -0
  70. package/dist/models/bradleyterry.js +533 -0
  71. package/dist/models/survreg.d.ts +5 -0
  72. package/dist/models/survreg.js +23 -3
  73. package/dist/models/tobit.js +16 -5
  74. package/dist/multivariate.js +2 -2
  75. package/dist/numerics.js +2 -2
  76. package/dist/regression.js +3 -3
  77. package/dist/rstats.js +18 -18
  78. package/dist/special.js +2 -2
  79. package/dist/tests.js +15 -15
  80. package/dist/timeseries.js +2 -2
  81. package/package.json +1 -1
  82. package/dist/chunks/chunk-23QCIPET.js +0 -2
  83. package/dist/chunks/chunk-3UEYA6VG.js +0 -2
  84. package/dist/chunks/chunk-3Y4DNK4O.js +0 -2
  85. package/dist/chunks/chunk-4BGGWQWS.js +0 -2
  86. package/dist/chunks/chunk-5UFVACSV.js +0 -2
  87. package/dist/chunks/chunk-5W2OZAHQ.js +0 -2
  88. package/dist/chunks/chunk-BWDXJL7T.js +0 -2
  89. package/dist/chunks/chunk-GLABB425.js +0 -2
  90. package/dist/chunks/chunk-JV3POOET.js +0 -2
  91. package/dist/chunks/chunk-K3YSXDTU.js +0 -2
  92. package/dist/chunks/chunk-LY2UZGUL.js +0 -2
  93. package/dist/chunks/chunk-PSQ6MLJM.js +0 -2
  94. package/dist/chunks/chunk-RM5D7Q7W.js +0 -2
  95. package/dist/chunks/chunk-SA2E5GVO.js +0 -2
  96. package/dist/chunks/chunk-T5ZALLTJ.js +0 -2
  97. package/dist/chunks/chunk-XPYZOG5H.js +0 -2
@@ -0,0 +1,564 @@
1
+ /**
2
+ * The censoring weights of {@link timeROC}: marginal (Kaplan-Meier), Cox or Aalen.
3
+ *
4
+ * @category Survival analysis
5
+ */
6
+ export type TimeROCWeighting = "marginal" | "cox" | "aalen";
7
+ /**
8
+ * Options for {@link timeROC}.
9
+ *
10
+ * @category Survival analysis
11
+ */
12
+ export interface TimeROCOptions {
13
+ /** Evaluation times (required; used as given: R adds 0 to a single time). */
14
+ times: readonly number[];
15
+ /** The event of interest among the values of `delta`. Default 1. */
16
+ cause?: number;
17
+ /** Censoring weights: `"marginal"` (default, Kaplan-Meier), `"cox"` or `"aalen"` (models of the censoring with the
18
+ * marker and `otherMarkers` as covariates). */
19
+ weighting?: TimeROCWeighting;
20
+ /** Further covariates of the censoring model (one row per subject), for `"cox"` and `"aalen"`. */
21
+ otherMarkers?: readonly (readonly number[])[];
22
+ /** Compute the iid representation and the standard errors (marginal weights only). Default false. */
23
+ iid?: boolean;
24
+ /** Return the TP and FP curves. Default true. */
25
+ roc?: boolean;
26
+ }
27
+ /** Counts per evaluation time: cases (T < t, the cause), survivors (T > t), other events before t (competing risks
28
+ * only) and the rest ("censored at t": censored by t, or with an event at t).
29
+ *
30
+ * @category Survival analysis
31
+ */
32
+ export interface TimeROCStats {
33
+ /** Subjects with the cause before t (T < t). */
34
+ cases: number;
35
+ /** Subjects still without an event after t (T > t). */
36
+ survivors: number;
37
+ /** Subjects with another event before t (competing risks only). */
38
+ otherEvents?: number;
39
+ /** The rest: censored by t, or with an event at exactly t. */
40
+ censored: number;
41
+ }
42
+ /**
43
+ * The weights of a {@link timeROC} fit, subjects in the order of the sorted times.
44
+ *
45
+ * @category Survival analysis
46
+ */
47
+ export type TimeROCWeights = {
48
+ /** Kaplan-Meier of the censoring. */
49
+ method: "marginal";
50
+ /** G(t), the censoring survival at each time. */
51
+ ipcwTimes: number[];
52
+ /** G(T_i−), at each subject's time (left limit). */
53
+ ipcwSubjectTimes: number[];
54
+ } | {
55
+ /** A Cox or an Aalen model of the censoring. */
56
+ method: "cox" | "aalen";
57
+ /** G(t | Z_i) per time and subject. */
58
+ ipcwTimes: number[][];
59
+ /** G(T_i− | Z_i) per subject. */
60
+ ipcwSubjectTimes: number[];
61
+ };
62
+ interface TimeROCCommon {
63
+ /** The evaluation times. */
64
+ times: number[];
65
+ /** Number of subjects. */
66
+ n: number;
67
+ /** Cumulative incidence of the cause at each time (the cases' weights over n). */
68
+ cumulativeIncidence: number[];
69
+ /** Probability of no event of any kind at each time: the survivors' weighted mass (with the marginal weights exactly
70
+ * the Kaplan-Meier, as R). */
71
+ survProb: number[];
72
+ /** Counts per time. */
73
+ stats: TimeROCStats[];
74
+ /** The censoring weights. */
75
+ weights: TimeROCWeights;
76
+ /** True positive rates per time, one per distinct marker value from the largest ("marker > value") and a last 1. */
77
+ tp?: number[][];
78
+ }
79
+ /**
80
+ * Result of {@link timeROC} without competing risks.
81
+ *
82
+ * @category Survival analysis
83
+ */
84
+ export interface TimeROCSingleResult extends TimeROCCommon {
85
+ /** No event other than the cause in `delta`. */
86
+ competingRisks: false;
87
+ /** The cumulative/dynamic AUC at each time. */
88
+ auc: number[];
89
+ /** False positive rates per time (controls: T > t). */
90
+ fp?: number[][];
91
+ /** With `iid`: the iid representation (per time, subjects in the order of the sorted times) and the standard errors. */
92
+ inference?: {
93
+ /** The AUC's iid representation per time (its influence function at each subject). */
94
+ iid: number[][];
95
+ /** Standard error of the AUC per time: sd(iid) / √n. */
96
+ sd: number[];
97
+ };
98
+ }
99
+ /**
100
+ * Result of {@link timeROC} with competing risks: definition (i) has the controls T > t, definition (ii) also the
101
+ * subjects with another event before t.
102
+ *
103
+ * @category Survival analysis
104
+ */
105
+ export interface TimeROCCompetingResult extends TimeROCCommon {
106
+ /** Other events than the cause occur in `delta`. */
107
+ competingRisks: true;
108
+ /** AUC with definition (i) of the controls at each time. */
109
+ auc1: number[];
110
+ /** AUC with definition (ii) of the controls at each time. */
111
+ auc2: number[];
112
+ /** False positive rates per time, definition (i). */
113
+ fp1?: number[][];
114
+ /** False positive rates per time, definition (ii). */
115
+ fp2?: number[][];
116
+ /** With `iid`: the iid representations and standard errors of both AUCs, as in {@link TimeROCSingleResult}. */
117
+ inference?: {
118
+ /** iid representation of AUC (i) per time. */
119
+ iid1: number[][];
120
+ /** Standard error of AUC (i) per time. */
121
+ sd1: number[];
122
+ /** iid representation of AUC (ii) per time. */
123
+ iid2: number[][];
124
+ /** Standard error of AUC (ii) per time. */
125
+ sd2: number[];
126
+ };
127
+ }
128
+ /**
129
+ * Result of {@link timeROC}.
130
+ *
131
+ * @category Survival analysis
132
+ */
133
+ export type TimeROCResult = TimeROCSingleResult | TimeROCCompetingResult;
134
+ /** @internal */
135
+ export interface Data {
136
+ n: number;
137
+ time: number[];
138
+ delta: number[];
139
+ marker: number[];
140
+ /** Subjects in the order of the sorted times (ties in the data order). */
141
+ order: number[];
142
+ /** Distinct times, increasing. */
143
+ u: number[];
144
+ /** Each subject's index in u. */
145
+ ti: number[];
146
+ /** Censoring risk set at u: T > u, or censored at u (the events at u are left out). */
147
+ R: number[];
148
+ /** Number censored at u. */
149
+ C: number[];
150
+ /** Censoring KM after each u: G(u). */
151
+ G: number[];
152
+ }
153
+ declare function prepare(time: readonly number[], delta: readonly number[], marker: readonly number[]): Data;
154
+ /** @internal */
155
+ export interface AtTime {
156
+ t: number;
157
+ /** Weight of each subject (0 for those with none). */
158
+ w: number[];
159
+ /** The weight is 1 / G(T_i-) (true) or 1 / G(t) (false); only meaningful where w > 0. */
160
+ left: boolean[];
161
+ /** Roles: 1 case, 2 control (T > t), 3 other event before t, 4 an event at exactly t, 0 none. */
162
+ role: number[];
163
+ }
164
+ declare function weightsAt(data: Data, t: number, cause: number, gLeft: (i: number) => number, gAt: (i: number) => number): AtTime;
165
+ /** The marginal weights' left and at-t censoring probabilities. */
166
+ declare function marginalG(data: Data, t: number): {
167
+ gLeft: (i: number) => number;
168
+ gAt: (i: number) => number;
169
+ Gt: number;
170
+ };
171
+ /** A weighted total and its influence (marginal weights): value sum w f / n and w_k f_k - W + Q_k. */
172
+ /** @internal */
173
+ export interface Total {
174
+ value: number;
175
+ inf: number[];
176
+ }
177
+ /**
178
+ * The influence of W(f) = sum_i w_i f_i / n. `exact` takes the derivative of the weighted Kaplan-Meier itself
179
+ * (1 / (R - C) in place of 1 / R; used by the tests' infinitesimal jackknife), the default the usual asymptotic form.
180
+ */
181
+ declare function total(data: Data, at: AtTime, f: readonly number[], exact?: boolean): Total;
182
+ /** The AUC's influence: definition "i" (controls T > t) or "ii" (with the other events before t). @internal */
183
+ export declare function aucInfluence(data: Data, at: AtTime, definition: "i" | "ii", exact?: boolean): {
184
+ auc: number;
185
+ inf: number[];
186
+ };
187
+ /**
188
+ * Time-dependent ROC curves and AUC for censored event times, with a single event or competing risks: the
189
+ * cumulative/dynamic definition (cases T < t with the cause, controls T > t, and for competing risks definition (ii)
190
+ * also the subjects with another event before t), inverse probability of censoring weights from the Kaplan-Meier of
191
+ * the censoring (`"marginal"`), a Cox model (`"cox"`, Efron ties) or Aalen's additive model (`"aalen"`) with the marker
192
+ * and `otherMarkers`; ties in the marker count 1/2. With `iid` (marginal weights), the iid representation of the AUC and
193
+ * its standard error.
194
+ *
195
+ * Differences from R: the times are used as given (R adds 0 to a single time); the iid handles tied times correctly
196
+ * (independent of the data order; equal to R's without ties) and definition (ii)'s is centred on the reported AUC_2;
197
+ * the Cox weights use the maximum of the partial likelihood (R's cph stops about 5e-7 short); Aalen's increments take
198
+ * tied censorings together (R breaks ties at random); a time with a single survivor works (R's competing-risks iid
199
+ * fails there).
200
+ *
201
+ * Equivalent to `timeROC::timeROC()` in R.
202
+ *
203
+ * @param time observed times
204
+ * @param delta 0 censored, otherwise the kind of event
205
+ * @param marker the marker (larger values: the event sooner)
206
+ * @param options `times` (required) and the options of timeROC
207
+ * @category Survival analysis
208
+ */
209
+ export declare function timeROC(time: readonly number[], delta: readonly number[], marker: readonly number[], options: TimeROCOptions): TimeROCResult;
210
+ /**
211
+ * Options for {@link timeROCConfint}.
212
+ *
213
+ * @category Survival analysis
214
+ */
215
+ export interface TimeROCConfintOptions {
216
+ /** Confidence level. Default 0.95. */
217
+ level?: number;
218
+ /** Number of simulations of the simultaneous band. Default 2000. */
219
+ nSim?: number;
220
+ }
221
+ /**
222
+ * Pointwise intervals and the simultaneous band of one AUC, in percent.
223
+ *
224
+ * @category Survival analysis
225
+ */
226
+ export interface TimeROCInterval {
227
+ /** Lower and upper pointwise limits per time (percent, not rounded). */
228
+ ci: [number, number][];
229
+ /** Lower and upper limits of the simultaneous band per time (percent). */
230
+ band: [number, number][];
231
+ /** The band's multiplier (the `level` quantile of the maximum standardized deviation). */
232
+ cAlpha: number;
233
+ }
234
+ /**
235
+ * Result of {@link timeROCConfint}: `auc` without competing risks, `auc1` and `auc2` with them.
236
+ *
237
+ * @category Survival analysis
238
+ */
239
+ export interface TimeROCConfintResult {
240
+ /** The evaluation times. */
241
+ times: number[];
242
+ /** The confidence level. */
243
+ level: number;
244
+ /** Without competing risks: the AUC's intervals. */
245
+ auc?: TimeROCInterval;
246
+ /** With competing risks: AUC (i)'s intervals. */
247
+ auc1?: TimeROCInterval;
248
+ /** With competing risks: AUC (ii)'s intervals (the same draws as AUC (i)'s band, as R). */
249
+ auc2?: TimeROCInterval;
250
+ }
251
+ /**
252
+ * Pointwise confidence intervals of the time-dependent AUC and a simultaneous confidence band over the times, from the
253
+ * iid representation: the band's multiplier is the `level` quantile of the maximum over the times of the
254
+ * standardized multiplier-bootstrap process (`nSim` draws of n standard normals, from rStats.js's generator: set it
255
+ * with `setSeed`; the same seed as R's `set.seed` gives R's band). Percent, not rounded (R rounds to 2 decimals).
256
+ *
257
+ * Equivalent to `timeROC::confint.ipcwsurvivalROC()` in R.
258
+ *
259
+ * @param fit a result of {@link timeROC} with `iid: true`
260
+ * @param options `level` and `nSim`
261
+ * @category Survival analysis
262
+ */
263
+ export declare function timeROCConfint(fit: TimeROCResult, options?: TimeROCConfintOptions): TimeROCConfintResult;
264
+ /**
265
+ * Options for {@link timeROCCompare}.
266
+ *
267
+ * @category Survival analysis
268
+ */
269
+ export interface TimeROCCompareOptions {
270
+ /** Also the p-values adjusted for the several times (the maximum of the correlated statistics). Default false. */
271
+ adjusted?: boolean;
272
+ }
273
+ /**
274
+ * The comparison of one AUC definition.
275
+ *
276
+ * @category Survival analysis
277
+ */
278
+ export interface TimeROCComparison {
279
+ /** p-values per time. */
280
+ pValues: number[];
281
+ /** With `adjusted`: the p-values adjusted for the several times. */
282
+ adjusted?: number[];
283
+ /** With `adjusted`: the correlation of the statistics across the times. */
284
+ cor?: number[][];
285
+ }
286
+ /**
287
+ * Result of {@link timeROCCompare}.
288
+ *
289
+ * @category Survival analysis
290
+ */
291
+ export interface TimeROCCompareResult {
292
+ /** The evaluation times. */
293
+ times: number[];
294
+ /** Without competing risks: the comparison of the AUCs. */
295
+ auc?: TimeROCComparison;
296
+ /** With competing risks: the comparison of AUC (i). */
297
+ auc1?: TimeROCComparison;
298
+ /** With competing risks: the comparison of AUC (ii). */
299
+ auc2?: TimeROCComparison;
300
+ }
301
+ /**
302
+ * Compares the time-dependent AUCs of two markers measured on the same subjects at each time, by the z statistic of
303
+ * the difference with the standard error from the difference of the iid representations; with `adjusted`, also the
304
+ * p-values adjusted for the several times, P(max_t |Z_t| >= |z_t|) for Z normal with the correlation of the
305
+ * statistics (computed deterministically as a sum of positive terms, so that small p-values keep their relative
306
+ * accuracy: to rounding up to three times, to about 1e-6 relative from four on; R integrates 1 − P at random with
307
+ * mvtnorm's default absolute tolerance of 1e-3, so the two differ by up to about 1e-4).
308
+ *
309
+ * Equivalent to `timeROC::compare()` in R.
310
+ *
311
+ * @param x a result of {@link timeROC} with `iid: true`
312
+ * @param y another, on the same subjects and times
313
+ * @param options `adjusted`
314
+ * @category Survival analysis
315
+ */
316
+ export declare function timeROCCompare(x: TimeROCResult, y: TimeROCResult, options?: TimeROCCompareOptions): TimeROCCompareResult;
317
+ /**
318
+ * P(max_j |Z_j| >= b) for Z ~ N(0, cor), computed directly (not as 1 − P(all |Z_j| < b), which loses the small values
319
+ * to cancellation) by the first exceedance: Q = 2 Σ_i P(|Z_j| < b for j < i, Z_i >= b), a sum of positive terms (the
320
+ * factor 2 by the symmetry Z → −Z). The i-th term is a probability of the leading i variables: pnorm for i = 1,
321
+ * pbvnorm for i = 2, adaptive Gauss-Legendre over Z_3 >= b of the conditional bivariate probability (pbvnorm) for
322
+ * i = 3, and Genz's separation of variables (Genz 1992) with a Richtmyer lattice for i >= 4 or a correlation within
323
+ * 1e-9 of ±1 (a Richtmyer lattice periodized by the baker's transform, fixed shifts from a private generator: no use of
324
+ * the user's random numbers; points doubled until two standard errors fall below 1e-6 of the term). Each term
325
+ * keeps its relative accuracy, so small adjusted p-values do too.
326
+ *
327
+ * @internal
328
+ */
329
+ export declare function pmaxAbsExceed(b: number, cor: readonly (readonly number[])[]): number;
330
+ /** P(all |Z_j| <= b) = 1 − {@link pmaxAbsExceed} (for moderate b; the tests). @internal */
331
+ export declare function pmvnormSymmetric(b: number, cor: readonly (readonly number[])[]): number;
332
+ /**
333
+ * Options for {@link seSpPPVNPV}.
334
+ *
335
+ * @category Survival analysis
336
+ */
337
+ export interface SeSpPPVNPVOptions extends Omit<TimeROCOptions, "roc"> {
338
+ }
339
+ /**
340
+ * Standard errors of {@link seSpPPVNPV} (with `iid`), per time.
341
+ *
342
+ * @category Survival analysis
343
+ */
344
+ export interface SeSpPPVNPVInference {
345
+ /** Standard errors, sd(iid) / √n, per time. */
346
+ se: {
347
+ /** Of the sensitivity. */
348
+ se: number[];
349
+ /** Of the specificity with definition (i). */
350
+ sp1: number[];
351
+ /** Of the specificity with definition (ii). */
352
+ sp2: number[];
353
+ /** Of the positive predictive value. */
354
+ ppv: number[];
355
+ /** Of the negative predictive value (i). */
356
+ npv1: number[];
357
+ /** Of the negative predictive value (ii). */
358
+ npv2: number[];
359
+ };
360
+ /** The iid representations, per time, subjects in the order of the sorted times. */
361
+ iid: {
362
+ /** Of the sensitivity. */
363
+ se: number[][];
364
+ /** Of the specificity with definition (i). */
365
+ sp1: number[][];
366
+ /** Of the specificity with definition (ii). */
367
+ sp2: number[][];
368
+ /** Of the positive predictive value. */
369
+ ppv: number[][];
370
+ /** Of the negative predictive value (i). */
371
+ npv1: number[][];
372
+ /** Of the negative predictive value (ii). */
373
+ npv2: number[][];
374
+ };
375
+ }
376
+ /**
377
+ * Result of {@link seSpPPVNPV}: `fp` and `npv` without competing risks, `fp1`, `fp2`, `npv1` and `npv2` with them.
378
+ *
379
+ * @category Survival analysis
380
+ */
381
+ export interface SeSpPPVNPVResult {
382
+ /** The threshold: positive means marker > cutpoint. */
383
+ cutpoint: number;
384
+ /** The evaluation times. */
385
+ times: number[];
386
+ /** Number of subjects (without NA). */
387
+ n: number;
388
+ /** Whether other events than the cause occur. */
389
+ competingRisks: boolean;
390
+ /** Sensitivity (true positive rate) per time. */
391
+ tp: number[];
392
+ /** Without competing risks: false positive rate per time. */
393
+ fp?: number[];
394
+ /** With competing risks: false positive rate, definition (i). */
395
+ fp1?: number[];
396
+ /** With competing risks: false positive rate, definition (ii). */
397
+ fp2?: number[];
398
+ /** Positive predictive value per time. */
399
+ ppv: number[];
400
+ /** Without competing risks: negative predictive value per time. */
401
+ npv?: number[];
402
+ /** With competing risks: negative predictive value (i). */
403
+ npv1?: number[];
404
+ /** With competing risks: negative predictive value (ii). */
405
+ npv2?: number[];
406
+ /** Counts per time, with the positives (marker > cutpoint) and negatives. */
407
+ stats: (TimeROCStats & {
408
+ /** Subjects with marker > cutpoint. */
409
+ positive: number;
410
+ /** Subjects with marker <= cutpoint. */
411
+ negative: number;
412
+ })[];
413
+ /** The censoring weights. */
414
+ weights: TimeROCWeights;
415
+ /** With `iid`: standard errors and iid representations. */
416
+ inference?: SeSpPPVNPVInference;
417
+ }
418
+ /**
419
+ * Time-dependent sensitivity, specificity and predictive values of the rule "marker > cutpoint", with the weights of
420
+ * {@link timeROC}: PPV = TP F / (TP F + FP S) and NPV = (1 − FP) S / ((1 − FP) S + (1 − TP) F) (F the cumulative
421
+ * incidence, S its complement); with competing risks PPV and NPV_2 with definition (ii) and NPV_1 = (1 − FP_1) S_1 /
422
+ * ((1 − FP_2) S_2 + (1 − TP) F). With `iid` (marginal weights), the iid representations and standard errors of Se,
423
+ * Sp (both definitions), PPV and the NPVs.
424
+ *
425
+ * Differences from R: as {@link timeROC}; Sp2's denominator is the weighted mass of the definition (ii) controls (R's
426
+ * 1 − F, the same unless events fall at t).
427
+ *
428
+ * Equivalent to `timeROC::SeSpPPVNPV()` in R.
429
+ *
430
+ * @param cutpoint the marker's threshold
431
+ * @param time observed times
432
+ * @param delta 0 censored, otherwise the kind of event
433
+ * @param marker the marker
434
+ * @param options `times` (required) and the options of timeROC
435
+ * @category Survival analysis
436
+ */
437
+ export declare function seSpPPVNPV(cutpoint: number, time: readonly number[], delta: readonly number[], marker: readonly number[], options: SeSpPPVNPVOptions): SeSpPPVNPVResult;
438
+ /**
439
+ * Options for {@link timeROCAucCurve} and {@link timeROCAucDiff}.
440
+ *
441
+ * @category Survival analysis
442
+ */
443
+ export interface TimeROCAucCurveOptions extends TimeROCConfintOptions {
444
+ /** With competing risks, the definition of the controls: 1 (default) or 2. */
445
+ fp?: 1 | 2;
446
+ }
447
+ /**
448
+ * Result of {@link timeROCAucCurve}: the AUC per time with its pointwise interval and simultaneous band (as
449
+ * proportions).
450
+ *
451
+ * @category Survival analysis
452
+ */
453
+ export interface TimeROCAucCurveResult {
454
+ /** The evaluation times. */
455
+ times: number[];
456
+ /** AUC per time. */
457
+ auc: number[];
458
+ /** Lower pointwise confidence limit per time. */
459
+ lower: number[];
460
+ /** Upper pointwise confidence limit per time. */
461
+ upper: number[];
462
+ /** Lower limit of the simultaneous band per time. */
463
+ bandLower: number[];
464
+ /** Upper limit of the simultaneous band per time. */
465
+ bandUpper: number[];
466
+ }
467
+ /**
468
+ * The values that R's `plotAUCcurve` draws: the AUC over the times with the pointwise confidence interval and the
469
+ * simultaneous band of {@link timeROCConfint} (as proportions). No plot.
470
+ *
471
+ * Equivalent to `timeROC::plotAUCcurve()` in R.
472
+ *
473
+ * @param fit a result of {@link timeROC} with `iid: true`
474
+ * @param options `level`, `nSim` and `fp`
475
+ * @category Survival analysis
476
+ */
477
+ export declare function timeROCAucCurve(fit: TimeROCResult, options?: TimeROCAucCurveOptions): TimeROCAucCurveResult;
478
+ /**
479
+ * Result of {@link timeROCAucDiff}.
480
+ *
481
+ * @category Survival analysis
482
+ */
483
+ export interface TimeROCAucDiffResult {
484
+ /** The evaluation times. */
485
+ times: number[];
486
+ /** AUC of x minus AUC of y. */
487
+ diff: number[];
488
+ /** Lower pointwise confidence limit of the difference. */
489
+ lower: number[];
490
+ /** Upper pointwise confidence limit of the difference. */
491
+ upper: number[];
492
+ }
493
+ /**
494
+ * The values behind R's `plotAUCcurveDiff`: the difference of two time-dependent AUCs over the times with the
495
+ * pointwise confidence interval from the difference of the iid representations (as {@link timeROCCompare}). R also
496
+ * draws a simultaneous band, whose simulation cannot be checked (R returns nothing); it is not offered. No plot.
497
+ *
498
+ * Not an R function.
499
+ *
500
+ * @param x a result of {@link timeROC} with `iid: true`
501
+ * @param y another, on the same subjects and times
502
+ * @param options `level` and `fp`
503
+ * @category Survival analysis
504
+ */
505
+ export declare function timeROCAucDiff(x: TimeROCResult, y: TimeROCResult, options?: Omit<TimeROCAucCurveOptions, "nSim">): TimeROCAucDiffResult;
506
+ /**
507
+ * Options for {@link survivalROC}.
508
+ *
509
+ * @category Survival analysis
510
+ */
511
+ export interface SurvivalROCOptions {
512
+ /** The time of the prediction (required). */
513
+ predictTime: number;
514
+ /** Thresholds of the marker, sorted (R prepends −Inf; from two thresholds on, the last one's point is (0, 0), as R).
515
+ * Default: the sorted distinct marker values. */
516
+ cutValues?: readonly number[];
517
+ /** The estimator: only `"KM"` (R's default, the nearest-neighbour estimator `"NNE"`, is not offered). Default "KM". */
518
+ method?: "KM";
519
+ }
520
+ /**
521
+ * Result of {@link survivalROC}.
522
+ *
523
+ * @category Survival analysis
524
+ */
525
+ export interface SurvivalROCResult {
526
+ /** −Inf, then the thresholds. */
527
+ cutValues: number[];
528
+ /** True positive rate at each threshold. */
529
+ tp: number[];
530
+ /** False positive rate at each threshold. */
531
+ fp: number[];
532
+ /** The prediction time. */
533
+ predictTime: number;
534
+ /** Kaplan-Meier survival at the prediction time. */
535
+ survival: number;
536
+ /** Trapezoid over the points in the order of the thresholds (not bounded by 1, as R). */
537
+ auc: number;
538
+ }
539
+ /**
540
+ * Time-dependent ROC curve at a prediction time by Heagerty, Lumley and Pepe's Kaplan-Meier estimator: S(c, t) =
541
+ * KM_{marker > c}(t) P(marker > c), TP(c) = (P(marker > c) − S(c, t)) / (1 − S(t)), FP(c) = S(c, t) / S(t) (neither
542
+ * is forced to be monotone or below 1, as R), and the AUC by the trapezoid over the thresholds in order.
543
+ *
544
+ * Differences from R: only the Kaplan-Meier estimator (`method = "KM"`); R's default, the nearest-neighbour estimator,
545
+ * is not offered.
546
+ *
547
+ * Equivalent to `survivalROC::survivalROC()` in R.
548
+ *
549
+ * @param time observed times
550
+ * @param status 1 event, 0 censored
551
+ * @param marker the marker
552
+ * @param options `predictTime` (required), `cutValues` and `method`
553
+ * @category Survival analysis
554
+ */
555
+ export declare function survivalROC(time: readonly number[], status: readonly number[], marker: readonly number[], options: SurvivalROCOptions): SurvivalROCResult;
556
+ /** The pieces used by the tests' infinitesimal jackknife. @internal */
557
+ export declare const timeROCInternals: {
558
+ prepare: typeof prepare;
559
+ weightsAt: typeof weightsAt;
560
+ marginalG: typeof marginalG;
561
+ total: typeof total;
562
+ aucInfluence: typeof aucInfluence;
563
+ };
564
+ export {};