@numero-uno-jpn/rstats 1.7.0 → 1.9.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 +38 -0
- package/README.ja.md +8 -7
- package/README.md +7 -6
- package/dist/chunks/{chunk-CB7STL5Z.js → chunk-2COJEI44.js} +2 -2
- package/dist/chunks/{chunk-V2Y2W7LE.js → chunk-2SO7Z3NV.js} +2 -2
- package/dist/chunks/{chunk-MOJ2KIQE.js → chunk-3J2HFC4A.js} +2 -2
- package/dist/chunks/chunk-3LDUKHJZ.js +3 -0
- package/dist/chunks/{chunk-VALULDEX.js → chunk-4IHHZ3F4.js} +1 -1
- package/dist/chunks/chunk-4QWW62QN.js +2 -0
- package/dist/chunks/chunk-575F6RXJ.js +2 -0
- package/dist/chunks/{chunk-CUT3IHMY.js → chunk-5C7XHQKP.js} +1 -1
- package/dist/chunks/{chunk-J7ZVV4DN.js → chunk-7F7PY35D.js} +2 -2
- package/dist/chunks/{chunk-PLQQ4VFN.js → chunk-7VPO2LTR.js} +2 -2
- package/dist/chunks/{chunk-THSV22QF.js → chunk-ANGKH5D4.js} +2 -2
- package/dist/chunks/{chunk-TY3IFCLI.js → chunk-BX47HGID.js} +2 -2
- package/dist/chunks/chunk-CWS62KPG.js +2 -0
- package/dist/chunks/chunk-D3CWLSLS.js +2 -0
- package/dist/chunks/{chunk-HSJ4OT3H.js → chunk-DEAU6HWA.js} +1 -1
- package/dist/chunks/chunk-DRSA7ITF.js +2 -0
- package/dist/chunks/{chunk-56AMJQ27.js → chunk-G3XMR7PA.js} +2 -2
- package/dist/chunks/chunk-I7E5J5PG.js +3 -0
- package/dist/chunks/{chunk-YKNRDPIB.js → chunk-IEATFACS.js} +2 -2
- package/dist/chunks/{chunk-HORF36FD.js → chunk-IXK3JA2R.js} +2 -2
- package/dist/chunks/{chunk-CZUOG2U5.js → chunk-J3TS4PGN.js} +2 -2
- package/dist/chunks/{chunk-BJMPSDJ7.js → chunk-MNIICUNF.js} +2 -2
- package/dist/chunks/chunk-MT7XELUM.js +2 -0
- package/dist/chunks/{chunk-76FLTZVF.js → chunk-OGHJJKUR.js} +2 -2
- package/dist/chunks/{chunk-QWDK3ZC2.js → chunk-RNK6EHEK.js} +2 -2
- package/dist/chunks/{chunk-RIP2RKAW.js → chunk-T3NUXZRL.js} +2 -2
- package/dist/chunks/chunk-TKMNASCD.js +2 -0
- package/dist/chunks/chunk-UA66IB37.js +2 -0
- package/dist/chunks/chunk-UUZVQS4O.js +2 -0
- package/dist/chunks/chunk-VO2NIKVB.js +2 -0
- package/dist/chunks/chunk-WFE52E6F.js +2 -0
- package/dist/chunks/{chunk-SDT3YHAG.js → chunk-WOZEQS2I.js} +2 -2
- package/dist/chunks/{chunk-FQRNZEH2.js → chunk-XCKQQVN7.js} +2 -2
- package/dist/chunks/chunk-XNLZFKL5.js +2 -0
- package/dist/chunks/chunk-YFZBGUIT.js +2 -0
- package/dist/chunks/{chunk-YVJ4LDDE.js → chunk-YK7Q6CNX.js} +2 -2
- package/dist/chunks/{chunk-B7XZMIQO.js → chunk-Z47NJMYU.js} +2 -2
- package/dist/descriptive.js +2 -2
- package/dist/distributions.js +2 -2
- package/dist/entries/multivariate.d.ts +3 -0
- package/dist/entries/multivariate.js +4 -0
- package/dist/entries/regression.d.ts +4 -0
- package/dist/entries/regression.js +6 -0
- package/dist/entries/tests.d.ts +3 -1
- package/dist/entries/tests.js +3 -1
- package/dist/htest/grubbs.d.ts +68 -0
- package/dist/htest/grubbs.js +151 -0
- package/dist/htest/multipleComparisons.d.ts +21 -0
- package/dist/htest/multipleComparisons.js +47 -0
- package/dist/htest/rankTests.d.ts +35 -0
- package/dist/htest/rankTests.js +89 -1
- package/dist/internal/summary.js +8 -2
- package/dist/linalg.js +2 -2
- package/dist/mixed.js +2 -2
- package/dist/models/gee.d.ts +280 -0
- package/dist/models/gee.js +704 -0
- package/dist/models/glmnet.d.ts +259 -0
- package/dist/models/glmnet.js +1112 -0
- package/dist/models/modelMatrix.d.ts +2 -0
- package/dist/models/rq.d.ts +203 -0
- package/dist/models/rq.js +1089 -0
- package/dist/multivariate/cancor.d.ts +55 -0
- package/dist/multivariate/cancor.js +167 -0
- package/dist/multivariate/lda.d.ts +146 -0
- package/dist/multivariate/lda.js +325 -0
- package/dist/multivariate/manova.d.ts +106 -0
- package/dist/multivariate/manova.js +303 -0
- package/dist/multivariate.js +2 -0
- package/dist/numerics.js +2 -2
- package/dist/regression.js +3 -3
- package/dist/rstats.js +16 -16
- package/dist/special.js +2 -2
- package/dist/tests.js +15 -15
- package/llms.txt +5 -1
- package/package.json +6 -1
- package/dist/chunks/chunk-AIEPW6DX.js +0 -2
- package/dist/chunks/chunk-B6KJ4RWG.js +0 -2
- package/dist/chunks/chunk-JXEXOD7K.js +0 -2
- package/dist/chunks/chunk-KSH43GX4.js +0 -2
- package/dist/chunks/chunk-LMRCFKVK.js +0 -2
- package/dist/chunks/chunk-PCTRVBEJ.js +0 -3
- package/dist/chunks/chunk-R5BMFVIH.js +0 -2
- package/dist/chunks/chunk-R7F7ELS7.js +0 -3
- package/dist/chunks/chunk-RX6MZO2Y.js +0 -2
- package/dist/chunks/chunk-VQOU7U7R.js +0 -2
|
@@ -52,6 +52,8 @@ export interface ModelMatrixResult {
|
|
|
52
52
|
/**
|
|
53
53
|
* A contrast the internal model-matrix code accepts: those of {@link ContrastName} and R's `contr.poly` (orthogonal
|
|
54
54
|
* polynomials in the level scores 1, 2, ..., columns `.L`, `.Q`, `.C`, `^4`, ...), which lmer's fixed effects may use.
|
|
55
|
+
*
|
|
56
|
+
* @category Regression
|
|
55
57
|
*/
|
|
56
58
|
export type DesignContrast = ContrastName | "contr.poly";
|
|
57
59
|
/** A contrast matrix (one row per level) and its column names */
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { type DesignContrast } from "./modelMatrix.js";
|
|
2
|
+
import type { DataFrame } from "./modelFrame.js";
|
|
3
|
+
import type { Sample } from "../htest/types.js";
|
|
4
|
+
/** Algorithm used to fit a quantile-regression model.
|
|
5
|
+
*
|
|
6
|
+
* @category Regression
|
|
7
|
+
*/
|
|
8
|
+
export type RqMethod = "br" | "fn";
|
|
9
|
+
/** Options for {@link rq}.
|
|
10
|
+
*
|
|
11
|
+
* @category Regression
|
|
12
|
+
*/
|
|
13
|
+
export interface RqOptions {
|
|
14
|
+
/** Quantile probability or probabilities to fit. */
|
|
15
|
+
tau?: number | Sample;
|
|
16
|
+
/** Quantile-regression optimization method. */
|
|
17
|
+
method?: RqMethod;
|
|
18
|
+
/** Nonnegative prior observation weights. */
|
|
19
|
+
weights?: Sample | string;
|
|
20
|
+
/** Contrast coding specifications for factor predictors. */
|
|
21
|
+
contrasts?: Record<string, DesignContrast>;
|
|
22
|
+
/** Explicit level order for factor predictors. */
|
|
23
|
+
levels?: Record<string, readonly string[]>;
|
|
24
|
+
/** Maximum number of optimization iterations. */
|
|
25
|
+
maxit?: number;
|
|
26
|
+
/** Convergence tolerance for the optimization. */
|
|
27
|
+
eps?: number;
|
|
28
|
+
}
|
|
29
|
+
/** Model data retained by a quantile-regression fit.
|
|
30
|
+
*
|
|
31
|
+
* @category Regression
|
|
32
|
+
*/
|
|
33
|
+
export interface RqModel {
|
|
34
|
+
/** Model formula used to define the response and predictors. */
|
|
35
|
+
formula: string;
|
|
36
|
+
/** Numeric model matrix used by the fit. */
|
|
37
|
+
x: number[][];
|
|
38
|
+
/** Observed response values. */
|
|
39
|
+
y: number[];
|
|
40
|
+
/** Nonnegative prior observation weights. */
|
|
41
|
+
weights: number[];
|
|
42
|
+
/** Original data-row indices retained in the model frame. */
|
|
43
|
+
rows: number[];
|
|
44
|
+
/** Names of the columns in the model matrix. */
|
|
45
|
+
columnNames: string[];
|
|
46
|
+
/** Quantile probability or probabilities to fit. */
|
|
47
|
+
tau: number[];
|
|
48
|
+
/** Quantile-regression optimization method. */
|
|
49
|
+
method: RqMethod;
|
|
50
|
+
}
|
|
51
|
+
/** Result returned by {@link rq}.
|
|
52
|
+
*
|
|
53
|
+
* @category Regression
|
|
54
|
+
*/
|
|
55
|
+
export interface RqResult {
|
|
56
|
+
/** Estimated regression coefficients. */
|
|
57
|
+
coefficients: Record<string, number | number[]>;
|
|
58
|
+
/** Fitted conditional means or quantiles for the input rows. */
|
|
59
|
+
fittedValues: number[] | number[][];
|
|
60
|
+
/** Response residuals for the input rows. */
|
|
61
|
+
residuals: number[] | number[][];
|
|
62
|
+
/** Quantile check-loss objective value. */
|
|
63
|
+
rho: number | number[];
|
|
64
|
+
/** Whether the numerical fitting procedure met its convergence criterion. */
|
|
65
|
+
converged: boolean;
|
|
66
|
+
/** Number of iterations used by the fitting procedure. */
|
|
67
|
+
iterations: number;
|
|
68
|
+
/** Warnings recorded while fitting or summarizing the model. */
|
|
69
|
+
warnings: string[];
|
|
70
|
+
/** Model-frame and design information retained for downstream methods. */
|
|
71
|
+
model: RqModel;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Fit a linear conditional quantile model. Equivalent to `quantreg::rq()` in R.
|
|
75
|
+
* Uses the formula/model-matrix interface of other regression models.
|
|
76
|
+
*
|
|
77
|
+
* @param formula A formula such as `y ~ x`.
|
|
78
|
+
* @param data A data frame of columns.
|
|
79
|
+
* @param options Quantile, algorithm, and prior weights.
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* rq("y ~ x", { x: [1, 2, 3, 4], y: [2, 1, 4, 3] }, { tau: 0.5 });
|
|
83
|
+
* ```
|
|
84
|
+
* @category Regression
|
|
85
|
+
*/
|
|
86
|
+
export declare function rq(formula: string, data: DataFrame, options?: RqOptions): RqResult;
|
|
87
|
+
/**
|
|
88
|
+
* Predict conditional quantiles for new observations. Equivalent to `quantreg::predict.rq()` in R.
|
|
89
|
+
*
|
|
90
|
+
* @category Regression
|
|
91
|
+
*/
|
|
92
|
+
export declare function rqPredict(fit: RqResult, newdata: DataFrame): number[] | number[][];
|
|
93
|
+
/** Options for rqSummary.
|
|
94
|
+
* @category Regression
|
|
95
|
+
*/
|
|
96
|
+
export interface RqSummaryOptions {
|
|
97
|
+
/** Standard-error or interval method used for the summary. */
|
|
98
|
+
se?: "nid" | "rank";
|
|
99
|
+
/** Estimated coefficient covariance matrix or matrices. */
|
|
100
|
+
covariance?: boolean;
|
|
101
|
+
/** Confidence level for reported intervals. */
|
|
102
|
+
level?: number;
|
|
103
|
+
/** The iid form of the rank test (R's `iid`). Only `true` (the default) is supported in 1.8.0. */
|
|
104
|
+
iid?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/** A coefficient row in an rq summary.
|
|
107
|
+
* @category Regression
|
|
108
|
+
*/
|
|
109
|
+
export interface RqCoefficientSummary {
|
|
110
|
+
/** Quantile probability or probabilities to fit. */
|
|
111
|
+
tau: number;
|
|
112
|
+
/** Model term represented by this coefficient row. */
|
|
113
|
+
term: string;
|
|
114
|
+
/** Estimated coefficient value. */
|
|
115
|
+
estimate: number;
|
|
116
|
+
/** NaN for `se = "rank"`, which gives an interval (`lower`, `upper`) instead. */
|
|
117
|
+
stdError: number;
|
|
118
|
+
/** Wald test statistic for the coefficient. */
|
|
119
|
+
statistic: number;
|
|
120
|
+
/** Two-sided p-value associated with the coefficient statistic. */
|
|
121
|
+
pValue: number;
|
|
122
|
+
/** The confidence limits of `se = "rank"` (R's `lower bd` and `upper bd`). */
|
|
123
|
+
lower?: number;
|
|
124
|
+
/** Upper confidence limit for the coefficient. */
|
|
125
|
+
upper?: number;
|
|
126
|
+
}
|
|
127
|
+
/** Result of rqSummary.
|
|
128
|
+
* @category Regression
|
|
129
|
+
*/
|
|
130
|
+
export interface RqSummaryResult {
|
|
131
|
+
/** Estimated regression coefficients. */
|
|
132
|
+
coefficients: RqCoefficientSummary[];
|
|
133
|
+
/** Estimated coefficient covariance matrix or matrices. */
|
|
134
|
+
covariance?: number[][][];
|
|
135
|
+
/** Standard-error or interval method used for the summary. */
|
|
136
|
+
se: string;
|
|
137
|
+
/** Warnings recorded while fitting or summarizing the model. */
|
|
138
|
+
warnings: string[];
|
|
139
|
+
}
|
|
140
|
+
/** Options for confidence prediction intervals.
|
|
141
|
+
* @category Regression
|
|
142
|
+
*/
|
|
143
|
+
export interface RqPredictOptions {
|
|
144
|
+
/** Whether prediction output includes confidence intervals. */
|
|
145
|
+
interval?: "none" | "confidence";
|
|
146
|
+
/** Prediction scale or confidence-interval construction method. */
|
|
147
|
+
type?: "none" | "direct" | "percentile";
|
|
148
|
+
/** Confidence level for reported intervals. */
|
|
149
|
+
level?: number;
|
|
150
|
+
}
|
|
151
|
+
/** Result of confidence prediction.
|
|
152
|
+
* @category Regression
|
|
153
|
+
*/
|
|
154
|
+
export interface RqPredictResult {
|
|
155
|
+
/** Predicted conditional quantiles or fitted values. */
|
|
156
|
+
fit: number[] | number[][];
|
|
157
|
+
/** Lower confidence limit for the coefficient. */
|
|
158
|
+
lower?: number[] | number[][];
|
|
159
|
+
/** Upper confidence limit for the coefficient. */
|
|
160
|
+
upper?: number[] | number[][];
|
|
161
|
+
/** Confidence level for reported intervals. */
|
|
162
|
+
level: number;
|
|
163
|
+
/** Prediction scale or confidence-interval construction method. */
|
|
164
|
+
type: string;
|
|
165
|
+
}
|
|
166
|
+
/** Coefficient summary with Hall–Sheather bandwidth and the nid sandwich covariance. Equivalent to R's `summary.rq()`.
|
|
167
|
+
*
|
|
168
|
+
* @category Regression
|
|
169
|
+
*/
|
|
170
|
+
export declare function rqSummary(fit: RqResult, options?: RqSummaryOptions): RqSummaryResult;
|
|
171
|
+
/** Confidence intervals for conditional quantile predictions using nid or direct quantile refits. Equivalent to R's `predict.rq()`.
|
|
172
|
+
*
|
|
173
|
+
* @category Regression
|
|
174
|
+
*/
|
|
175
|
+
export declare function rqPredictInterval(fit: RqResult, newdata: DataFrame, options?: RqPredictOptions): RqPredictResult;
|
|
176
|
+
/** Wald test of equality of slopes across the quantiles in a multiple-tau fit. Equivalent to R's `anova.rq()`.
|
|
177
|
+
*
|
|
178
|
+
* @category Regression
|
|
179
|
+
*/
|
|
180
|
+
/** Wald comparisons for nested models or slopes across multiple quantiles. Equivalent to R's `anova.rq()`.
|
|
181
|
+
*
|
|
182
|
+
* @category Regression
|
|
183
|
+
*/
|
|
184
|
+
export declare function rqAnova(fit: RqResult): RqWaldResult;
|
|
185
|
+
export declare function rqAnova(fit: RqResult, joint: true): RqWaldResult;
|
|
186
|
+
export declare function rqAnova(fit: RqResult, joint: false): RqWaldResult[];
|
|
187
|
+
export declare function rqAnova(fit: RqResult, joint: boolean): RqWaldResult | RqWaldResult[];
|
|
188
|
+
export declare function rqAnova(fit: RqResult, reduced: RqResult): RqWaldResult;
|
|
189
|
+
/** Result of a quantile-regression Wald comparison.
|
|
190
|
+
* @category Regression
|
|
191
|
+
*/
|
|
192
|
+
export interface RqWaldResult {
|
|
193
|
+
/** Joint Wald statistic for the tested slope restrictions across quantiles. */
|
|
194
|
+
statistic: number;
|
|
195
|
+
/** Numerator degrees of freedom for the Wald test. */
|
|
196
|
+
df: number;
|
|
197
|
+
/** Residual degrees of freedom used for the reference distribution. */
|
|
198
|
+
dfResidual: number;
|
|
199
|
+
/** P-value for the joint Wald comparison. */
|
|
200
|
+
pValue: number;
|
|
201
|
+
/** Wald comparison method used for the multi-quantile test. */
|
|
202
|
+
method: "Wald";
|
|
203
|
+
}
|