@numero-uno-jpn/rstats 1.3.0 → 1.5.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.
- package/CHANGELOG.md +85 -0
- package/README.ja.md +9 -7
- package/README.md +9 -7
- package/dist/chunks/chunk-2IYY74LX.js +2 -0
- package/dist/chunks/{chunk-LA4H6ZSC.js → chunk-2MYUAEYE.js} +2 -2
- package/dist/chunks/{chunk-GUM57VVM.js → chunk-3BEE6BHN.js} +1 -1
- package/dist/chunks/{chunk-2VZW4XPK.js → chunk-73QCE2CI.js} +2 -2
- package/dist/chunks/{chunk-AJZV2SVY.js → chunk-AIXJAVDS.js} +2 -2
- package/dist/chunks/{chunk-6X2ZMPF5.js → chunk-BJOZZ5J6.js} +2 -2
- package/dist/chunks/{chunk-P7ZHH2SF.js → chunk-CX4XK7WC.js} +2 -2
- package/dist/chunks/{chunk-PDHBRDTF.js → chunk-DYCWYHYV.js} +1 -1
- package/dist/chunks/{chunk-6TZVS6WC.js → chunk-E5M5RAVB.js} +2 -2
- package/dist/chunks/{chunk-IJV43Y7Q.js → chunk-F2MURX2Y.js} +2 -2
- package/dist/chunks/{chunk-HBRSUHSU.js → chunk-F7SQG6BV.js} +2 -2
- package/dist/chunks/{chunk-UOAFEB64.js → chunk-FCF6FBJP.js} +2 -2
- package/dist/chunks/{chunk-TZTVDVP4.js → chunk-FMLFYM7N.js} +2 -2
- package/dist/chunks/{chunk-EBRTF7RM.js → chunk-GDMNF4P3.js} +1 -1
- package/dist/chunks/{chunk-RCGW2DCK.js → chunk-JBJTXMRJ.js} +2 -2
- package/dist/chunks/{chunk-Z74ZOTUN.js → chunk-L7PDJNJ3.js} +2 -2
- package/dist/chunks/{chunk-I5NWGQOQ.js → chunk-LVB22NKV.js} +2 -2
- package/dist/chunks/{chunk-UJYRU37Z.js → chunk-MJV5G7FG.js} +2 -2
- package/dist/chunks/{chunk-JJRZ2TTF.js → chunk-MXOGMN4P.js} +2 -2
- package/dist/chunks/{chunk-UMDXXT3M.js → chunk-MYRCEQ2R.js} +1 -1
- package/dist/chunks/{chunk-IOGQEMDE.js → chunk-Q32WODL4.js} +2 -2
- package/dist/chunks/{chunk-BNTBZ5W3.js → chunk-RZBX6VYO.js} +2 -2
- package/dist/chunks/chunk-TP4PRPVQ.js +2 -0
- package/dist/chunks/{chunk-FFNHG5SB.js → chunk-UJM7AJII.js} +1 -1
- package/dist/chunks/chunk-VAWD57ZB.js +2 -0
- package/dist/chunks/{chunk-LNUNKFIH.js → chunk-WBEYJ5W5.js} +2 -2
- package/dist/chunks/{chunk-LMNU4NHZ.js → chunk-YK2EJU6T.js} +2 -2
- package/dist/descriptive.js +2 -2
- package/dist/distributions.js +2 -2
- package/dist/entries/tests.d.ts +6 -0
- package/dist/entries/tests.js +6 -0
- package/dist/htest/sampleSize.d.ts +290 -0
- package/dist/htest/sampleSize.js +625 -0
- package/dist/linalg.js +2 -2
- package/dist/mixed.js +2 -2
- package/dist/models/competingRisks.d.ts +188 -0
- package/dist/models/competingRisks.js +685 -0
- package/dist/models/coxZph.d.ts +67 -0
- package/dist/models/coxZph.js +479 -0
- package/dist/models/coxph.d.ts +61 -21
- package/dist/models/coxph.js +305 -65
- package/dist/models/metaAnalysis.d.ts +207 -0
- package/dist/models/metaAnalysis.js +696 -0
- package/dist/models/rmst2.d.ts +126 -0
- package/dist/models/rmst2.js +365 -0
- package/dist/models/survival.d.ts +65 -24
- package/dist/models/survival.js +407 -72
- package/dist/models/survreg.d.ts +160 -0
- package/dist/models/survreg.js +809 -0
- package/dist/numerics.js +2 -2
- package/dist/rstats.js +19 -16
- package/dist/special.js +2 -2
- package/dist/tests.js +16 -13
- package/llms.txt +13 -2
- package/package.json +1 -1
- package/dist/chunks/chunk-4OOTEXZU.js +0 -2
- package/dist/chunks/chunk-MJXETGT2.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[][];
|